Author: vrubezhny
Date: 2008-01-30 15:42:29 -0500 (Wed, 30 Jan 2008)
New Revision: 6039
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-1704 Wrong JSF proposals appear if Ctrl-Space
pressed right after the attribute value
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-30
18:39:35 UTC (rev 6038)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2008-01-30
20:42:29 UTC (rev 6039)
@@ -32,6 +32,7 @@
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.core.utils.StringUtils;
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;
@@ -324,6 +325,22 @@
}
protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
+ // JBIDE-1704:
+ // Check the position in the value:
+ // The following position:
+ // <nodeName attrName="attrValue"| .../>
+ // is marked as attribute value, but the value itself is complete.
+ // There are no proposals to be correct at this position.
+
+ String text = contentAssistRequest.getText();
+ String matchString = contentAssistRequest.getMatchString();
+
+ if (matchString.length() > StringUtils.strip(text).length() &&
+ ( (matchString.startsWith("\"") &&
matchString.endsWith("\""))
+ || (matchString.startsWith("'") &&
matchString.endsWith("\"")))) {
+ return;
+ }
+
if (jspActiveCAP != null) {
jspActiveCAP.setFacelets(isFacelets);
jspActiveCAP.addAttributeValueProposals(contentAssistRequest);
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-30
18:39:35 UTC (rev 6038)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2008-01-30
20:42:29 UTC (rev 6039)
@@ -33,6 +33,7 @@
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.utils.StringUtils;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
@@ -624,6 +625,26 @@
return (node != null && node instanceof IDOMElement && ((IDOMElement)
node).isCommentTag());
}
+ protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
+ // JBIDE-1704:
+ // Check the position in the value:
+ // The following position:
+ // <nodeName attrName="attrValue"| .../>
+ // is marked as attribute value, but the value itself is complete.
+ // There are no proposals to be correct at this position.
+
+ String text = contentAssistRequest.getText();
+ String matchString = contentAssistRequest.getMatchString();
+
+ if (matchString.length() > StringUtils.strip(text).length() &&
+ ( (matchString.startsWith("\"") &&
matchString.endsWith("\""))
+ || (matchString.startsWith("'") &&
matchString.endsWith("\"")))) {
+ return;
+ }
+
+ super.addAttributeValueProposals(contentAssistRequest);
+ }
+
/**
* StructuredTextViewer must be set before using this.
*/