Author: vrubezhny
Date: 2008-01-11 14:12:27 -0500 (Fri, 11 Jan 2008)
New Revision: 5645
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-1585 Proposal list is not filtered by current
input if there is no blank symbol between new entered tag and next tag, and new tag has no
'>'
Issue is fixed
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2008-01-11
19:01:05 UTC (rev 5644)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2008-01-11
19:12:27 UTC (rev 5645)
@@ -28,9 +28,11 @@
import org.eclipse.wst.html.ui.internal.HTMLUIPlugin;
import org.eclipse.wst.html.ui.internal.contentassist.HTMLContentAssistProcessor;
import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
@@ -541,4 +543,38 @@
jspActiveCAP = new JSPActiveContentAssistProcessor();
jspActiveCAP.init();
}
+
+
+ /**
+ * StructuredTextViewer must be set before using this.
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion =
ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, pos);
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(pos);
+ if (region == null) {
+ return null;
+ }
+
+ if (sdRegion.getStartOffset(region) == pos) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) &&
(sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ sdRegion = sdRegion.getPrevious();
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(pos - 1);
+ if ((previousRegion != null) && (previousRegion != region) &&
(previousRegion.getTextLength() == previousRegion.getLength())) {
+ sdRegion = sdRegion.getPrevious();
+ }
+ }
+ }
+
+ return sdRegion;
+ }
+
}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2008-01-11
19:01:05 UTC (rev 5644)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2008-01-11
19:12:27 UTC (rev 5645)
@@ -622,4 +622,37 @@
private boolean isCommentNode(IDOMNode node) {
return (node != null && node instanceof IDOMElement && ((IDOMElement)
node).isCommentTag());
}
+
+ /**
+ * StructuredTextViewer must be set before using this.
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion =
ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, pos);
+ ITextRegion region = sdRegion.getRegionAtCharacterOffset(pos);
+ if (region == null) {
+ return null;
+ }
+
+ if (sdRegion.getStartOffset(region) == pos) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) &&
(sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ sdRegion = sdRegion.getPrevious();
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(pos - 1);
+ if ((previousRegion != null) && (previousRegion != region) &&
(previousRegion.getTextLength() == previousRegion.getLength())) {
+ sdRegion = sdRegion.getPrevious();
+ }
+ }
+ }
+
+ return sdRegion;
+ }
+
}
\ No newline at end of file