Author: vrubezhny
Date: 2009-09-24 09:53:59 -0400 (Thu, 24 Sep 2009)
New Revision: 17716
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
Log:
JBIDE-2332 CA with proposal list for comonent's atributes doesn't work before
double quotes.
Issue is fixed
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-09-24
13:37:24 UTC (rev 17715)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-09-24
13:53:59 UTC (rev 17716)
@@ -269,8 +269,24 @@
domnode = prevnode;
}
}
+
return super.getCompletionRegion(documentPosition, domnode);
}
+
+ protected ITextRegion getCompletionRegion(int offset, IStructuredDocumentRegion
sdRegion) {
+ ITextRegion region = super.getCompletionRegion(offset, sdRegion);
+ if (region != null && region.getType() == DOMRegionContext.UNDEFINED) {
+ // FIX: JBIDE-2332 CA with proposal list for comonent's atributes doesn't work
before double quotes.
+ // Sometimes, especially if we have a broken XML node, the region returned has
UNDEFINED type.
+ // If so, we're try to use the prevoius region, which probably will be the region
of type XML_TAG_NAME.
+
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(offset - 1);
+ if ((previousRegion != null) && (previousRegion != region) &&
(previousRegion.getTextLength() < previousRegion.getLength())) {
+ region = previousRegion;
+ }
+ }
+ return region;
+ }
/*
* (non-Javadoc)
* @see
org.eclipse.wst.xml.ui.internal.contentassist.AbstractContentAssistProcessor#computeTagNameProposals(int,
java.lang.String, org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion,
org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode,
org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)