Author: vrubezhny
Date: 2012-01-30 14:30:30 -0500 (Mon, 30 Jan 2012)
New Revision: 38298
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
Log:
JBIDE-10621
Redesign HyperlinkDetector so that partitioning and hyperlinks not do twice the same job.
JUnit tests are fixed
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java 2012-01-30
19:28:30 UTC (rev 38297)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/validation/XHTMLDetectorAndValidatorTest.java 2012-01-30
19:30:30 UTC (rev 38298)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.jsf.test.validation;
import java.io.File;
@@ -52,7 +62,6 @@
"/html_page_2.html"
};
-
IProject project;
/* (non-Javadoc)
@@ -185,6 +194,4 @@
return (content == null ? null : new Document(content));
}
-
-
}
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2012-01-30
19:28:30 UTC (rev 38297)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/hyperlink/SeamViewHyperlinkPartitionerTest.java 2012-01-30
19:30:30 UTC (rev 38298)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.seam.ui.test.hyperlink;
import java.util.ArrayList;
@@ -111,20 +121,22 @@
for (int i = 0; i < document.getLength(); i++) {
TestData testData = new TestData(document, i);
- String[] partitionTypes = detector.getPartitionTypes(document, i);
+ IHyperlinkRegion[] partitions = detector.getPartitions(document, i);
boolean recognized = false;
- if (partitionTypes != null && partitionTypes.length > 0) {
- recognized =
("org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK".equals(partitionTypes[0]));
+ if (partitions != null && partitions.length > 0) {
+ recognized =
("org.jboss.tools.seam.text.ext.SEAM_VIEW_LINK".equals(partitions[0].getType()));
}
if (recognized) {
- recognized &= seamViewPartitioner.recognize(testData.document,
testData.getHyperlinkRegion());
+ recognized &= seamViewPartitioner.recognize(testData.document, i,
testData.getHyperlinkRegion());
}
if (recognized) {
- String childPartitionType =
seamViewPartitioner.getChildPartitionType(testData.document,
testData.getHyperlinkRegion());
+ IHyperlinkRegion childPartition =
seamViewPartitioner.getChildPartitionRegion(testData.document, i,
testData.getHyperlinkRegion());
+ String childPartitionType = childPartition == null ? null :
childPartition.getType();
+
// if (childPartitionType != null)
// System.out.println("position #" + i + " partitionType: " +
childPartitionType);
@@ -279,10 +291,10 @@
* @param document -
* assumes document is not null
* @param offset
- * @return String partition types
+ * @return IHyperlinkRegion partitions
*/
- public String[] getPartitionTypes(IDocument document, int offset) {
- return super.getPartitionTypes(document, offset);
+ public IHyperlinkRegion[] getPartitions(IDocument document, int offset) {
+ return super.getPartitions(document, offset);
}
};