[281421] [editor] StringIndexOutOfBounds exeception
https://bugs.eclipse.org/bugs/show_bug.cgi?id=281421
diff --git a/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
index 3465f09..02ba3cb 100644
--- a/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.xsl.ui;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.0.100.qualifier
Bundle-Activator: org.eclipse.wst.xsl.ui.internal.XSLUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/SelectAttributeContentAssist.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/SelectAttributeContentAssist.java
index 85658ae..7c579a6 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/SelectAttributeContentAssist.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/SelectAttributeContentAssist.java
@@ -97,7 +97,7 @@
public ArrayList<ICompletionProposal> getCompletionProposals() {
proposals.clear();
- adjustXPathStart();
+ adjustXPathStart(SELECT_ATTRIBUTE);
int offset = getReplacementBeginPosition();
IDOMAttr attrNode = getAttribute(SELECT_ATTRIBUTE);
@@ -121,10 +121,11 @@
* 1. Adjust the matchString (This should have been calculated earlier)
* 2. Get the current tokens offset position..this will be the starting offset.
* 3. Get the replacement length...this is the difference between the token offset and the next token or end of the string
+ * @param attrName TODO
*/
- protected void adjustXPathStart() {
+ protected void adjustXPathStart(String attrName) {
IDOMElement elem = (IDOMElement)getNode();
- IDOMAttr xpathNode = (IDOMAttr)elem.getAttributeNode(SELECT_ATTRIBUTE);
+ IDOMAttr xpathNode = (IDOMAttr)elem.getAttributeNode(attrName);
if (xpathNode == null) {
return;
}
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/TestAttributeContentAssist.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/TestAttributeContentAssist.java
index 54a76a6..e0b2754 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/TestAttributeContentAssist.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentassist/TestAttributeContentAssist.java
@@ -56,7 +56,7 @@
@Override
public ArrayList<ICompletionProposal> getCompletionProposals() {
- adjustXPathStart();
+ adjustXPathStart(ATTR_TEST);
int offset = getReplacementBeginPosition();
IDOMAttr attrNode = (IDOMAttr)((IDOMElement)getNode()).getAttributeNode(ATTR_TEST);
@@ -68,25 +68,4 @@
return getAllCompletionProposals();
}
- /**
- * This needs to setup the content assistance correctly. Here is what needs to happen:
- * 1. Adjust the matchString (This should have been calculated earlier)
- * 2. Get the current tokens offset position..this will be the starting offset.
- * 3. Get the replacement length...this is the difference between the token offset and the next token or end of the string
- */
- @Override
- protected void adjustXPathStart() {
- IDOMElement elem = (IDOMElement)getNode();
- IDOMAttr xpathNode = (IDOMAttr)elem.getAttributeNode(ATTR_TEST);
-
- if (xpathNode != null) {
- String xpathString = xpathNode.getValue();
- int startOffset = xpathNode.getValueRegionStartOffset();
- int tokenOffset = getReplacementBeginPosition() - xpathNode.getValueRegionStartOffset();
- int tokenPosition = getXPathSeperatorPos(tokenOffset, xpathString);
- int newStartOffset = startOffset + tokenPosition - 1;
-
- replacementLength = getReplacementBeginPosition() - startOffset;
- }
- }
}