JBoss Tools SVN: r38295 - in trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink: jsp and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:25:22 -0500 (Mon, 30 Jan 2012)
New Revision: 38295
Removed:
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPLinkHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRelativeLinkHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.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/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011-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,
@@ -31,15 +31,11 @@
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
-import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.text.ext.JSTExtensionsPlugin;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.css.CSSMediaRule;
import org.w3c.dom.css.CSSRule;
@@ -133,7 +129,6 @@
}
return PageContextFactory.getFileFromProject(filePath, getFile());
-
}
/**
@@ -217,87 +212,14 @@
}
return null;
}
-
- protected IRegion fLastRegion = null;
-
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- /**
- *
- * @param offset
- * @return
- */
- protected IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null)
- return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr))
- return null;
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
- if (start > offset)
- return null;
-
- String attrText = getDocument().get(start, end - start);
-
- StringBuffer sb = new StringBuffer(attrText);
- // find start of css class
- int bStart = offset - start;
- while (bStart >= 0) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bStart))
- && sb.charAt(bStart) != '_' && sb.charAt(bStart) != '-'
- && sb.charAt(bStart) != '.') {
- bStart++;
- break;
- }
-
- if (bStart == 0)
- break;
- bStart--;
- }
- // find end of css class
- int bEnd = offset - start;
- while (bEnd < sb.length()) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bEnd))
- && sb.charAt(bEnd) != '_' && sb.charAt(bEnd) != '-'
- && sb.charAt(bEnd) != '.')
- break;
- bEnd++;
- }
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset)
- return null;
- return new Region(propStart, propLength);
- } catch (BadLocationException x) {
- // ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
+
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String styleName = getStyleName(fLastRegion);
+ String styleName = getStyleName(getHyperlinkRegion());
if (styleName == null)
return MessageFormat.format(Messages.OpenA, Messages.CSSStyle);
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 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,
@@ -10,7 +10,10 @@
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
@@ -30,16 +33,14 @@
AbstractHyperlinkPartitioner implements IHyperlinkPartitionRecognizer {
public static final String CSS_CLASS_PARTITION = "org.jboss.tools.common.text.ext.CSS_CLASS"; //$NON-NLS-1$
-
private static final String CSS_CLASS_TOKEN = "/class/"; //$NON-NLS-1$
private static final String EXCLUSION_TOKEN = "jsp:usebean/class/"; //$NON-NLS-1$
-
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument,
* com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document,
+ protected IHyperlinkRegion parse(IDocument document, int offset,
IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
@@ -48,24 +49,19 @@
if (xmlDocument == null)
return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion
- .getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr))
return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType(axis);
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
- if (start < 0 || end < start)
+
+ IRegion r = getRegion(document, offset);
+ if (r == null)
return null;
- int length = end - start;
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis,
- contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -75,7 +71,7 @@
return CSS_CLASS_PARTITION;
}
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if (region.getAxis() != null
&& region.getAxis().toLowerCase().endsWith(CSS_CLASS_TOKEN)
&& !region.getAxis().toLowerCase().endsWith(EXCLUSION_TOKEN)) // Fix for JBIDE-5056
@@ -83,4 +79,66 @@
return false;
}
+ /**
+ *
+ * @param offset
+ * @return
+ */
+ protected IRegion getRegion(IDocument document, int offset) {
+ StructuredModelWrapper smw = new StructuredModelWrapper();
+ try {
+ smw.init(document);
+ Document xmlDocument = smw.getDocument();
+ if (xmlDocument == null)
+ return null;
+
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
+
+ if (n == null || !(n instanceof Attr))
+ return null;
+ int start = Utils.getValueStart(n);
+ int end = Utils.getValueEnd(n);
+ if (start > offset)
+ return null;
+
+ String attrText = document.get(start, end - start);
+
+ StringBuffer sb = new StringBuffer(attrText);
+ // find start of css class
+ int bStart = offset - start;
+ while (bStart >= 0) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bStart))
+ && sb.charAt(bStart) != '_' && sb.charAt(bStart) != '-'
+ && sb.charAt(bStart) != '.') {
+ bStart++;
+ break;
+ }
+
+ if (bStart == 0)
+ break;
+ bStart--;
+ }
+ // find end of css class
+ int bEnd = offset - start;
+ while (bEnd < sb.length()) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bEnd))
+ && sb.charAt(bEnd) != '_' && sb.charAt(bEnd) != '-'
+ && sb.charAt(bEnd) != '.')
+ break;
+ bEnd++;
+ }
+
+ final int propStart = bStart + start;
+ final int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset)
+ return null;
+ return new Region(propStart, propLength);
+ } catch (BadLocationException x) {
+ // ignore
+ return null;
+ } finally {
+ smw.dispose();
+ }
+ }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/ELHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011-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,
@@ -25,6 +25,7 @@
import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
import org.jboss.tools.common.util.StringUtil;
@@ -40,17 +41,16 @@
setDocument(document);
}
+ /**
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink#doGetHyperlinkRegion(int)
+ */
@Override
protected IRegion doGetHyperlinkRegion(int offset) {
-
- return new IRegion(){
- public int getLength() {
- return segment.getSourceReference().getLength();
- }
-
- public int getOffset() {
- return reference.getStartPosition()+segment.getSourceReference().getStartPosition();
- }};
+ IRegion region = super.doGetHyperlinkRegion(offset);
+ return (region != null ? region : new HyperlinkRegion(
+ reference.getStartPosition()+segment.getSourceReference().getStartPosition(),
+ segment.getSourceReference().getLength()));
}
@Override
@@ -81,11 +81,6 @@
}
}
-// private String getRequestMethod(Properties prop) {
-// return prop != null && prop.getProperty(WebPromptingProvider.KEY) == null ?
-// WebPromptingProvider.JSF_OPEN_BUNDLE : WebPromptingProvider.JSF_OPEN_KEY;
-// }
-
@Override
public String getHyperlinkText() {
IOpenableReference[] openables = segment.getOpenable();
@@ -122,5 +117,4 @@
}
return file;
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/JSPStylesheetRelLinkHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,110 +1,20 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.RelativeLinkHyperlink;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
/**
* @author Jeremy
*
*/
public class JSPStylesheetRelLinkHyperlink extends RelativeLinkHyperlink {
-
- private static final String HREF_ATTRNAME = "href"; //$NON-NLS-1$
-
- protected IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Text || n instanceof Attr)) return null;
-
- String text = null;
- int bStart = 0;
- int bEnd = 0;
-
- if (n instanceof Text) {
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
- if (start < 0 || start > offset) return null;
-
- text = getDocument().get(start, end - start);
- bStart = offset - start;
- bEnd = offset - start;
- } else if (n instanceof Attr) {
- Attr attr = (Attr)n;
- if (!HREF_ATTRNAME.equalsIgnoreCase(attr.getName())) return null;
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
- if(start < 0) return null;
-
- text = getDocument().get(start, end - start);
- bStart = offset - start;
- bEnd = offset - start;
- }
- StringBuffer sb = new StringBuffer(text);
- //find start of bean property
- while (bStart >= 0) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
- sb.charAt(bStart) != '\\' && sb.charAt(bStart) != '/' &&
- sb.charAt(bStart) != ':' && sb.charAt(bStart) != '-' &&
- sb.charAt(bStart) != '.' && sb.charAt(bStart) != '_' &&
- sb.charAt(bStart) != '%' && sb.charAt(bStart) != '?' &&
- sb.charAt(bStart) != '&' && sb.charAt(bStart) != '=') {
- bStart++;
- break;
- }
-
- if (bStart == 0) break;
- bStart--;
- }
- // find end of bean property
- while (bEnd >= 0 && bEnd < sb.length()) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)) &&
- sb.charAt(bEnd) != '\\' && sb.charAt(bEnd) != '/' &&
- sb.charAt(bEnd) != ':' && sb.charAt(bEnd) != '-' &&
- sb.charAt(bEnd) != '.' && sb.charAt(bEnd) != '_' &&
- sb.charAt(bEnd) != '%' && sb.charAt(bEnd) != '?' &&
- sb.charAt(bEnd) != '&' && sb.charAt(bEnd) != '=') {
- break;
- }
- bEnd++;
- }
-
- final int propStart = bStart + Utils.getValueStart(n);
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/TaglibDefinitionFilesHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 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,
@@ -27,21 +27,19 @@
public class TaglibDefinitionFilesHyperlinkPartitioner extends XMLTextHyperlinkPartitioner {
public static final String TAGLIB_XML_PARTITION = "org.jboss.tools.common.text.ext.xml.TAGLIB_XML"; //$NON-NLS-1$
- /* (non-Javadoc)
- * @see org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion)
- */
+
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
@Override
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
return (n instanceof Text);
} finally {
smw.dispose();
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -127,27 +127,27 @@
for (int i = list.getLength() - 1; list != null && i >= 0; i--) {
if(!(list.item(i) instanceof Element)) continue;
- Element element = (Element)list.item(i);
- int start = Utils.getValueStart(element);
- if (start < 0 || start >= endOffset) continue;
+
+ Element element = (Element)list.item(i);
+ int start = Utils.getValueStart(element);
+ if (start < 0 || start >= endOffset) continue;
+
+ String elementName = element.getNodeName();
+ if (tagName.equals(elementName)) {
- String elementName = element.getNodeName();
- if (tagName.equals(elementName)) {
-
- Attr idAttr = element.getAttributeNode(ID_ATTRNAME);
- if (idAttr != null) {
- String val = Utils.trimQuotes(idAttr.getNodeValue());
- if (id.equals(val)) {
- return element;
- }
+ Attr idAttr = element.getAttributeNode(ID_ATTRNAME);
+ if (idAttr != null) {
+ String val = Utils.trimQuotes(idAttr.getNodeValue());
+ if (id.equals(val)) {
+ return element;
}
}
-
- if (element.hasChildNodes()) {
- Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, tagName);
- if (child != null) return child;
- }
-
+ }
+
+ if (element.hasChildNodes()) {
+ Element child = findElementByIDBackward(element.getChildNodes(), id, endOffset, tagName);
+ if (child != null) return child;
+ }
}
} finally {
smw.dispose();
@@ -189,11 +189,10 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String propertyName = getPropertyName(fLastRegion);
+ String propertyName = getPropertyName(getHyperlinkRegion());
if (propertyName == null)
return MessageFormat.format(Messages.OpenA, Messages.Getter);
return MessageFormat.format(Messages.OpenGetterOrSetterForProperty, Messages.Getter, propertyName);
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanGetPropertyHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,27 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import org.eclipse.jface.text.IDocument;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -32,14 +30,14 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr)) return null;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
@@ -48,11 +46,8 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_BEAN_GET_PROPERTY_PARTITION;
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
@@ -68,19 +63,19 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
- if (start < 0 || start > region.getOffset() || end < region.getOffset())
+ if (start < 0 || start > offset || end < offset)
return false;
return true;
@@ -88,5 +83,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -32,11 +32,10 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String propertyName = getPropertyName(fLastRegion);
+ String propertyName = getPropertyName(getHyperlinkRegion());
if (propertyName == null)
return MessageFormat.format(Messages.OpenA, Messages.Setter);
return MessageFormat.format(Messages.OpenGetterOrSetterForProperty, Messages.Setter, propertyName);
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPBeanSetPropertyHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,26 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -31,14 +30,14 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr)) return null;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
@@ -46,11 +45,8 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_BEAN_SET_PROPERTY_PARTITION;
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
@@ -66,19 +62,19 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
- if (start < 0 || start > region.getOffset() || end < region.getOffset())
+ if (start < 0 || start > offset|| end < offset)
return false;
return true;
@@ -86,5 +82,4 @@
smw.dispose();
}
}
-
}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPCSSClassHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.text.ext.hyperlink.jsp;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
-import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-
-/**
- * * @deprecated see org.jboss.tools.jst.text.ext.hyperlink.CSSClassHyperlinkPartitioner
- * @author Jeremy
- */
-public class JSPCSSClassHyperlinkPartitioner extends AbstractHyperlinkPartitioner /*implements IHyperlinkPartitionRecognizer */{
- public static final String JSP_CSS_CLASS_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSP_CSS_CLASS"; //$NON-NLS-1$
-
- /**
- * @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
- */
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(document);
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-// if (!recognize(document, superRegion)) return null;
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
- if (r == null) return null;
-
- String axis = getAxis(document, superRegion);
- String contentType = superRegion.getContentType();
- String type = JSP_CSS_CLASS_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
- } finally {
- smw.dispose();
- }
- }
-
- protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
- if (superRegion.getAxis() == null || superRegion.getAxis().length() == 0) {
- return JSPRootHyperlinkPartitioner.computeAxis(document, superRegion.getOffset()) + "/"; //$NON-NLS-1$
- }
- return superRegion.getAxis();
- }
-
- public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(document);
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start < 0 || start > offset) return null;
-
- String attrText = document.get(start, end - start);
- StringBuffer sb = new StringBuffer(attrText);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = attrText.length() - 1;
-
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
-
- int propStart = bStart + start;
- int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
- return region;
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
-
- }
-
-}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -16,17 +16,22 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLElementNameHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.jst.web.tld.ITaglibMapping;
import org.jboss.tools.jst.web.tld.IWebProject;
import org.jboss.tools.jst.web.tld.WebProjectFactory;
import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -73,12 +78,17 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- String nodePrefix = getTagPrefix(region);
+ Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ if (n == null || !(n instanceof IDOMElement)) return null;
+ IHyperlinkRegion r = XMLElementNameHyperlinkPartitioner.getRegion(getDocument(), region.getOffset());
+ if (r == null) return null;
+
+ String nodePrefix = getTagPrefix(r);
if (nodePrefix == null)
return null;
TaglibManagerWrapper tmw = new TaglibManagerWrapper();
- tmw.init(getDocument(), region.getOffset());
+ tmw.init(getDocument(), r.getOffset());
if(!tmw.exists()) return null;
String uri = tmw.getUri(nodePrefix);
@@ -115,26 +125,16 @@
return null;
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = JSPElementNameHyperlinkPartitioner.getRegion(getDocument(), offset);
- return fLastRegion;
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String tagPrefix = getTagPrefix(fLastRegion);
+ String tagPrefix = getTagPrefix(getHyperlinkRegion());
if (tagPrefix == null)
return MessageFormat.format(Messages.OpenA, Messages.TagLibrary);
return MessageFormat.format(Messages.OpenTagLibraryForPrefix, tagPrefix);
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPElementNameHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,26 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import java.util.Map;
+
import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLElementNameHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.xml.XMLElementNameHyperlinkPartitioner;
-
/**
* @author Jeremy
*/
@@ -35,8 +35,8 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
- if (!super.recognize(document, region)) return false;
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
+ if (!super.recognize(document, offset, region)) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
@@ -44,10 +44,10 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
Element elem = (Element)n;
- IHyperlinkRegion r = getRegion(document, region.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return false;
String nodeName = elem.getNodeName();
@@ -55,12 +55,10 @@
String nodePrefix = nodeName.substring(0, nodeName.indexOf(":")); //$NON-NLS-1$
if (nodePrefix == null || nodePrefix.length() == 0) return false;
- Map trackers = JSPRootHyperlinkPartitioner.getTrackersMap(document, region.getOffset());
+ Map trackers = JSPRootHyperlinkPartitioner.getTrackersMap(document, offset);
return (trackers != null && trackers.containsKey(nodePrefix));
} finally {
smw.dispose();
}
}
-
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -26,7 +26,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -112,7 +111,6 @@
return null;
}
-
String getForId(IRegion region) {
try {
return Utils.trimQuotes(getDocument().get(region.getOffset(), region.getLength()));
@@ -122,75 +120,16 @@
}
}
- IRegion fLastRegion = null;
/*
* (non-Javadoc)
*
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region (propStart,propLength);
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
- /*
- * (non-Javadoc)
- *
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String forId = getForId(fLastRegion);
+ String forId = getForId(getHyperlinkRegion());
if (forId == null)
return MessageFormat.format(Messages.BrowseFor, Messages.BeanId);
return MessageFormat.format(Messages.BrowseForBeanId, forId);
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPForBeanIdHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,26 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -31,26 +30,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-// if (!recognize(document, superRegion)) return null;
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_FOR_BEAN_ID_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -111,7 +105,5 @@
} finally {
smw.dispose();
}
-
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPLinkHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPLinkHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2011 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,
@@ -31,7 +31,7 @@
/* (non-Javadoc)
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
return true;
}
@@ -46,7 +46,7 @@
return JSPStylesheetRelLinkHyperlinkPartitioner.JSP_STYLESHEET_REL_LINK_PARTITION;
}
- public boolean excludes(String partitionType, IDocument document,
+ public boolean excludes(String partitionType, IDocument document, int offset,
IHyperlinkRegion superRegion) {
return false;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRelativeLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRelativeLinkHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRelativeLinkHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,17 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import org.eclipse.jface.text.IDocument;
-
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
@@ -31,7 +30,7 @@
/* (non-Javadoc)
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
return true;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPRootHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -44,17 +44,16 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
- if (!recognize(document, superRegion)) return null;
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
+ if (!recognize(document, offset, superRegion)) return null;
String axis = computeAxis(document, superRegion.getOffset()) + "/"; //$NON-NLS-1$
String contentType = superRegion.getContentType();
String type = JSP_ROOT_PARTITION;
- int length = superRegion.getLength();
- int offset = superRegion.getOffset();
+ int superLength = superRegion.getLength();
+ int superOffset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(superOffset, superLength, axis, contentType, type);
}
public static String computeAxis(IDocument document, int offset) {
@@ -209,14 +208,14 @@
/* (non-Javadoc)
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null) return false;
@@ -225,5 +224,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPStylesheetRelLinkHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2011 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,
@@ -46,7 +46,7 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
if(superRegion == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
@@ -54,19 +54,14 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-// if (!recognize(document, superRegion)) return null;
- IRegion r = getRegion(document, superRegion.getOffset());
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_STYLESHEET_REL_LINK_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -75,7 +70,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if(region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
@@ -83,7 +78,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
Attr attr = null;
Node tag = null;
@@ -116,7 +111,7 @@
// do recognize style text
int start = Utils.getValueStart(styleText);
- int current = region.getOffset();
+ int current = offset;
String text = styleText.getData();
if (text == null || text.length() == 0) return false;
@@ -238,9 +233,8 @@
return null;
}
- public boolean excludes(String partitionType, IDocument document,
+ public boolean excludes(String partitionType, IDocument document, int offset,
IHyperlinkRegion superRegion) {
- return (JSP_STYLESHEET_REL_LINK_PARTITION.equals(partitionType) && recognize(document, superRegion));
+ return (JSP_STYLESHEET_REL_LINK_PARTITION.equals(partitionType) && recognize(document, offset, superRegion));
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTagAttributeHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,47 +1,45 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
*/
public class JSPTagAttributeHyperlinkPartitioner extends JSPElementAttributeValueHyperlinkPartitioner implements IHyperlinkPartitionRecognizer {
public static final String JSP_TAG_ATTRIBUTE_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSP_TAG_ATTRIBUTE"; //$NON-NLS-1$
-
private static final String JSP_ATTRIBUTE_TAGNAME = "jsp:attribute"; //$NON-NLS-1$
private static final String JSP_ELEMENT_TAGNAME = "jsp:element"; //$NON-NLS-1$
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (!(n instanceof Element)) return null;
@@ -52,11 +50,8 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_TAG_ATTRIBUTE_PARTITION;
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
@@ -65,7 +60,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if(region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
@@ -73,7 +68,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (!(n instanceof Element)) return false;
return (JSP_ATTRIBUTE_TAGNAME.equals(n.getNodeName()) &&
@@ -90,5 +85,4 @@
}
return superRegion.getAxis();
}
-
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -14,7 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
@@ -27,13 +26,10 @@
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.web.tld.ITaglibMapping;
import org.jboss.tools.jst.web.tld.IWebProject;
import org.jboss.tools.jst.web.tld.WebProjectFactory;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
import org.w3c.dom.Node;
/**
@@ -51,7 +47,6 @@
else {
openFileFailed();
}
-
}
protected final String JAR_FILE_PROTOCOL = "jar:file:/";//$NON-NLS-1$
@@ -109,52 +104,17 @@
if (model != null) model.releaseFromRead();
}
}
-
- IRegion fLastRegion = null;
- /*
- * (non-Javadoc)
- *
- * @seecom.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
- if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
- if (!(n instanceof IDOMElement)) return null;
- if (!"jsp:directive.taglib".equals(n.getNodeName())) return null; //$NON-NLS-1$
-
- IDOMElement taglib = (IDOMElement)n;
-
- final int taglibLength = taglib.getEndOffset() - taglib.getStartOffset();
- final int taglibOffset = taglib.getStartOffset();
-
- return new Region(taglibOffset,taglibLength);
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String uri = getTaglibUri(fLastRegion);
+ String uri = getTaglibUri(getHyperlinkRegion());
if (uri == null)
return MessageFormat.format(Messages.OpenA, Messages.TagLibrary);
return MessageFormat.format(Messages.OpenTagLibraryForUri, uri);
}
-
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPTaglibHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,26 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -31,7 +30,7 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
if(document == null || superRegion == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
@@ -39,7 +38,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (!(n instanceof Element)) return null;
if (!"jsp:directive.taglib".equals(n.getNodeName())) return null; //$NON-NLS-1$
@@ -51,21 +50,17 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_TAGLIB_PARTITION;
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
}
-
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if(document == null || region == null) return false;
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
@@ -73,7 +68,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (!(n instanceof Element)) return false;
return ("jsp:directive.taglib".equals(n.getNodeName())); //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlink.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
@@ -14,7 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
@@ -55,14 +54,14 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlink#openFileInEditor(java.lang.String)
*/
protected void openFileInEditor(String fileString) {
- if (fileString.startsWith(JAR_FILE_PROTOCOL)) {
- fileString = fileString.substring(JAR_FILE_PROTOCOL.length());
- IEditorInput jarEditorInput = createEditorInput(fileString);
- IEditorPart part = openFileInEditor(jarEditorInput, fileString);
- if (part == null) openFileFailed();
- } else {
- super.openFileInEditor(fileString);
- }
+ if (fileString.startsWith(JAR_FILE_PROTOCOL)) {
+ fileString = fileString.substring(JAR_FILE_PROTOCOL.length());
+ IEditorInput jarEditorInput = createEditorInput(fileString);
+ IEditorPart part = openFileInEditor(jarEditorInput, fileString);
+ if (part == null) openFileFailed();
+ } else {
+ super.openFileInEditor(fileString);
+ }
}
private XModelObject getFilename(IRegion region) {
@@ -124,48 +123,13 @@
}
}
-
- IRegion fLastRegion = null;
- /**
- * @seecom.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
- if (!(n instanceof IDOMAttr)) return null;
- IDOMAttr xmlnsAttr = (IDOMAttr)n;
- if (xmlnsAttr.getName() == null || !xmlnsAttr.getName().startsWith("xmlns:")) return null; //$NON-NLS-1$
- Element rootElem = xmlnsAttr.getOwnerElement();
- if (!(rootElem.getNodeName().equals("jsp:root") || rootElem.getNodeName().equalsIgnoreCase("html"))) return null; //$NON-NLS-1$ //$NON-NLS-2$
-
- final int taglibLength = xmlnsAttr.getValueRegionText().length();
- final int taglibOffset = xmlnsAttr.getValueRegionStartOffset();
-
- return new Region(taglibOffset,taglibLength);
- } finally {
- smw.dispose();
- }
-
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String uri = getUri(fLastRegion);
+ String uri = getUri(getHyperlinkRegion());
if (uri == null)
return MessageFormat.format(Messages.NotFound, "URI"); //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/jsp/JSPXmlNsHyperlinkPartitioner.java 2012-01-30 19:25:22 UTC (rev 38295)
@@ -1,15 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink.jsp;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
@@ -32,14 +33,14 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof IDOMAttr)) return null;
IDOMAttr xmlnsAttr = (IDOMAttr)n;
if (xmlnsAttr.getName() == null || !xmlnsAttr.getName().startsWith("xmlns:")) return null; //$NON-NLS-1$
@@ -49,28 +50,50 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_XMLNS_PARTITION;
- int length = xmlns.length() - (superRegion.getOffset() - xmlnsAttr.getValueRegionStartOffset());
- int offset = superRegion.getOffset();
+ int start = Utils.getValueStart(xmlnsAttr);
+ int end = Utils.getValueEnd(xmlnsAttr);
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ String text = document.get(start, end - start);
+ StringBuffer sb = new StringBuffer(text);
+
+ //find start and end of property value
+ int bStart = 0;
+ int bEnd = text.length() - 1;
+
+ while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
+ || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
+ bStart++;
+ }
+ while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
+ || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
+ bEnd--;
+ }
+ bEnd++;
+
+ final int propStart = bStart + start;
+ final int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset) return null;
+
+ return new HyperlinkRegion(propStart, propLength, axis, contentType, type);
+ } catch (BadLocationException e) {
+ return null;
} finally {
smw.dispose();
}
}
-
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
Attr xmlnsAttr = (Attr)n;
if (xmlnsAttr.getName() == null || !xmlnsAttr.getName().startsWith("xmlns:")) return false; //$NON-NLS-1$
@@ -81,7 +104,6 @@
smw.dispose();
}
}
-
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
if (superRegion.getAxis() == null || superRegion.getAxis().length() == 0) {
12 years, 11 months
JBoss Tools SVN: r38294 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:24:13 -0500 (Mon, 30 Jan 2012)
New Revision: 38294
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlinkPartitioner.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/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlink.java 2012-01-30 19:24:13 UTC (rev 38294)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2009-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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.facelets.hyperlink;
@@ -28,7 +28,7 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String styleName = getStyleName(fLastRegion);
+ String styleName = getStyleName(getHyperlinkRegion());
if (styleName == null)
return MessageFormat.format(Messages.OpenA, Messages.CSSStyle);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/src/org/jboss/tools/jsf/text/ext/facelets/hyperlink/FaceletsCSSClassHyperlinkPartitioner.java 2012-01-30 19:24:13 UTC (rev 38294)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2009-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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.facelets.hyperlink;
@@ -23,9 +23,8 @@
public class FaceletsCSSClassHyperlinkPartitioner extends CSSClassHyperlinkPartitioner {
public static final String FACELETS_CSS_CLASS_PARTITION = "org.jboss.tools.common.text.ext.FACELETS_CSS_CLASS"; //$NON-NLS-1$
-
@Override
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if (region.getAxis() != null){
return true;
}
@@ -36,5 +35,4 @@
protected String getPartitionType(String axis) {
return FACELETS_CSS_CLASS_PARTITION;
}
-
}
12 years, 11 months
JBoss Tools SVN: r38293 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:23:43 -0500 (Mon, 30 Jan 2012)
New Revision: 38293
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/TLDTagHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.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/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2011 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,
@@ -114,8 +114,7 @@
}
return (resourceBundles.size() == 0 ?
- null : resourceBundles.toArray(new XModelObject[0]));
-
+ null : resourceBundles.toArray(new XModelObject[0]));
}
private String[] getBundles() {
@@ -248,11 +247,10 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String baseName = getBundleBasename(fLastRegion);
+ String baseName = getBundleBasename(getHyperlinkRegion());
if (baseName == null)
return MessageFormat.format(Messages.OpenA, Messages.Bundle);
return MessageFormat.format(Messages.OpenBundle, baseName);
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ConverterHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -16,20 +16,12 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -58,7 +50,6 @@
}
private String getConverterID (IRegion region) {
- getRegion(region.getOffset());
String converterID = null;
if(getDocument() != null && region != null) {
try {
@@ -70,73 +61,16 @@
return converterID;
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String converterId = getConverterID(fLastRegion);
+ String converterId = getConverterID(getHyperlinkRegion());
if (converterId == null)
return MessageFormat.format(Messages.OpenA, JSFTextExtMessages.Converter);
return MessageFormat.format(JSFTextExtMessages.OpenConverterForId, converterId);
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForIDHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -21,13 +21,11 @@
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
-import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -123,121 +121,16 @@
return sb.substring(bStart, bEnd);
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- // Find an ID (suppose that there may be a list of commas-separated IDs)
- int bIdStart = offset;
- int bIdEnd = offset;
-
- //find start of bean property
- while (bIdStart >= propStart) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bIdStart - start)) &&
- sb.charAt(bIdStart - start) != ' ') {
- bIdStart++;
- break;
- }
-
- if (bIdStart == 0) break;
- bIdStart--;
- }
- // find end of bean property
- while (bIdEnd < propStart + propLength) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bIdEnd - start)) &&
- sb.charAt(bIdEnd - start) != ' ')
- break;
- bIdEnd++;
- }
-
- // Skip leading spaces
- while (bIdStart < bIdEnd) {
- if (Character.isJavaIdentifierPart(sb.charAt(bIdStart - start))) {
- break;
- }
-
- bIdStart++;
- }
-
- // Skip trailing spaces
- while (bIdEnd > bIdStart) {
- if (Character.isJavaIdentifierPart(sb.charAt(bIdEnd - 1 - start))) {
- break;
- }
-
- bIdEnd--;
- }
-
- int idStart = bIdStart;
- int idLength = bIdEnd - bIdStart;
-
- if (idStart > offset || idStart + idLength < offset) return null;
-
-
-
- return new Region(idStart,idLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String forId = getForId(fLastRegion);
+ String forId = getForId(getHyperlinkRegion());
if (forId == null)
return MessageFormat.format(Messages.BrowseFor, Messages.Id);
return MessageFormat.format(Messages.BrowseForId, forId);
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ForwardHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -75,26 +75,16 @@
return super.getFileFromProject(fileName);
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = JSPForwardHyperlinkPartitioner.getRegion(getDocument(), offset);
- return fLastRegion;
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String filePath = getFilePath(fLastRegion);
+ String filePath = getFilePath(getHyperlinkRegion());
if (filePath == null)
return MessageFormat.format(Messages.OpenA, Messages.File);
return MessageFormat.format(Messages.OpenFile, filePath);
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFContextParamLinkHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,92 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-
/**
* @author Jeremy
*
*/
public class JSFContextParamLinkHyperlink extends JSFLinkHyperlink {
- protected IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
- if (start < 0 || start > offset) return null;
-
- String attrText = getDocument().get(start, end - start);
-
- StringBuffer sb = new StringBuffer(attrText);
- //find start of bean property
- int bStart = offset - start;
- while (bStart >= 0) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
- sb.charAt(bStart) != '\\' && sb.charAt(bStart) != '/' &&
- sb.charAt(bStart) != ':' && sb.charAt(bStart) != '-' &&
- sb.charAt(bStart) != '.' && sb.charAt(bStart) != '_' &&
- sb.charAt(bStart) != '%' && sb.charAt(bStart) != '?' &&
- sb.charAt(bStart) != '&' && sb.charAt(bStart) != '=') {
- bStart++;
- break;
- }
-
- if (bStart == 0) break;
- bStart--;
- }
- // find end of bean property
- int bEnd = offset - start;
- while (bEnd < sb.length()) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)) &&
- sb.charAt(bEnd) != '\\' && sb.charAt(bEnd) != '/' &&
- sb.charAt(bEnd) != ':' && sb.charAt(bEnd) != '-' &&
- sb.charAt(bEnd) != '.' && sb.charAt(bEnd) != '_' &&
- sb.charAt(bEnd) != '%' && sb.charAt(bEnd) != '?' &&
- sb.charAt(bEnd) != '&' && sb.charAt(bEnd) != '=') {
- break;
- }
- bEnd++;
- }
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFJSPLinkHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -14,12 +14,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
-
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPLinkHyperlinkPartitioner;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
public class JSFJSPLinkHyperlinkPartitioner extends JSPLinkHyperlinkPartitioner {
public static final String JSF_JSP_LINK_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSF_JSP_LINK"; //$NON-NLS-1$
@@ -64,8 +63,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
- return recognizeNature(document) ? super.recognize(document, region) : false;
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
+ return recognizeNature(document) ? super.recognize(document, offset, region) : false;
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLContextParamLinkHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -15,20 +15,18 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
+import org.jboss.tools.common.text.ext.hyperlink.xml.XMLContextParamLinkHyperlinkPartitioner;
+import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.common.text.ext.hyperlink.xml.XMLContextParamLinkHyperlinkPartitioner;
-
/**
* @author Jeremy
*/
@@ -82,7 +80,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if (!recognizeNature(document))
return false;
@@ -92,7 +90,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Text)) return false;
@@ -142,5 +140,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSFXMLLinkHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -14,12 +14,11 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
-
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
/**
* @author Jeremy
@@ -30,7 +29,6 @@
private String[] JSF_PROJECT_NATURES = {
JSFNature.NATURE_ID
};
-
/**
* @see org.jboss.tools.common.text.ext.hyperlink.XMLLinkHyperlinkPartitioner#getPartitionType()
@@ -42,7 +40,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
@@ -64,5 +62,4 @@
smw.dispose();
}
}
-
}
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPCSSClassHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jsf.text.ext.hyperlink;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
-import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
-import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
-
-/**
- *
- * @deprecated see org.jboss.tools.common.text.ext.hyperlink.CSSClassHyperlinkPartitioner
- * @author Jeremy
- */
-public class JSPCSSClassHyperlinkPartitioner extends AbstractHyperlinkPartitioner /*implements IHyperlinkPartitionRecognizer */{
- public static final String JSP_CSS_CLASS_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSP_CSS_CLASS"; //$NON-NLS-1$
-
- /**
- * @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
- */
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
- if(document == null || superRegion == null) return null;
-
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
- if (r == null) return null;
-
- String axis = getAxis(document, superRegion);
- String contentType = superRegion.getContentType();
- String type = JSP_CSS_CLASS_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
- } finally {
- smw.dispose();
- }
- }
-
- protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
- if (superRegion.getAxis() == null || superRegion.getAxis().length() == 0) {
- return JSPRootHyperlinkPartitioner.computeAxis(document, superRegion.getOffset()) + "/"; //$NON-NLS-1$
- }
- return superRegion.getAxis();
- }
-
- public static IHyperlinkRegion getRegion(IDocument document, final int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(document);
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset) return null;
-
- String attrText = document.get(start, end - start);
- StringBuffer sb = new StringBuffer(attrText);
-
- int bStart = 0;
- int bEnd = attrText.length() - 1;
-
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
-
- int propStart = bStart + start;
- int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
- return region;
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
-
- }
-
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPConverterHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,28 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -33,7 +32,7 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
if(document == null || superRegion == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
@@ -42,18 +41,15 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ Utils.findNodeForOffset(xmlDocument, offset);
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_CONVERTER_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -113,7 +109,5 @@
} finally {
smw.dispose();
}
-
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForIDHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,29 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -34,25 +32,22 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ Utils.findNodeForOffset(xmlDocument, offset);
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_FOR_ID_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -147,24 +142,17 @@
bIdEnd--;
}
-
int idStart = bIdStart;
int idLength = bIdEnd - bIdStart;
-
if (idStart > offset || idStart + idLength < offset) return null;
-
-
- IHyperlinkRegion region = new HyperlinkRegion(idStart, idLength, null, null, null);
- return region;
+ return new HyperlinkRegion(idStart, idLength, null, null, null);
} catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
return null;
} finally {
smw.dispose();
}
-
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPForwardHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,31 +1,29 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -36,25 +34,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_FORWARD_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -115,7 +109,6 @@
} finally {
smw.dispose();
}
-
}
/**
@@ -164,5 +157,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPLoadBundleHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,31 +1,30 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -40,27 +39,22 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-
- if (!recognize(document, superRegion)) return null;
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ if (!recognize(document, offset, superRegion)) return null;
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -124,23 +118,22 @@
} finally {
smw.dispose();
}
-
}
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
- IHyperlinkRegion r = getRegion(document, region.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return false;
Attr attr = (Attr)n;
@@ -154,7 +147,7 @@
String usedPrefix = name.substring(0, column);
if (usedPrefix == null || usedPrefix.trim().length() == 0) return false;
- String[] prefixes = getLoadBundleTagPrefixes(document, region.getOffset());
+ String[] prefixes = getLoadBundleTagPrefixes(document, offset);
if (prefixes == null) return true; //xhtml
boolean prefixIsAbleToBeUsed = false;
@@ -188,5 +181,4 @@
return new String[] {tmw.getCorePrefix()};
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPNavigationCaseHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,29 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -34,25 +32,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_NAVIGATION_CASE_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -73,7 +67,6 @@
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
if (n == null || !(n instanceof Attr)) return null;
int start = Utils.getValueStart(n);
@@ -102,18 +95,14 @@
int propStart = bStart + start;
int propLength = bEnd - bStart;
-
if (propStart > offset || propStart + propLength < offset) return null;
- IHyperlinkRegion region = new HyperlinkRegion(propStart, propLength, null, null, null);
- return region;
+ return new HyperlinkRegion(propStart, propLength, null, null, null);
} catch (BadLocationException x) {
JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
return null;
} finally {
smw.dispose();
}
-
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPValidatorHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -14,17 +14,16 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -35,25 +34,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IRegion r = getRegion(document, superRegion.getOffset());
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSP_VALIDATOR_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -102,8 +97,7 @@
bEnd++;
final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
+ final int propLength = bEnd - bStart;
if (propStart > offset || propStart + propLength < offset) return null;
return new Region(propStart,propLength);
@@ -113,6 +107,5 @@
} finally {
smw.dispose();
}
-
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -15,29 +15,23 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
+import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
*/
public class JsfJSPTagAttributeHyperlink extends AbstractHyperlink {
-
/**
* @see AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
@@ -63,7 +57,6 @@
}
}
-
protected Properties getRequestProperties(IRegion region) {
Properties p = new Properties();
@@ -144,15 +137,6 @@
}
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
private String getTagAttributeName(IRegion region) {
if(region == null) return null;
StructuredModelWrapper smw = new StructuredModelWrapper();
@@ -172,66 +156,17 @@
}
}
-
- protected IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
- IDOMNode node = (IDOMNode)n;
- int start =node.getStartOffset();
- int end = node.getEndOffset();
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of class property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String tagName = getTagName(fLastRegion);
- String attrName = getTagAttributeName(fLastRegion);
+ String tagName = getTagName(getHyperlinkRegion());
+ String attrName = getTagAttributeName(getHyperlinkRegion());
if (tagName == null || attrName == null)
return JSFTextExtMessages.OpenTagLibraryForAnAttribute;
return MessageFormat.format(JSFTextExtMessages.OpenTagLibraryForAttributeName, attrName, tagName);
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagAttributeHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -22,11 +22,11 @@
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -45,25 +45,22 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IRegion r = getRegion(document, superRegion.getOffset());
+ Utils.findNodeForOffset(xmlDocument, offset);
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSF_JSP_TAG_ATTRIBUTE_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -72,7 +69,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
@@ -153,5 +150,4 @@
}
return superRegion.getAxis();
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -41,11 +41,10 @@
* @author Jeremy
*/
public class JsfJSPTagNameHyperlink extends AbstractHyperlink {
- private IRegion fLastRegion = null;
-
public JsfJSPTagNameHyperlink(IRegion region){
- fLastRegion = region;
+ setRegion(region);
}
+
/**
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
@@ -118,7 +117,6 @@
error = "Component " + tagName + " not found in library " + p.getProperty("prefix");
}
return error;
-
}
protected Properties getRequestProperties(IRegion region) {
@@ -186,24 +184,16 @@
}
}
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- return fLastRegion;
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String tagName = getTagName(fLastRegion);
+ String tagName = getTagName(getHyperlinkRegion());
if (tagName == null)
return JSFTextExtMessages.OpenTagLibraryForATag;
return MessageFormat.format(JSFTextExtMessages.OpenTagLibraryForTagName, tagName);
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPTagNameHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -17,11 +17,6 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
@@ -29,7 +24,11 @@
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -44,25 +43,22 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IRegion r = getRegion(document, superRegion.getOffset());
+ Utils.findNodeForOffset(xmlDocument, offset);
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = JSF_JSP_TAG_NAME_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -71,7 +67,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
@@ -122,7 +118,6 @@
} finally {
smw.dispose();
}
-
}
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
@@ -131,5 +126,4 @@
}
return superRegion.getAxis();
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -15,8 +15,6 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
@@ -27,7 +25,6 @@
import org.jboss.tools.jst.web.tld.TaglibMapping;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class JsfJSPXmlNsHyperlink extends XModelBasedHyperlink {
@@ -83,38 +80,13 @@
return p;
}
- protected IRegion getRegion(final int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
- if (!(n instanceof IDOMAttr)) return null;
- IDOMAttr xmlnsAttr = (IDOMAttr)n;
- if (xmlnsAttr.getName() == null || !xmlnsAttr.getName().startsWith("xmlns:")) return null; //$NON-NLS-1$
- Element rootElem = xmlnsAttr.getOwnerElement();
- if (!rootElem.getNodeName().equals("jsp:root")) return null; //$NON-NLS-1$
-
- final int taglibLength = xmlnsAttr.getValueRegionText().length();
- final int taglibOffset = xmlnsAttr.getValueRegionStartOffset();
-
- return new Region(taglibOffset,taglibLength);
- } finally {
- smw.dispose();
- }
-
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String uri = getUri(fLastRegion);
+ String uri = getUri(getHyperlinkRegion());
if (uri == null)
return MessageFormat.format(Messages.NotFound, "URI"); //$NON-NLS-1$
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfJSPXmlNsHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,34 +1,35 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.project.JSFNature;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class JsfJSPXmlNsHyperlinkPartitioner extends JSPTagAttributeValueHyperlinkPartitioner {
-
public static final String JSF_JSP_XMLNS_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSF_JSP_XMLNS"; //$NON-NLS-1$
private String[] JSF_PROJECT_NATURES = {
@@ -45,7 +46,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if (!recognizeNature(document))
return false;
@@ -55,7 +56,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
Attr xmlnsAttr = (Attr)n;
if (xmlnsAttr.getName() == null || !xmlnsAttr.getName().startsWith("xmlns:")) return false; //$NON-NLS-1$
@@ -95,27 +96,49 @@
public IRegion getRegion(IDocument document, final int offset) {
StructuredModelWrapper smw = new StructuredModelWrapper();
+ smw.init(document);
try {
- smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
+
Node n = Utils.findNodeForOffset(xmlDocument, offset);
+ if (!(n instanceof IDOMAttr)) return null;
+ IDOMAttr xmlnsAttr = (IDOMAttr)n;
+ if (xmlnsAttr.getName() == null || !xmlnsAttr.getName().startsWith("xmlns:")) return null; //$NON-NLS-1$
+ Element rootElem = xmlnsAttr.getOwnerElement();
+ if (!rootElem.getNodeName().equals("jsp:root")) return null; //$NON-NLS-1$
- if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
- if (n == null) return null;
+ final int taglibLength = xmlnsAttr.getValueRegionText().length();
+ final int taglibOffset = xmlnsAttr.getValueRegionStartOffset();
- final int propStart = Utils.getValueStart(n);
- final int propLength = Utils.getValueEnd(n) - propStart;
+ String text = document.get(taglibOffset, taglibLength);
+ StringBuffer sb = new StringBuffer(text);
+
+ //find start and end of property value
+ int bStart = 0;
+ int bEnd = text.length() - 1;
+
+ while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
+ || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
+ bStart++;
+ }
+ while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
+ || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
+ bEnd--;
+ }
+ bEnd++;
+
+ final int propStart = bStart + taglibOffset;
+ final int propLength = bEnd - bStart;
if (propStart > offset || propStart + propLength < offset) return null;
-
+
return new Region(propStart,propLength);
+ } catch (BadLocationException e) {
+ return null;
} finally {
smw.dispose();
}
-
}
-
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -14,7 +14,6 @@
import java.util.Properties;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
@@ -69,44 +68,16 @@
return p;
}
- protected IRegion getRegion(final int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Node)) return null;
-
- if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
- if ((n == null) || !(n instanceof Node)) return null;
-
- final int propStart = Utils.getValueStart(n);
- if(propStart < 0) return null;
- final int propLength = Utils.getValueEnd(n) - propStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } finally {
- smw.dispose();
- }
-
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String uri = getTaglibUri(fLastRegion);
+ String uri = getTaglibUri(getHyperlinkRegion());
if (uri == null)
return MessageFormat.format(Messages.OpenA, Messages.TagLibrary);
return MessageFormat.format(Messages.OpenTagLibraryForUri, uri);
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JsfTaglibDirectiveHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -16,17 +16,15 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import org.jboss.tools.jsf.project.JSFNature;
-import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPTagAttributeValueHyperlinkPartitioner;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -39,7 +37,6 @@
private String[] JSF_PROJECT_NATURES = {
JSFNature.NATURE_ID
};
-
/**
* @see org.jboss.tools.common.text.ext.hyperlink.JSPTagAttributeValueHyperlinkPartitioner#getPartitionType()
@@ -51,7 +48,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
if (!recognizeNature(document))
return false;
@@ -61,7 +58,7 @@
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
if (n == null) return false;
@@ -123,7 +120,5 @@
} finally {
smw.dispose();
}
-
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/LoadBundleHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -19,9 +19,9 @@
import org.jboss.tools.common.text.ext.hyperlink.XModelBasedHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.jboss.tools.jst.text.ext.util.TaglibManagerWrapper;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
@@ -129,7 +129,7 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String baseName = getBundleBasename(fLastRegion);
+ String baseName = getBundleBasename(getHyperlinkRegion());
if (baseName == null)
return MessageFormat.format(Messages.OpenA, Messages.Bundle);
@@ -161,5 +161,4 @@
}
return null;
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/NavigationCaseHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -59,15 +59,6 @@
}
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = JSPNavigationCaseHyperlinkPartitioner.getRegion(getDocument(), offset);
- return fLastRegion;
- }
-
/*
* (non-Javadoc)
*
@@ -76,5 +67,4 @@
public String getHyperlinkText() {
return MessageFormat.format(Messages.BrowseFor, JSFTextExtMessages.NavigationRule);
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/PropertyHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -15,7 +15,6 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
@@ -24,7 +23,6 @@
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -62,15 +60,6 @@
}
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
private String getPropertyName(IRegion region) {
if(getDocument() == null || region == null) return null;
try {
@@ -130,53 +119,6 @@
}
}
- private IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start < 0 || start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of class property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
private String trimQuotes(String word) {
String attrText = word;
int bStart = 0;
@@ -203,12 +145,11 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String beanClassName = getBeanClassName(fLastRegion);
- String propertyName = getPropertyName(fLastRegion);
+ String beanClassName = getBeanClassName(getHyperlinkRegion());
+ String propertyName = getPropertyName(getHyperlinkRegion());
if (beanClassName == null || propertyName == null)
return MessageFormat.format(Messages.OpenA, JSFTextExtMessages.BeanProperty);
return MessageFormat.format(JSFTextExtMessages.OpenBeanProperty, beanClassName, propertyName);
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/RenderKitHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -15,19 +15,12 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -49,7 +42,7 @@
}
WebPromptingProvider provider = WebPromptingProvider.getInstance();
- String beanName = getBeanName(getRegion(region.getOffset()));
+ String beanName = getBeanName(getHyperlinkRegion());
Properties p = new Properties();
provider.getList(xModel, WebPromptingProvider.JSF_OPEN_RENDER_KIT, beanName, p);
@@ -69,62 +62,6 @@
}
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- private IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of class property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
private String trimQuotes(String word) {
String attrText = word;
int bStart = 0;
@@ -151,11 +88,10 @@
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String renderKitName = getBeanName(fLastRegion);
+ String renderKitName = getBeanName(getHyperlinkRegion());
if (renderKitName == null)
return MessageFormat.format(Messages.OpenA, JSFTextExtMessages.RenderKit);
return MessageFormat.format(JSFTextExtMessages.OpenRenderKit, renderKitName);
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/TLDTagHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/TLDTagHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/TLDTagHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2011 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2011-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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -30,11 +30,10 @@
protected XModelObject xmodelObject;
protected String xmodelObjectName = null;
protected IFile file = null;
- protected IRegion region;
public TLDTagHyperlink(AbstractComponent tag, IRegion region){
this.tag = tag;
- this.region = region;
+ setRegion(region);
file = getFile(tag);
@@ -89,10 +88,6 @@
return tag;
}
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
@Override
protected void doHyperlink(IRegion region) {
if(xmodelObjectName != null){
@@ -119,5 +114,4 @@
else
return NLS.bind(JSFTextExtMessages.Open, "");
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ValidatorHyperlink.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
@@ -16,19 +16,12 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jsf.text.ext.JSFTextExtMessages;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -52,7 +45,7 @@
WebPromptingProvider provider = WebPromptingProvider.getInstance();
- String validatorID = getValidatorId(getRegion(region.getOffset()));
+ String validatorID = getValidatorId(getHyperlinkRegion());
if (validatorID == null) {
openFileFailed();
return;
@@ -76,74 +69,16 @@
}
}
-
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- JSFExtensionsPlugin.log("", x); //$NON-NLS-1$
- return null;
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String validatorId = getValidatorId(fLastRegion);
+ String validatorId = getValidatorId(getHyperlinkRegion());
if (validatorId == null)
return MessageFormat.format(Messages.OpenA, JSFTextExtMessages.Validator);
return MessageFormat.format(JSFTextExtMessages.OpenValidatorForId, validatorId);
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLBundleBasenameHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,27 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -32,25 +31,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_BUNDLE_BASENAME_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -115,7 +110,5 @@
} finally {
smw.dispose();
}
-
}
-
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLConverterHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,27 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -32,25 +31,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_CONVERTER_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -79,7 +74,6 @@
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
if (n == null || !(n instanceof Text)) return null;
int start = Utils.getValueStart(n);
@@ -113,7 +107,5 @@
} finally {
smw.dispose();
}
-
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLPropertyHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,29 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -34,25 +32,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_PROPERTY_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -81,7 +75,6 @@
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
int start = Utils.getValueStart(n);
@@ -120,5 +113,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/XMLRenderKitHyperlinkPartitioner.java 2012-01-30 19:23:43 UTC (rev 38293)
@@ -1,28 +1,27 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -33,25 +32,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_RENDER_KIT_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -77,7 +72,6 @@
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
int start = Utils.getValueStart(n);
@@ -116,4 +110,4 @@
smw.dispose();
}
}
-}
+}
\ No newline at end of file
12 years, 11 months
JBoss Tools SVN: r38292 - trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:22:30 -0500 (Mon, 30 Jan 2012)
New Revision: 38292
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.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/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java 2012-01-30 19:22:08 UTC (rev 38291)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBPropertyLinkHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
@@ -1,22 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.esb.ui.hyperlink;
import java.util.HashSet;
import java.util.Set;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
-
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLClassHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
@@ -27,7 +24,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author V.Kabanovich
@@ -63,15 +59,12 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
- IFile documentFile = smw.getFile();
- IProject project = documentFile.getProject();
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
-
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr)) return false;
Attr a = (Attr)n;
@@ -94,5 +87,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java 2012-01-30 19:22:08 UTC (rev 38291)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/hyperlink/ESBXMLLinkHyperlinkPartitioner.java 2012-01-30 19:22:30 UTC (rev 38292)
@@ -1,22 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.esb.ui.hyperlink;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.text.IDocument;
-
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.xml.XMLLinkHyperlinkPartitioner;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
/**
* @author Jeremy
@@ -34,17 +30,7 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(document);
- try {
- IFile documentFile = smw.getFile();
- IProject project = documentFile.getProject();
-
- return true;
- } finally {
- smw.dispose();
- }
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
+ return true;
}
-
}
12 years, 11 months
JBoss Tools SVN: r38291 - in trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext: hyperlink and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:22:08 -0500 (Mon, 30 Jan 2012)
New Revision: 38291
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/CDIExtensionsPlugin.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/DisposerHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.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/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/CDIExtensionsPlugin.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/CDIExtensionsPlugin.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/CDIExtensionsPlugin.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -17,6 +17,7 @@
private static CDIExtensionsPlugin plugin;
public static final String PLUGIN_ID = "org.jboss.tools.cdi.text.ext"; //$NON-NLS-1$
+
/**
* The constructor.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AlternativeInjectedPointListHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.text.ext.hyperlink;
import java.util.List;
+
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
@@ -20,23 +21,16 @@
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
public class AlternativeInjectedPointListHyperlink extends AbstractHyperlink{
- private IRegion region;
protected List<IBean> beans;
protected ITextViewer viewer;
public AlternativeInjectedPointListHyperlink(IRegion region, List<IBean> beans, ITextViewer viewer, IDocument document){
this.beans = beans;
- this.region = region;
+ setRegion(region);
this.viewer = viewer;
setDocument(document);
}
-
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
IHyperlink[] hyperlinks = new IHyperlink[beans.size()];
@@ -65,5 +59,4 @@
public String getHyperlinkText() {
return CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ALTERNATIVES;
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011-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,
@@ -22,19 +22,13 @@
public class AssignableBeansHyperlink extends AbstractHyperlink implements ITestableCDIHyperlink{
protected IInjectionPoint injectionPoint;
- IRegion region;
public AssignableBeansHyperlink(IRegion region, IInjectionPoint injectionPoint, IDocument document){
this.injectionPoint = injectionPoint;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
Display display = Display.getCurrent();
if(display == null) {
@@ -57,5 +51,4 @@
public Set<? extends ICDIElement> getCDIElements() {
return null;
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/DisposerHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/DisposerHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/DisposerHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -24,20 +24,13 @@
public class DisposerHyperlink extends AbstractHyperlink{
IMethod method;
- IRegion region;
public DisposerHyperlink(IRegion region, IMethod method, IDocument document){
this.method = method;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
-
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
IEditorPart part = null;
@@ -65,5 +58,4 @@
text += method.getElementName();
return text;
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -29,20 +29,13 @@
public class EventHyperlink extends AbstractHyperlink implements ITestableCDIHyperlink, IInformationItem{
IInjectionPoint event;
- IRegion region;
public EventHyperlink(IRegion region, IInjectionPoint event, IDocument document){
this.event = event;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
-
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
IEditorPart part = null;
@@ -74,7 +67,6 @@
return CDIExtensionsMessages.CDI_EVENT_HYPERLINK_OPEN_EVENT+" "+event.getElementName();
}
-
public ICDIElement getCDIElement() {
return event;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/EventListHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -24,20 +24,14 @@
public class EventListHyperlink extends AbstractHyperlink implements ITestableCDIHyperlink{
private ITextViewer viewer;
private Set<IInjectionPoint> events;
- private IRegion region;
public EventListHyperlink(ITextViewer viewer, IRegion region, Set<IInjectionPoint> events, IDocument document){
this.viewer = viewer;
this.events = events;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
IHyperlink[] hyperlinks = new IHyperlink[events.size()];
@@ -70,5 +64,4 @@
public Set<? extends ICDIElement> getCDIElements() {
return events;
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -30,12 +30,11 @@
public class InjectedPointHyperlink extends AbstractHyperlink implements ITestableCDIHyperlink, IInformationItem{
protected IBean bean;
- IRegion region;
boolean first = false;
public InjectedPointHyperlink(IRegion region, IBean bean, IDocument document){
this.bean = bean;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
@@ -44,12 +43,6 @@
this.first = first;
}
-
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
public void doHyperlink(IRegion region) {
IEditorPart part = null;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -27,18 +27,13 @@
public class ObserverMethodHyperlink extends AbstractHyperlink implements IInformationItem, ITestableCDIHyperlink{
IObserverMethod observerMethod;
- IRegion region;
public ObserverMethodHyperlink(IRegion region, IObserverMethod observerMethod, IDocument document){
this.observerMethod = observerMethod;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
IEditorPart part = null;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/ObserverMethodListHyperlink.java 2012-01-30 19:22:08 UTC (rev 38291)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-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,
@@ -24,20 +24,14 @@
public class ObserverMethodListHyperlink extends AbstractHyperlink implements ITestableCDIHyperlink{
private ITextViewer viewer;
private Set<IObserverMethod> observerMethods;
- private IRegion region;
public ObserverMethodListHyperlink(ITextViewer viewer, IRegion region, Set<IObserverMethod> observerMethods, IDocument document){
this.viewer = viewer;
this.observerMethods = observerMethods;
- this.region = region;
+ setRegion(region);
setDocument(document);
}
- @Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
protected void doHyperlink(IRegion region) {
IHyperlink[] hyperlinks = new IHyperlink[observerMethods.size()];
@@ -70,5 +64,4 @@
public Set<? extends ICDIElement> getCDIElements() {
return observerMethods;
}
-
}
12 years, 11 months
JBoss Tools SVN: r38290 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:21:22 -0500 (Mon, 30 Jan 2012)
New Revision: 38290
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlink.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlinkPartitioner.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/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2011-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,
@@ -28,14 +28,13 @@
public class CDISeamResourceLoadingHyperlink extends AbstractHyperlink{
private final static String PROPERTIES = ".properties";
- private IRegion region;
private String path;
private IFile file;
public CDISeamResourceLoadingHyperlink(IFile file, IDocument document, IRegion region, String path){
super();
this.file = file;
- this.region = region;
+ setRegion(region);
this.path = path;
setDocument(document);
}
@@ -45,11 +44,6 @@
}
@Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- return region;
- }
-
- @Override
public IFile getReadyToOpenFile(){
String fileName = path;
@@ -165,5 +159,4 @@
public String getHyperlinkText() {
return NLS.bind(CDISeamExtMessages.CDI_SEAM_RESOURCE_LOADING_HYPERLINK, path);
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlink.java 2012-01-30 19:21:22 UTC (rev 38290)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.cdi.seam.text.ext.hyperlink;
@@ -25,29 +25,25 @@
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.PartInitException;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.seam.config.core.CDISeamConfigExtension;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamBeansDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamFieldDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamMemberDefinition;
+import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
+import org.jboss.tools.cdi.seam.config.core.util.Util;
import org.jboss.tools.cdi.seam.text.ext.CDISeamExtMessages;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.jboss.tools.cdi.seam.config.core.CDISeamConfigExtension;
-import org.jboss.tools.cdi.seam.config.core.definition.SeamBeansDefinition;
-import org.jboss.tools.cdi.seam.config.core.definition.SeamFieldDefinition;
-import org.jboss.tools.cdi.seam.config.core.definition.SeamMemberDefinition;
-import org.jboss.tools.cdi.seam.config.core.definition.SeamMethodDefinition;
-import org.jboss.tools.cdi.seam.config.core.util.Util;
-
/**
* @author Jeremy
*/
@@ -189,62 +185,16 @@
}
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- protected IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- smw.init(getDocument());
- try {
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null) return null;
-
- int start, nameStart, nameEnd;
-
- if(n instanceof IDOMElement) {
- IDOMElement elem = (IDOMElement)n;
- String tagName = elem.getTagName();
- start = elem.getStartOffset();
- nameStart = start + (elem.isEndTag() ? "</" : "<").length(); //$NON-NLS-1$ //$NON-NLS-2$
- nameEnd = nameStart + tagName.length();
- } else if (n instanceof IDOMAttr) {
- String attrName = n.getNodeName();
- start = ((IDOMAttr)n).getStartOffset();
- nameStart = start;
- nameEnd = start + attrName.length();
- } else {
- return null;
- }
-
- if (nameStart > offset || nameEnd <= offset) return null;
-
- return new Region(nameStart,nameEnd - nameStart);
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String tagName = getTagName(fLastRegion);
+ String tagName = getTagName(getHyperlinkRegion());
if (tagName == null)
return CDISeamExtMessages.CDI_SEAM_CONFIG_OPEN_TAG;
return MessageFormat.format(CDISeamExtMessages.CDI_SEAM_CONFIG_OPEN_TAG, tagName);
}
-
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlinkPartitioner.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigTagNameHyperlinkPartitioner.java 2012-01-30 19:21:22 UTC (rev 38290)
@@ -40,25 +40,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IRegion r = getRegion(document, superRegion.getOffset());
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = SEAM_CONFIG_TAG_NAME_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -67,19 +63,13 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
smw.init(document);
try {
IFile documentFile = smw.getFile();
- if(documentFile==null) {
- return false;
- }
- IProject project = documentFile.getProject();
- if(project == null) {
- return false;
- }
- return true;
+ if(documentFile==null) return false;
+ return (documentFile.getProject() != null);
} finally {
smw.dispose();
}
@@ -129,7 +119,6 @@
} finally {
smw.dispose();
}
-
}
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
@@ -138,5 +127,4 @@
}
return superRegion.getAxis();
}
-
}
12 years, 11 months
JBoss Tools SVN: r38289 - in trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink: xml and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2012-01-30 14:20:43 -0500 (Mon, 30 Jan 2012)
New Revision: 38289
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
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/ClassHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IExclusiblePartitionerRecognition.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitionRecognizer.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitioner.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlink.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/PortletHyperlink.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/XMLDoctypeHyperlink.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/XMLRootHyperlinkPartitioner.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/XMLXmlNsHyperlink.java
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/xpl/AbstractBaseHyperlink.java
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.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/AbstractHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -35,7 +35,6 @@
import org.jboss.tools.common.el.core.GlobalELReferenceList;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.resref.core.ResourceReference;
@@ -49,11 +48,9 @@
@SuppressWarnings("restriction")
abstract public class AbstractHyperlink extends AbstractBaseHyperlink implements IHyperlink {
public static final String DOLLAR_PREFIX = "${"; //$NON-NLS-1$
-
private static final String SUFFIX = "}"; //$NON-NLS-1$
-
public static final String SHARP_PREFIX = "#{"; //$NON-NLS-1$
-
+
public static XModel getXModel(IFile file) {
if (file == null)
return null;
@@ -155,8 +152,10 @@
return EclipseResourceUtil.getFile(path);
}
- abstract protected IRegion doGetHyperlinkRegion(int offset);
-
+ protected IRegion doGetHyperlinkRegion(int offset) {
+ return hyperlinkRegion;
+ }
+
abstract protected void doHyperlink(IRegion region);
protected IFile getFileFromProject(String fileName) {
@@ -335,5 +334,4 @@
public IFile getReadyToOpenFile(){
return null;
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -28,8 +28,8 @@
*/
public abstract class AbstractHyperlinkPartitioner implements IHyperlinkPartitioner {
- public String getChildPartitionType(IDocument document, IHyperlinkRegion superRegion) {
- IHyperlinkRegion childRegion = parse(document, superRegion);
+ public IHyperlinkRegion getChildPartitionRegion(IDocument document, int offset, IHyperlinkRegion superRegion) {
+ IHyperlinkRegion childRegion = parse(document, offset, superRegion);
if (childRegion == null) return null;
HyperlinkPartitionerDefinition[] hyperlinkPartitionerDefinitions = HyperlinkPartitionerBuilder.getInstance().getHyperlinkPartitionerDefinitions(childRegion.getContentType(), childRegion.getType(), childRegion.getAxis());
@@ -45,18 +45,18 @@
for(int i=0; sortedPartitioners != null && i<sortedPartitioners.length; i++) {
IHyperlinkPartitioner partitioner = sortedPartitioners[i];
if((!(partitioner instanceof IHyperlinkPartitionRecognizer)) ||
- ((IHyperlinkPartitionRecognizer)partitioner).recognize(document, childRegion)) {
+ ((IHyperlinkPartitionRecognizer)partitioner).recognize(document, offset, childRegion)) {
if (partitioner instanceof IExclusiblePartitionerRecognition) {
IExclusiblePartitionerRecognition epr = (IExclusiblePartitionerRecognition)partitioner;
- IHyperlinkPartitioner replacement = findExclusionPartitioner(epr.getExclusionPartitionType(), hyperlinkPartitionerDefinitions, document, childRegion);
+ IHyperlinkPartitioner replacement = findExclusionPartitioner(epr.getExclusionPartitionType(), hyperlinkPartitionerDefinitions, document, offset, childRegion);
if (replacement != null)
- return replacement.getChildPartitionType(document, childRegion);
+ return replacement.getChildPartitionRegion(document, offset, childRegion);
}
- return partitioner.getChildPartitionType(document, childRegion);
+ return partitioner.getChildPartitionRegion(document, offset, childRegion);
}
}
- return childRegion.getType();
+ return childRegion;
}
protected Sorter createSorter() {
@@ -94,12 +94,12 @@
}
- IHyperlinkPartitioner findExclusionPartitioner (String partitionType, HyperlinkPartitionerDefinition[] hyperlinkPartitionerDefinitions, IDocument document, IHyperlinkRegion region) {
+ IHyperlinkPartitioner findExclusionPartitioner (String partitionType, HyperlinkPartitionerDefinition[] hyperlinkPartitionerDefinitions, IDocument document, int offset, IHyperlinkRegion region) {
for(int i=0; i<hyperlinkPartitionerDefinitions.length; i++) {
HyperlinkPartitionerDefinition def = hyperlinkPartitionerDefinitions[i];
IHyperlinkPartitioner partitioner = def.createHyperlinkPartitioner();
if((partitioner instanceof IExclusiblePartitionerRecognition) &&
- ((IExclusiblePartitionerRecognition)partitioner).excludes(partitionType, document, region)) {
+ ((IExclusiblePartitionerRecognition)partitioner).excludes(partitionType, document, offset, region)) {
return partitioner;
}
}
@@ -110,7 +110,7 @@
return StructuredModelManager.getModelManager();
}
- protected abstract IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion);
+ protected abstract IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion);
protected String getAxis(IDocument document, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
@@ -128,5 +128,4 @@
smw.dispose();
}
}
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -42,20 +42,12 @@
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -198,96 +190,16 @@
return null;
}
- IRegion fLastRegion = null;
/*
* (non-Javadoc)
*
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- public IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Text || n instanceof Attr)) return null;
-
- String text = null;
- int bStart = 0;
- int bEnd = 0;
-
- if (n instanceof Text) {
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
- if (start < 0 || start > offset) return null;
-
- text = getDocument().get(start, end - start);
- bStart = offset - start;
- bEnd = offset - start;
- } else if (n instanceof Attr) {
- IDOMAttr attr = (IDOMAttr)n;
- int start = Utils.getValueStart(n);
- if(start < 0) return null;
-
- text = getDocument().get(start,
- attr.getValueRegionText().length());
- bStart = offset - start;
- bEnd = offset - start;
- }
- StringBuffer sb = new StringBuffer(text);
-
- while (bStart >= 0) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
- sb.charAt(bStart) != '.' && sb.charAt(bStart) != '_') {
- bStart++;
- break;
- }
-
- if (bStart == 0) break;
- bStart--;
- }
-
- while (bEnd < sb.length()) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)) &&
- sb.charAt(bEnd) != '.' && sb.charAt(bEnd) != '_') {
- break;
- }
- bEnd++;
- }
-
- final int propStart = bStart + Utils.getValueStart(n);
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
- /*
- * (non-Javadoc)
- *
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String className = getClassName(fLastRegion);
+ String className = getClassName(getHyperlinkRegion());
if (className == null)
return MessageFormat.format(Messages.OpenA, Messages.Class);
return MessageFormat.format(Messages.OpenClass, className);
}
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassMethodHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -42,7 +42,6 @@
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -82,62 +81,7 @@
openFileFailed();
}
}
-
- protected IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
- private IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start < 0 || start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- int propStart = bStart + start;
- int propLength = bEnd - bStart;
- if (propStart > offset || propStart + propLength < offset) return null;
- IRegion region = new HyperlinkRegion(propStart, propLength);
- return region;
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
protected IJavaElement searchForClassMethod(IJavaProject javaProject,
String className, String methodName) {
// Get the search pattern
@@ -234,5 +178,4 @@
smw.dispose();
}
}
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/HyperlinkDetector.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -20,7 +20,6 @@
import org.jboss.tools.common.text.ext.util.AxisUtil;
public class HyperlinkDetector extends BaseHyperlinkDetector {
-
private static HyperlinkDetector fInstance;
/**
@@ -40,10 +39,10 @@
* @param offset
* @return String partition types
*/
- protected String[] getPartitionTypes(IDocument document, int offset) {
+ protected IHyperlinkRegion[] getPartitions(IDocument document, int offset) {
String documentRegionType = null;
ITypedRegion region = null;
- ArrayList<String> types = new ArrayList<String>();
+ ArrayList<IHyperlinkRegion> regions = new ArrayList<IHyperlinkRegion>();
region = (document instanceof IDocumentExtension3 ?
((IDocumentExtension3)document).getDocumentPartitioner("org.eclipse.wst.sse.core.default_structured_text_partitioning").getPartition(offset) : //$NON-NLS-1$
@@ -51,13 +50,13 @@
if (region != null) {
documentRegionType = region.getType();
-
String contentType = getContentType(document);
+ IHyperlinkRegion documentRegion = new HyperlinkRegion(region.getOffset(), region.getLength(), null, contentType, region.getType());
HyperlinkPartitionerDefinition[] defs = HyperlinkPartitionerBuilder.getInstance().getHyperlinkPartitionerDefinitions(contentType, documentRegionType, null);
if(defs==null || defs.length==0) {
- types.add(documentRegionType);
+ regions.add(documentRegion);
} else {
for(int i=0; i<defs.length; i++) {
final ITypedRegion finalDocumentRegion = region;
@@ -71,16 +70,16 @@
finalContentType,
finalDocumentRegion.getType());
if((!(hyperlinkPartitioner instanceof IHyperlinkPartitionRecognizer)) ||
- ((IHyperlinkPartitionRecognizer)hyperlinkPartitioner).recognize(document, startHyperlinkRegion)) {
- String type = hyperlinkPartitioner.getChildPartitionType(document, startHyperlinkRegion);
- if(type!=null && !types.contains(type)) {
- types.add(type);
+ ((IHyperlinkPartitionRecognizer)hyperlinkPartitioner).recognize(document, offset, startHyperlinkRegion)) {
+ IHyperlinkRegion childRegion = hyperlinkPartitioner.getChildPartitionRegion(document, offset, startHyperlinkRegion);
+ if(childRegion!=null && !regions.contains(childRegion)) {
+ regions.add(childRegion);
}
}
}
}
}
- return types.toArray(new String[types.size()]);
+ return regions.toArray(new IHyperlinkRegion[regions.size()]);
}
static class HyperlinkDetectorHolder {
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IExclusiblePartitionerRecognition.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IExclusiblePartitionerRecognition.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IExclusiblePartitionerRecognition.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -14,5 +14,5 @@
public interface IExclusiblePartitionerRecognition {
String getExclusionPartitionType();
- boolean excludes(String partitionType, IDocument document, IHyperlinkRegion superRegion);
+ boolean excludes(String partitionType, IDocument document, int offset, IHyperlinkRegion superRegion);
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitionRecognizer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitionRecognizer.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitionRecognizer.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -16,6 +16,5 @@
* @author Igels
*/
public interface IHyperlinkPartitionRecognizer {
-
- public boolean recognize(IDocument document, IHyperlinkRegion region);
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region);
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitioner.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/IHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -16,6 +16,5 @@
* @author Igels
*/
public interface IHyperlinkPartitioner {
-
- public String getChildPartitionType(IDocument document, IHyperlinkRegion superRegion);
+ public IHyperlinkRegion getChildPartitionRegion(IDocument document, int offset, IHyperlinkRegion superRegion);
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/JumpToHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -26,7 +26,6 @@
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -144,66 +143,10 @@
return elements;
}
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- return getRegion(offset);
- }
-
- protected IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Text)) return null;
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start < 0 || start > offset) return null;
-
- String attrText = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(attrText);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = attrText.length() - 1;
-
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException e) {
- openFileFailed();
- } finally {
- smw.dispose();
- }
- return null;
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
abstract public String getHyperlinkText();
-
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/LinkHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -27,12 +27,6 @@
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -43,7 +37,7 @@
* @see com.ibm.sse.editor.AbstractHyperlink#doHyperlink(org.eclipse.jface.text.IRegion)
*/
protected void doHyperlink(IRegion region) {
-
+
String fileName = getFilePath(region);
IFile fileToOpen = getFileFromProject(fileName);
if (fileToOpen != null && fileToOpen.exists()) {
@@ -82,84 +76,13 @@
return filename;
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- protected IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- int bStart = offset - start;
- //find start and end of path property
- while (bStart >= 0) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
- sb.charAt(bStart) != '\\' && sb.charAt(bStart) != '/' &&
- sb.charAt(bStart) != ':' && sb.charAt(bStart) != '-' &&
- sb.charAt(bStart) != '.' && sb.charAt(bStart) != '_' &&
- sb.charAt(bStart) != '%' && sb.charAt(bStart) != '?' &&
- sb.charAt(bStart) != '&' && sb.charAt(bStart) != '=') {
- bStart++;
- break;
- }
-
- if (bStart == 0) break;
- bStart--;
- }
- // find end of bean property
- int bEnd = offset - start;
- while (bEnd < sb.length()) {
- if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)) &&
- sb.charAt(bEnd) != '\\' && sb.charAt(bEnd) != '/' &&
- sb.charAt(bEnd) != ':' && sb.charAt(bEnd) != '-' &&
- sb.charAt(bEnd) != '.' && sb.charAt(bEnd) != '_' &&
- sb.charAt(bEnd) != '%' && sb.charAt(bEnd) != '?' &&
- sb.charAt(bEnd) != '&' && sb.charAt(bEnd) != '=') {
- break;
- }
- bEnd++;
- }
-
- int propStart = bStart + start;
- int propLength = bEnd - bStart;
- if (propStart > offset + 1 || propStart + propLength < offset) return null;
- IRegion region = new HyperlinkRegion(propStart, propLength);
- return region;
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String filePath = getFilePath(fLastRegion);
+ String filePath = getFilePath(getHyperlinkRegion());
if (filePath == null)
return MessageFormat.format(Messages.OpenA, Messages.File);
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/RelativeLinkHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -17,17 +17,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -75,75 +68,16 @@
return super.getFileFromProject(updateFilenameForModel(fileName, project));
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- protected IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start < 0 || start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
- bStart++;
- }
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String filePath = getFilePath(fLastRegion);
+ String filePath = getFilePath(getHyperlinkRegion());
if (filePath == null)
return MessageFormat.format(Messages.OpenA, Messages.File);
return MessageFormat.format(Messages.OpenFile, filePath);
}
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/XModelBasedHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink;
@@ -14,18 +14,10 @@
import java.util.Properties;
import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.project.IPromptingProvider;
import org.jboss.tools.common.model.project.PromptingProviderFactory;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
-import org.jboss.tools.common.text.ext.util.Utils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -63,59 +55,4 @@
protected abstract String getRequestMethod();
protected abstract Properties getRequestProperties(IRegion region);
-
- protected IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- protected IRegion getRegion (int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
- if (n == null || !(n instanceof Attr || n instanceof Text)) return null;
-
- int start = Utils.getValueStart(n);
- int end = Utils.getValueEnd(n);
-
- if (start > offset || end < offset) return null;
-
- String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
-
- //find start and end of class property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
- || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
- bStart++;
- }
- while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
- || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
- bEnd--;
- }
- bEnd++;
-
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
-
- if (propStart > offset || propStart + propLength < offset) return null;
- return new Region(propStart,propLength);
- } catch (BadLocationException x) {
- //ignore
- return null;
- } finally {
- smw.dispose();
- }
- }
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -14,29 +14,14 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.w3c.dom.Node;
public class IncludeHyperlink extends AbstractHyperlink {
private String hyperlinkText = ""; //$NON-NLS-1$
@Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- Node n = IncludeHyperlinkPartitioner.getNode(getDocument(), offset);
-
- int start = Utils.getValueStart(n);
- if(start < 0) return null;
- int end = Utils.getValueEnd(n);
-
- Region region = new Region(start, end-start);
-
- return region;
- }
-
- @Override
protected void doHyperlink(IRegion region) {
if (region == null)
return;
@@ -63,5 +48,4 @@
public String getHyperlinkText() {
return hyperlinkText;
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/IncludeHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -40,10 +40,10 @@
}
@Override
- protected IHyperlinkRegion parse(IDocument document,
+ protected IHyperlinkRegion parse(IDocument document, int offset,
IHyperlinkRegion superRegion) {
- Node node = getNode(document, superRegion.getOffset());
+ Node node = getNode(document, offset);
if(!URL_NAME.equals(node.getNodeName()))
return null;
@@ -59,5 +59,4 @@
axis, contentType, INCLUDE_FILE_PARTITION);
return hyperRegion;
}
-
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2009-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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -20,39 +20,18 @@
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.w3c.dom.Node;
public class PortletHyperlink extends AbstractHyperlink {
private static final String PROP_EXTENSION = ".properties"; //$NON-NLS-1$
private String hyperlinkText = ""; //$NON-NLS-1$
-
private String partitionType = null;
@Override
- protected IRegion doGetHyperlinkRegion(int offset) {
- Node node = PortletHyperlinkPartitioner.getNode(getDocument(),
- offset);
- partitionType = PortletHyperlinkPartitioner.getType(node);
- if (partitionType == null)
- return null;
-
- IndexedRegion text = (IndexedRegion) node;
-
- int regLength = text.getLength();
- int regOffset = text.getStartOffset();
-
- Region region = new Region(regOffset, regLength);
- return region;
- }
-
- @Override
protected void doHyperlink(IRegion region) {
if (region == null)
return;
@@ -115,7 +94,6 @@
openFileFailed();
}
-
private IProject getProject() {
IFile documentFile = getFile();
if (documentFile == null || !documentFile.isAccessible())
@@ -130,6 +108,4 @@
public String getHyperlinkText() {
return hyperlinkText;
}
-
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/PortletHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2009 Exadel, Inc. and Red Hat, Inc.
+ * Copyright (c) 2009-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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -26,7 +26,6 @@
public static final String PORTLET_RESOURCE_BUNDLE_PARTITION = "org.jboss.tools.common.text.ext.hyperlink.xml.PORTLET_RESOURCE"; //$NON-NLS-1$
static final String textNodeName = "#text"; //$NON-NLS-1$
-
static final String portletNodeName = "portlet"; //$NON-NLS-1$
static final String portletClassNodeName = "portlet-class"; //$NON-NLS-1$
static final String portletResourceBundleNodeName = "resource-bundle"; //$NON-NLS-1$
@@ -69,7 +68,7 @@
}
@Override
- protected IHyperlinkRegion parse(IDocument document,
+ protected IHyperlinkRegion parse(IDocument document, int offset,
IHyperlinkRegion superRegion) {
Node node = getNode(document, superRegion.getOffset());
String type = getType(node);
@@ -79,14 +78,13 @@
IndexedRegion text = (IndexedRegion) node;
int length = text.getLength();
- int offset = text.getStartOffset();
+ int startOffset = text.getStartOffset();
String contentType = superRegion.getContentType();
String axis = getAxis(document, superRegion);
- IHyperlinkRegion hyperRegion = new HyperlinkRegion(offset, length,
+ IHyperlinkRegion hyperRegion = new HyperlinkRegion(startOffset, length,
axis, contentType, type);
return hyperRegion;
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLClassHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,27 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -32,26 +31,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-// if (!recognize(document, superRegion)) return null;
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
+ IHyperlinkRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_CLASS_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -138,5 +132,4 @@
smw.dispose();
}
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLContextParamLinkHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -14,16 +14,15 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -33,26 +32,22 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- if (!recognize(document, superRegion)) return null;
- IRegion r = getRegion(document, superRegion.getOffset());
+ if (!recognize(document, offset, superRegion)) return null;
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -108,5 +103,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,19 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
-import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.w3c.dom.Attr;
@@ -22,71 +19,7 @@
import org.w3c.dom.Node;
public class XMLDoctypeHyperlink extends XMLXmlNsHyperlink {
-
- protected IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
- if (n instanceof Attr) n = ((Attr)n).getOwnerElement();
- if ((n == null) || !(n instanceof DocumentType)) return null;
-
- int start = Utils.getValueStart(n);
- if(start < 0) return null;
- int end = Utils.getValueEnd(n);
-
- DocumentType node = (DocumentType)n;
-
- String text = ""; //$NON-NLS-1$
- try {
- text = getDocument().get(start, end - start);
- } catch (BadLocationException x) {
- ExtensionsPlugin.getPluginLog().logError(x);
- };
- String publicId = (node.getPublicId() == null ? "" : node.getPublicId()); //$NON-NLS-1$
- String systemId = (node.getSystemId() == null ? "" : node.getSystemId()); //$NON-NLS-1$
-
- int valueStart = -1;
- int valueLength = 0;
-
- int index = -1;
-
- if (publicId.length() > 0) {
- index = text.indexOf(publicId);
- if (offset >= start + index && offset < start + index + publicId.length()) {
- valueStart = start + index;
- valueLength = publicId.length();
- }
- }
- if (valueStart == -1) {
- if (systemId.length() > 0) {
- index = text.indexOf(systemId);
- if (systemId.length() > 0 && offset >= start + index && offset < start + index + systemId.length()) {
- valueStart = start + index;
- valueLength = systemId.length();
- }
- }
- }
- if (valueStart == -1) {
- valueStart = start;
- valueLength = end - start;
- }
- final int propStart = valueStart;
- final int propLength = valueLength;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
- } finally {
- smw.dispose();
- }
-
- }
-
protected String getPublicId(IRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
@@ -124,6 +57,4 @@
smw.dispose();
}
}
-
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLDoctypeHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,26 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -32,28 +32,49 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof DocumentType)) return null;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
if(end < 0) return null;
+ String text = document.get(start, end - start);
+ StringBuffer sb = new StringBuffer(text);
+
+ //find start and end of property value
+ int bStart = 0;
+ int bEnd = text.length() - 1;
+
+ while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
+ || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
+ bStart++;
+ }
+ while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
+ || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
+ bEnd--;
+ }
+ bEnd++;
+
+ final int propStart = bStart + start;
+ final int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset) return null;
+
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_DOCTYPE_PARTITION;
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(propStart, propLength, axis, contentType, type);
+ } catch (BadLocationException e) {
+ return null;
} finally {
smw.dispose();
}
@@ -79,14 +100,14 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof DocumentType)) return false;
return true;
@@ -94,5 +115,4 @@
smw.dispose();
}
}
-
}
\ No newline at end of file
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeNameHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -23,7 +23,6 @@
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-
/**
* @author Jeremy
*/
@@ -37,14 +36,14 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr)) return null;
int start = (n instanceof IDOMAttr) ? ((IDOMAttr)n).getNameRegionStartOffset() : -1;
int end = (n instanceof IDOMAttr) ? ((IDOMAttr)n).getNameRegionEndOffset() : -1;
@@ -52,11 +51,8 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
@@ -65,18 +61,18 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
int start = (n instanceof IDOMAttr) ? ((IDOMAttr)n).getNameRegionStartOffset() : -1;
int end = (n instanceof IDOMAttr) ? ((IDOMAttr)n).getNameRegionEndOffset() : -1;
- if (start < 0 || start > region.getOffset() || end < region.getOffset())
+ if (start < 0 || start > offset || end < offset)
return false;
return true;
@@ -85,13 +81,11 @@
}
}
- public boolean excludes(String partitionType, IDocument document, IHyperlinkRegion superRegion) {
+ public boolean excludes(String partitionType, IDocument document, int offset, IHyperlinkRegion superRegion) {
return false;
}
public String getExclusionPartitionType() {
return getPartitionType();
}
-
-
}
\ No newline at end of file
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementAttributeValueHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,16 +1,18 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
+import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IExclusiblePartitionerRecognition;
@@ -22,7 +24,6 @@
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-
/**
* @author Jeremy
*/
@@ -36,26 +37,49 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr)) return null;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
+ String text = document.get(start, end - start);
+ StringBuffer sb = new StringBuffer(text);
+
+ //find start and end of property value
+ int bStart = 0;
+ int bEnd = text.length() - 1;
+
+ while (bStart < bEnd && (Character.isWhitespace(sb.charAt(bStart))
+ || sb.charAt(bStart) == '\"' || sb.charAt(bStart) == '\"')) {
+ bStart++;
+ }
+ while (bEnd > bStart && (Character.isWhitespace(sb.charAt(bEnd))
+ || sb.charAt(bEnd) == '\"' || sb.charAt(bEnd) == '\"')) {
+ bEnd--;
+ }
+ bEnd++;
+
+ final int propStart = bStart + start;
+ final int propLength = bEnd - bStart;
+
+ if (propStart > offset || propStart + propLength < offset) return null;
+
+
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(propStart, propLength, axis, contentType, type);
+ } catch (BadLocationException e) {
+ ExtensionsPlugin.getPluginLog().logError(e);
+ return null;
} finally {
smw.dispose();
}
@@ -64,18 +88,18 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr)) return false;
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
- if (start < 0 || start > region.getOffset() || end < region.getOffset())
+ if (start < 0 || start > offset || end < offset)
return false;
return true;
@@ -84,13 +108,11 @@
}
}
- public boolean excludes(String partitionType, IDocument document, IHyperlinkRegion superRegion) {
+ public boolean excludes(String partitionType, IDocument document, int offset, IHyperlinkRegion superRegion) {
return false;
}
public String getExclusionPartitionType() {
return getPartitionType();
}
-
-
}
\ No newline at end of file
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,27 +1,26 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -33,14 +32,14 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Attr || n instanceof Element) ) return null;
Node node = (Node)(n instanceof Attr ? ((Attr)n).getOwnerElement() : n.getParentNode());
@@ -51,11 +50,8 @@
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_ELEMENT_PARTITION;
- int length = end - start - (superRegion.getOffset() - start);
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
@@ -64,14 +60,14 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Attr || n instanceof Element)) return false;
return true;
@@ -79,5 +75,4 @@
smw.dispose();
}
}
-
}
\ No newline at end of file
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLElementNameHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -30,26 +30,23 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof IDOMElement)) return null;
- IHyperlinkRegion r = getRegion(document, superRegion.getOffset());
- if (r == null) return null;
+ IHyperlinkRegion r = getRegion(document, offset);
+ if (r == null) return null;// document.get(r.getOffset(), r.getLength())
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_ELEMENT_NAME_PARTITION;
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
-
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -73,25 +70,23 @@
if (nameStart > offset || nameEnd <= offset) return null;
- IHyperlinkRegion region = new HyperlinkRegion(nameStart, nameEnd - nameStart, null, null, null);
- return region;
+ return new HyperlinkRegion(nameStart, nameEnd - nameStart, null, null, null);
} finally {
smw.dispose();
}
-
}
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof IDOMElement)) return false;
IDOMElement elem = (IDOMElement)n;
@@ -99,10 +94,9 @@
int start = elem.getStartOffset();
int nameStart = start + (elem.isEndTag() ? "</" : "<").length(); //$NON-NLS-1$ //$NON-NLS-2$
int nameEnd = nameStart + tagName.length();
- return (region.getOffset() >= nameStart && region.getOffset() <= nameEnd);
+ return (offset >= nameStart && offset <= nameEnd);
} finally {
smw.dispose();
}
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLJumpToHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -18,17 +18,16 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -43,26 +42,22 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- if (!recognize(document, superRegion)) return null;
- IRegion r = getRegion(document, superRegion.getOffset());
+ if (!recognize(document, offset, superRegion)) return null;
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -76,7 +71,6 @@
if (xmlDocument == null) return null;
Node n = Utils.findNodeForOffset(xmlDocument, offset);
-
if (n == null || !(n instanceof Text)) return null;
int start = Utils.getValueStart(n);
@@ -115,7 +109,6 @@
} finally {
smw.dispose();
}
-
}
protected String[] getValidAxisEndings() {
@@ -123,36 +116,36 @@
}
private boolean validAxis(Node n, String validAxisEnding) {
- if (validAxisEnding == null || validAxisEnding.lastIndexOf('/') == -1) return false;
- StringTokenizer st = new StringTokenizer(validAxisEnding, "/"); //$NON-NLS-1$
- List<String> tokens = new ArrayList<String>();
- while (st.hasMoreTokens()) {
- tokens.add(st.nextToken());
- }
- if (tokens.size() == 0) return false;
- Node currentElement = n;
- for (int i = tokens.size() - 1; i >= 0; i--) {
- if (currentElement == null || !(currentElement instanceof Element))
- return false;
- String token = (String)tokens.get(i);
- if (!token.equals(currentElement.getNodeName()))
- return false;
- currentElement = currentElement.getParentNode();
- }
- return true;
+ if (validAxisEnding == null || validAxisEnding.lastIndexOf('/') == -1) return false;
+ StringTokenizer st = new StringTokenizer(validAxisEnding, "/"); //$NON-NLS-1$
+ List<String> tokens = new ArrayList<String>();
+ while (st.hasMoreTokens()) {
+ tokens.add(st.nextToken());
+ }
+ if (tokens.size() == 0) return false;
+ Node currentElement = n;
+ for (int i = tokens.size() - 1; i >= 0; i--) {
+ if (currentElement == null || !(currentElement instanceof Element))
+ return false;
+ String token = (String)tokens.get(i);
+ if (!token.equals(currentElement.getNodeName()))
+ return false;
+ currentElement = currentElement.getParentNode();
+ }
+ return true;
}
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof Text)) return false;
@@ -167,5 +160,4 @@
smw.dispose();
}
}
-
}
\ No newline at end of file
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLLinkHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,30 +1,28 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -33,26 +31,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
-// if (!recognize(document, superRegion)) return null;
- IRegion r = getRegion(document, superRegion.getOffset());
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -74,37 +67,60 @@
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
- if (start > offset || end < offset) return null;
-
String text = document.get(start, end - start);
StringBuffer sb = new StringBuffer(text);
- //find start and end of path property
- int bStart = 0;
- int bEnd = text.length() - 1;
-
- while (bStart < bEnd &&
- (sb.charAt(bStart) == '\'' || sb.charAt(bStart) == '\"' ||
- Character.isWhitespace(sb.charAt(bStart)))) {
+ int bStart = 0;
+ int bEnd = sb.length();
+
+ // In case of attribute value we need to skip leading and ending quotes && whitespaces
+ while (bStart < bEnd && (sb.charAt(bStart) == '"' || sb.charAt(bStart) == '\'' ||
+ sb.charAt(bStart) == 0x09 || sb.charAt(bStart) == 0x0A ||
+ sb.charAt(bStart) == 0x0D || sb.charAt(bStart) == 0x20)) {
bStart++;
}
- while (bEnd > bStart &&
- (sb.charAt(bEnd) == '\'' || sb.charAt(bEnd) == '\"' ||
- Character.isWhitespace(sb.charAt(bEnd)))) {
+
+ while (bEnd - 1 > bStart && (sb.charAt(bEnd - 1) == '"' || sb.charAt(bEnd - 1) == '\'' ||
+ sb.charAt(bEnd - 1) == 0x09 || sb.charAt(bEnd - 1) == 0x0A ||
+ sb.charAt(bEnd - 1) == 0x0D || sb.charAt(bEnd - 1) == 0x20)) {
bEnd--;
}
- bEnd++;
+ if (start + bStart > offset || start + bEnd - 1 < offset) return null;
+
+ //find start and end of path property
+ while (bStart >= 0) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bStart)) &&
+ sb.charAt(bStart) != '\\' && sb.charAt(bStart) != '/' &&
+ sb.charAt(bStart) != ':' && sb.charAt(bStart) != '-' &&
+ sb.charAt(bStart) != '.' && sb.charAt(bStart) != '_' &&
+ sb.charAt(bStart) != '%' && sb.charAt(bStart) != '?' &&
+ sb.charAt(bStart) != '&' && sb.charAt(bStart) != '=') {
+ bStart++;
+ break;
+ }
+
+ if (bStart == 0) break;
+ bStart--;
+ }
+ // find end of bean property
+ bEnd = bStart;
+ while (bEnd < sb.length()) {
+ if (!Character.isJavaIdentifierPart(sb.charAt(bEnd)) &&
+ sb.charAt(bEnd) != '\\' && sb.charAt(bEnd) != '/' &&
+ sb.charAt(bEnd) != ':' && sb.charAt(bEnd) != '-' &&
+ sb.charAt(bEnd) != '.' && sb.charAt(bEnd) != '_' &&
+ sb.charAt(bEnd) != '%' && sb.charAt(bEnd) != '?' &&
+ sb.charAt(bEnd) != '&' && sb.charAt(bEnd) != '=') {
+ break;
+ }
+ bEnd++;
+ }
- final int propStart = bStart + start;
- final int propLength = bEnd - bStart;
+ int propStart = bStart + start;
+ int propLength = bEnd - bStart;
+ if (propStart > offset + 1 || propStart + propLength < offset) return null;
- // JBIDE-1736: do not detect XMLLink region for the offset that is more than
- // closing quote position of an attribute value.
- if (start + bEnd <= offset) return null;
-
- if (propStart > offset || propStart + propLength < offset) return null;
-
- return new Region(propStart,propLength);
+ return new HyperlinkRegion(propStart, propLength);
} catch (BadLocationException x) {
// Ignore
return null;
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLRootHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -35,16 +35,16 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
- if (!recognize(document, superRegion)) return null;
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
+ if (!recognize(document, offset, superRegion)) return null;
- String axis = computeAxis(document, superRegion.getOffset()) + "/"; //$NON-NLS-1$
+ String axis = computeAxis(document, offset) + "/"; //$NON-NLS-1$
String contentType = superRegion.getContentType();
String type = XML_ROOT_PARTITION;
- int length = superRegion.getLength();
- int offset = superRegion.getOffset();
+ int superLength = superRegion.getLength();
+ int superOffset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
+ IHyperlinkRegion region = new HyperlinkRegion(superOffset, superLength, axis, contentType, type);
return region;
}
@@ -121,19 +121,18 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
return n != null;
} finally {
smw.dispose();
}
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTagAttributeValueHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -14,15 +14,14 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
@@ -31,25 +30,21 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
- IRegion r = getRegion(document, superRegion.getOffset());
+ IRegion r = getRegion(document, offset);
if (r == null) return null;
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = getPartitionType();
- int length = r.getLength() - (superRegion.getOffset() - r.getOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(r.getOffset(), r.getLength(), axis, contentType, type);
} finally {
smw.dispose();
}
@@ -102,7 +97,6 @@
} finally {
smw.dispose();
}
-
}
protected abstract String 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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLTextHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,26 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
import org.eclipse.jface.text.IDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
/**
* @author Jeremy
@@ -33,14 +32,14 @@
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
@Override
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (n == null || !(n instanceof Text)) return null;
String axis = getAxis(document, superRegion);
@@ -49,11 +48,8 @@
int start = Utils.getValueStart(n);
int end = Utils.getValueEnd(n);
if(start < 0 || end < start) return null;
- int length = end - start;
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
@@ -62,14 +58,14 @@
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
return (n instanceof Text);
} finally {
smw.dispose();
@@ -79,5 +75,4 @@
protected String getPartitionType(String axis) {
return XML_TEXT_PARTITION;
}
-
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -18,7 +18,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
-import java.util.StringTokenizer;
import java.util.zip.ZipFile;
import org.eclipse.core.resources.IStorage;
@@ -29,7 +28,6 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.pde.internal.ui.editor.JarEntryEditorInput;
import org.eclipse.pde.internal.ui.editor.JarEntryFile;
import org.eclipse.ui.IEditorInput;
@@ -43,21 +41,15 @@
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
/**
* @author Jeremy
*/
public class XMLXmlNsHyperlink extends AbstractHyperlink {
-
-
class StorageEditorInput extends PlatformObject implements IStorageEditorInput, IStorage, ILocationProvider {
private File fFile;
@@ -142,14 +134,10 @@
protected void doHyperlink(IRegion region) {
try {
-// IFile f = getFileFromCatalog(getURI(region));
-// IFile f = getFileFromCatalog(getPublicId(region), getSystemId(region));
-
String mappedSystemId = getMappedSystemIdFromCatalog(getPublicId(region), getSystemId(region));
String filename = getFilenameFromMappedSystemId(mappedSystemId);
IEditorPart part = null;
if (filename != null) {
-// openFileInEditor(filename);
part = openExternalFile(filename);
if (part == null)
openFileFailed();
@@ -303,77 +291,16 @@
return fileName;
}
- IRegion fLastRegion = null;
- /**
- * @see com.ibm.sse.editor.AbstractHyperlink#doGetHyperlinkRegion(int)
- */
- protected IRegion doGetHyperlinkRegion(int offset) {
- fLastRegion = getRegion(offset);
- return fLastRegion;
- }
-
- protected IRegion getRegion(int offset) {
- StructuredModelWrapper smw = new StructuredModelWrapper();
- try {
- smw.init(getDocument());
- Document xmlDocument = smw.getDocument();
- if (xmlDocument == null) return null;
-
- Node n = Utils.findNodeForOffset(xmlDocument, offset);
- if (!(n instanceof IDOMAttr)) return null;
- IDOMAttr xmlnsAttr = (IDOMAttr)n;
- if (xmlnsAttr.getName() == null ||
- (!xmlnsAttr.getName().equals("xmlns") && //$NON-NLS-1$
- !xmlnsAttr.getName().startsWith("xmlns:") && //$NON-NLS-1$
- !xmlnsAttr.getName().endsWith(":schemaLocation") //$NON-NLS-1$
- )) return null;
-
- String text = xmlnsAttr.getValueRegionText();
- String value = Utils.trimQuotes(xmlnsAttr.getNodeValue());
- int start = xmlnsAttr.getValueRegionStartOffset();
-
- taglibLength = value.length();
- taglibOffset = start + text.indexOf(value);
-
- StringTokenizer tokenizer = new StringTokenizer(value);
-
- int newOffset = -1;
- int newLength = -1;
- if (tokenizer.countTokens() > 1) {
- while (tokenizer.hasMoreTokens()) {
- String next = tokenizer.nextToken();
- int nextStart = taglibOffset + value.indexOf(next);
- if (offset >= nextStart
- && offset <= nextStart + next.length()) {
- newOffset = nextStart;
- newLength = next.length();
- break;
- }
- }
- }
- if (newOffset != -1) {
- taglibLength = newLength;
- taglibOffset = newOffset;
- }
-
- return new Region(taglibOffset,taglibLength);
- } finally {
- smw.dispose();
- }
-
- }
-
/*
* (non-Javadoc)
*
* @see IHyperlink#getHyperlinkText()
*/
public String getHyperlinkText() {
- String uri = getURI(fLastRegion);
+ String uri = getURI(getHyperlinkRegion());
if (uri == null)
return MessageFormat.format(Messages.NotFound, "URI"); //$NON-NLS-1$
return MessageFormat.format(Messages.Open, uri);
}
-
}
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-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/XMLXmlNsHyperlinkPartitioner.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ * Red Hat, Inc. - initial API and implementation
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
@@ -32,47 +32,45 @@
/**
* @see com.ibm.sse.editor.hyperlink.AbstractHyperlinkPartitioner#parse(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- protected IHyperlinkRegion parse(IDocument document, IHyperlinkRegion superRegion) {
+ protected IHyperlinkRegion parse(IDocument document, int offset, IHyperlinkRegion superRegion) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return null;
- Node n = Utils.findNodeForOffset(xmlDocument, superRegion.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof IDOMAttr)) return null;
IDOMAttr xmlnsAttr = (IDOMAttr)n;
if (xmlnsAttr.getName() == null ||
-// (!xmlnsAttr.getName().equals("xmlns") &&
(!xmlnsAttr.getName().startsWith("xmlns:") && //$NON-NLS-1$
!xmlnsAttr.getName().endsWith(":schemaLocation") //$NON-NLS-1$
)) return null;
String xmlns = xmlnsAttr.getValueRegionText();
+ int start = Utils.getValueStart(n);
+ int end = Utils.getValueEnd(n);
+
String axis = getAxis(document, superRegion);
String contentType = superRegion.getContentType();
String type = XML_XMLNS_PARTITION;
- int length = xmlns.length() - (superRegion.getOffset() - xmlnsAttr.getValueRegionStartOffset());
- int offset = superRegion.getOffset();
- IHyperlinkRegion region = new HyperlinkRegion(offset, length, axis, contentType, type);
- return region;
+ return new HyperlinkRegion(start, end - start, axis, contentType, type);
} finally {
smw.dispose();
}
}
-
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
- public boolean recognize(IDocument document, IHyperlinkRegion region) {
+ public boolean recognize(IDocument document, int offset, IHyperlinkRegion region) {
StructuredModelWrapper smw = new StructuredModelWrapper();
try {
smw.init(document);
Document xmlDocument = smw.getDocument();
if (xmlDocument == null) return false;
- Node n = Utils.findNodeForOffset(xmlDocument, region.getOffset());
+ Node n = Utils.findNodeForOffset(xmlDocument, offset);
if (!(n instanceof IDOMAttr)) return false;
IDOMAttr xmlnsAttr = (IDOMAttr)n;
if (xmlnsAttr.getName() == null ||
@@ -87,5 +85,4 @@
smw.dispose();
}
}
-
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/AbstractBaseHyperlink.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -40,6 +40,7 @@
import org.eclipse.wst.sse.core.internal.util.URIResolver;
import org.eclipse.wst.sse.ui.internal.openon.ExternalFileEditorInput;
import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
public abstract class AbstractBaseHyperlink {
@@ -47,8 +48,12 @@
public final String HTTP_PROTOCOL = "http://";//$NON-NLS-1$
+ protected IRegion hyperlinkRegion;
-
+ public void setRegion(IRegion region) {
+ this.hyperlinkRegion = region;
+ }
+
public AbstractBaseHyperlink() {
super();
}
@@ -258,8 +263,12 @@
* @see IHyperlink#getHyperlinkRegion()
*/
public IRegion getHyperlinkRegion() {
- IRegion region = doGetHyperlinkRegion(getOffset());
- return (region != null) ? region : new Region(getOffset(), 0);
+ if (hyperlinkRegion != null) {
+ return hyperlinkRegion;
+ }
+ hyperlinkRegion = (IHyperlinkRegion)doGetHyperlinkRegion(getOffset());
+
+ return (hyperlinkRegion != null) ? hyperlinkRegion: new Region(getOffset(), 0);
}
abstract protected IRegion doGetHyperlinkRegion(int offset);
@@ -289,15 +298,6 @@
return fDocument;
}
- /*
- * (non-Javadoc)
- *
- * @see IHyperlink#getHyperlinkText()
- */
-// public String getHyperlinkText() {
-// return null;
-// }
-
abstract public String getHyperlinkText();
/*
@@ -308,6 +308,4 @@
public String getTypeLabel() {
return null;
}
-
-
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java 2012-01-30 19:17:36 UTC (rev 38288)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xpl/BaseHyperlinkDetector.java 2012-01-30 19:20:43 UTC (rev 38289)
@@ -26,6 +26,7 @@
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkBuilder;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkDetector;
+import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
public class BaseHyperlinkDetector implements IHyperlinkDetector{
@@ -35,8 +36,8 @@
// determine the current partition
if (textViewer != null && textViewer.getDocument() != null) {
String contentType = getContentType(textViewer.getDocument());
- String partitionType = getPartitionType(textViewer.getDocument(), region.getOffset());
- hyperlinks = getHyperlinks(textViewer, region, contentType, partitionType);
+ IHyperlinkRegion partition = getPartition(textViewer.getDocument(), region.getOffset());
+ hyperlinks = partition == null ? null : getHyperlinks(textViewer, region, contentType, partition);
}
return hyperlinks;
}
@@ -44,13 +45,13 @@
/**
* Returns IHyperlink array for the document and region type.
*/
- public IHyperlink[] getHyperlinks(ITextViewer textViewer, IRegion region, String contentType, String partitionType) {
- ArrayList hyperlinks = new ArrayList();
+ public IHyperlink[] getHyperlinks(ITextViewer textViewer, IRegion region, String contentType, IHyperlinkRegion partition) {
+ ArrayList<IHyperlink> hyperlinks = new ArrayList<IHyperlink>();
// determine the current partition
if (textViewer != null && textViewer.getDocument() != null) {
// query HyperlinkBuilder and get the list of open ons for the
// current partition
- HyperlinkDefinition[] defs = HyperlinkBuilder.getInstance().getHyperlinkDefinitions(contentType, partitionType);
+ HyperlinkDefinition[] defs = HyperlinkBuilder.getInstance().getHyperlinkDefinitions(contentType, partition.getType());
if(defs==null) return null;
@@ -60,6 +61,7 @@
if (hyperlink instanceof AbstractHyperlink) {
((AbstractHyperlink)hyperlink).setDocument(textViewer.getDocument());
((AbstractHyperlink)hyperlink).setOffset(region.getOffset());
+ ((AbstractHyperlink)hyperlink).setRegion(partition);
}
hyperlinks.add(hyperlink);
}
@@ -101,14 +103,11 @@
* @param offset
* @return String partition type
*/
- protected String getPartitionType(IDocument document, int offset) {
+ protected IHyperlinkRegion getPartition(IDocument document, int offset) {
String type = null;
- String[] types = getPartitionTypes(document, offset);
+ IHyperlinkRegion[] regions = getPartitions(document, offset);
// if more than 1 hyperlink partitioner type is returned just returning the first one.
- if(types != null && types.length > 0) {
- type = types[0];
- }
- return type;
+ return (regions != null && regions.length > 0 ? regions[0] : null);
}
/**
@@ -125,7 +124,7 @@
return hyperlinks;
}
- protected String[] getPartitionTypes(IDocument document, int offset) {
- return new String[0];
+ protected IHyperlinkRegion[] getPartitions(IDocument document, int offset) {
+ return new IHyperlinkRegion[0];
}
}
12 years, 11 months
JBoss Tools SVN: r38288 - trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-01-30 14:17:36 -0500 (Mon, 30 Jan 2012)
New Revision: 38288
Modified:
trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac...
trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent...
Log:
bump up version of GWT/GPE in SR1-M mirror
Modified: trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac...
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac... 2012-01-30 19:17:11 UTC (rev 38287)
+++ trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac... 2012-01-30 19:17:36 UTC (rev 38288)
@@ -3,7 +3,7 @@
<repository name='JBoss Tools Requirements - Composite Indigo SR1 Mirror' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
<properties size='2'>
<property name='p2.compressed' value='true'/>
-<property name='p2.timestamp' value='1326824935000'/>
+<property name='p2.timestamp' value='1327950950000'/>
</properties>
<children size='15'>
<child location='../../requirements/indigo/201112221140-SR1-M/'/>
@@ -16,7 +16,7 @@
<child location='../../requirements/egit/1.2.0.201112131611/'/>
<child location='../../requirements/emf/2.7.2.v20111031-1121/'/>
<!-- <child location='http://dl.google.com/eclipse/plugin/3.7/'/> -->
-<child location='../../requirements/gwt/2.5.0.v201112160242-rel-r37/'/>
+<child location='../../requirements/gwt/2.5.0.v201201120043-rel-r37/'/>
<!-- includes m2e, m2e-extras, m2e-wtp -->
<child location='../../requirements/m2eclipse/20111005-1500/'/>
Modified: trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent...
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent... 2012-01-30 19:17:11 UTC (rev 38287)
+++ trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent... 2012-01-30 19:17:36 UTC (rev 38288)
@@ -3,7 +3,7 @@
<repository name='JBoss Tools Requirements - Composite Indigo SR1 Mirror' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
<properties size='2'>
<property name='p2.compressed' value='true'/>
-<property name='p2.timestamp' value='1326824949000'/>
+<property name='p2.timestamp' value='1327950963000'/>
</properties>
<children size='15'>
<child location='../../requirements/indigo/201112221140-SR1-M/'/>
@@ -16,7 +16,7 @@
<child location='../../requirements/egit/1.2.0.201112131611/'/>
<child location='../../requirements/emf/2.7.2.v20111031-1121/'/>
<!-- <child location='http://dl.google.com/eclipse/plugin/3.7/'/> -->
-<child location='../../requirements/gwt/2.5.0.v201112160242-rel-r37/'/>
+<child location='../../requirements/gwt/2.5.0.v201201120043-rel-r37/'/>
<!-- includes m2e, m2e-extras, m2e-wtp -->
<child location='../../requirements/m2eclipse/20111005-1500/'/>
12 years, 11 months
JBoss Tools SVN: r38287 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-01-30 14:17:11 -0500 (Mon, 30 Jan 2012)
New Revision: 38287
Modified:
trunk/build/target-platform/jbds.target
trunk/build/target-platform/jbds.target.p2mirror.xml
trunk/build/target-platform/multiple.target
trunk/build/target-platform/multiple.target.p2mirror.xml
trunk/build/target-platform/unified.target
trunk/build/target-platform/unified.target.p2mirror.xml
Log:
add com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group to TP and bump up to newer version of com.google.gdt.eclipse.suite.e37.feature.feature.group
Modified: trunk/build/target-platform/jbds.target
===================================================================
--- trunk/build/target-platform/jbds.target 2012-01-30 19:06:27 UTC (rev 38286)
+++ trunk/build/target-platform/jbds.target 2012-01-30 19:17:11 UTC (rev 38287)
@@ -268,8 +268,9 @@
<unit id="javax.xml.rpc" version="1.1.0.v201005080400"/>
<unit id="javax.el" version="2.2.0.v201105051105"/>
- <!-- GPE dependencies (include only those which are EPL licensed!) -->
- <unit id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version="2.5.0.v201112160242-rel-r37"/>
+ <!-- GWT/GPE dependencies (include only those which are EPL or other OSS licensed!) -->
+ <unit id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version="2.5.0.v201201120043-rel-r37"/>
+ <unit id="com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group" version="2.4.0.v201201120043-rel-r37"/>
</location>
</locations>
-</target>
\ No newline at end of file
+</target>
Modified: trunk/build/target-platform/jbds.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/jbds.target.p2mirror.xml 2012-01-30 19:06:27 UTC (rev 38286)
+++ trunk/build/target-platform/jbds.target.p2mirror.xml 2012-01-30 19:17:11 UTC (rev 38287)
@@ -256,6 +256,7 @@
<iu id="javax.xml.rpc" version=""/>
<iu id="javax.el" version=""/>
<iu id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version=""/>
+<iu id="com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group" version=""/>
</p2.mirror>
</target>
</project>
Modified: trunk/build/target-platform/multiple.target
===================================================================
--- trunk/build/target-platform/multiple.target 2012-01-30 19:06:27 UTC (rev 38286)
+++ trunk/build/target-platform/multiple.target 2012-01-30 19:17:11 UTC (rev 38287)
@@ -309,8 +309,9 @@
<unit id="org.eclipse.birt.chart.feature.group" version="3.7.1.v20110905-7r9e7DFQCnvKN75--lXE5"/>
<unit id="org.eclipse.birt.chart.integration.wtp.feature.group" version="3.7.1.v20110905-1820-4607w31221A1602931"/>
- <!-- GPE dependencies (include only those which are EPL licensed!) -->
- <unit id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version="2.5.0.v201112160242-rel-r37"/>
+ <!-- GWT/GPE dependencies (include only those which are EPL or other OSS licensed!) -->
+ <unit id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version="2.5.0.v201201120043-rel-r37"/>
+ <unit id="com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group" version="2.4.0.v201201120043-rel-r37"/>
<!-- SAVARA dependencies -->
<!-- <unit version="1.2.0.201006151053" id="org.eclipse.stp.bpmn.feature.feature.group"/>
@@ -337,4 +338,4 @@
<feature id="org.mozilla.xpcom.feature"/>
</includeBundles>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-</target>
\ No newline at end of file
+</target>
Modified: trunk/build/target-platform/multiple.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/multiple.target.p2mirror.xml 2012-01-30 19:06:27 UTC (rev 38286)
+++ trunk/build/target-platform/multiple.target.p2mirror.xml 2012-01-30 19:17:11 UTC (rev 38287)
@@ -292,6 +292,7 @@
<iu id="org.eclipse.birt.chart.feature.group" version=""/>
<iu id="org.eclipse.birt.chart.integration.wtp.feature.group" version=""/>
<iu id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version=""/>
+<iu id="com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group" version=""/>
<iu id="org.drools.eclipse.feature.feature.group" version=""/>
<iu id="org.drools.eclipse.task.feature.feature.group" version=""/>
<iu id="org.guvnor.tools.feature.feature.group" version=""/>
Modified: trunk/build/target-platform/unified.target
===================================================================
--- trunk/build/target-platform/unified.target 2012-01-30 19:06:27 UTC (rev 38286)
+++ trunk/build/target-platform/unified.target 2012-01-30 19:17:11 UTC (rev 38287)
@@ -309,8 +309,9 @@
<unit id="org.eclipse.birt.chart.feature.group" version="3.7.1.v20110905-7r9e7DFQCnvKN75--lXE5"/>
<unit id="org.eclipse.birt.chart.integration.wtp.feature.group" version="3.7.1.v20110905-1820-4607w31221A1602931"/>
- <!-- GPE dependencies (include only those which are EPL licensed!) -->
- <unit id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version="2.5.0.v201112160242-rel-r37"/>
+ <!-- GWT/GPE dependencies (include only those which are EPL or other OSS licensed!) -->
+ <unit id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version="2.5.0.v201201120043-rel-r37"/>
+ <unit id="com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group" version="2.4.0.v201201120043-rel-r37"/>
<!-- SAVARA dependencies -->
<!-- <unit version="1.2.0.201006151053" id="org.eclipse.stp.bpmn.feature.feature.group"/>
@@ -337,4 +338,4 @@
<feature id="org.mozilla.xpcom.feature"/>
</includeBundles>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-</target>
\ No newline at end of file
+</target>
Modified: trunk/build/target-platform/unified.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/unified.target.p2mirror.xml 2012-01-30 19:06:27 UTC (rev 38286)
+++ trunk/build/target-platform/unified.target.p2mirror.xml 2012-01-30 19:17:11 UTC (rev 38287)
@@ -292,6 +292,7 @@
<iu id="org.eclipse.birt.chart.feature.group" version=""/>
<iu id="org.eclipse.birt.chart.integration.wtp.feature.group" version=""/>
<iu id="com.google.gdt.eclipse.suite.e37.feature.feature.group" version=""/>
+<iu id="com.google.gwt.eclipse.sdkbundle.e37.feature.feature.group" version=""/>
<iu id="org.drools.eclipse.feature.feature.group" version=""/>
<iu id="org.drools.eclipse.task.feature.feature.group" version=""/>
<iu id="org.guvnor.tools.feature.feature.group" version=""/>
12 years, 11 months