Author: vrubezhny
Date: 2012-01-31 12:24:37 -0500 (Tue, 31 Jan 2012)
New Revision: 38332
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeNameHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeValueHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java
Log:
JBIDE-10621
Redesign HyperlinkDetector so that partitioning and hyperlinks not do twice the same job.
Hyperlinks and Hyperlink Partitioners are redesigned due to exclude duplication work on
regions calculation.
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -112,13 +112,13 @@
protected abstract IHyperlinkRegion parse(IDocument document, int offset,
IHyperlinkRegion superRegion);
- protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
+ protected String getAxis(IDocument document, int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node node = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node node = Utils.findNodeForOffset(xmlDocument, offset);
if (node instanceof Attr) {
Attr attr = (Attr)node;
return Utils.getParentAxisForNode(xmlDocument, attr) + attr.getName() +
"/"; //$NON-NLS-1$
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 - 2012 Red Hat, Inc.
+ * Copyright (c) 2007-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,
@@ -53,7 +53,7 @@
int end = Utils.getValueEnd(node);
String contentType = superRegion.getContentType();
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
IHyperlinkRegion hyperRegion = new HyperlinkRegion(start, end-start,
axis, contentType, INCLUDE_FILE_PARTITION);
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -81,7 +81,7 @@
int startOffset = text.getStartOffset();
String contentType = superRegion.getContentType();
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
IHyperlinkRegion hyperRegion = new HyperlinkRegion(startOffset, length,
axis, contentType, type);
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -41,7 +41,7 @@
IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = XML_CLASS_PARTITION;
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -43,7 +43,7 @@
IRegion r = getRegion(document, offset);
if (r == null) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType();
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -68,7 +68,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = XML_DOCTYPE_PARTITION;
@@ -80,14 +80,14 @@
}
}
- protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
+ protected String getAxis(IDocument document, int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node node = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node node = Utils.findNodeForOffset(xmlDocument, offset);
if (node instanceof DocumentType) {
return "/@DOCTYPE/" + node.getNodeName() + "/"; //$NON-NLS-1$
//$NON-NLS-2$
}
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeNameHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeNameHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeNameHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -48,7 +48,7 @@
int start = (n instanceof IDOMAttr) ? ((IDOMAttr)n).getNameRegionStartOffset() : -1;
int end = (n instanceof IDOMAttr) ? ((IDOMAttr)n).getNameRegionEndOffset() : -1;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType();
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeValueHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeValueHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeValueHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -72,7 +72,7 @@
if (propStart > offset || propStart + propLength < offset) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType();
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -47,7 +47,7 @@
int end = Utils.getValueEnd(node);
if(start < 0) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = XML_ELEMENT_PARTITION;
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -42,7 +42,7 @@
IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;// document.get(r.getOffset(), r.getLength())
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = XML_ELEMENT_NAME_PARTITION;
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -53,7 +53,7 @@
IRegion r = getRegion(document, offset);
if (r == null) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType();
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -41,7 +41,7 @@
IRegion r = getRegion(document, offset);
if (r == null) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType();
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -40,7 +40,7 @@
IRegion r = getRegion(document, offset);
if (r == null) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType();
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -42,7 +42,7 @@
Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Text)) return null;
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = getPartitionType(axis);
int start = Utils.getValueStart(n);
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java 2012-01-31
17:07:50 UTC (rev 38331)
+++
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java 2012-01-31
17:24:37 UTC (rev 38332)
@@ -50,7 +50,7 @@
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
- String axis = getAxis(document, superRegion);
+ String axis = getAxis(document, offset);
String contentType = superRegion.getContentType();
String type = XML_XMLNS_PARTITION;