Author: scabanovich
Date: 2011-12-22 20:39:25 -0500 (Thu, 22 Dec 2011)
New Revision: 37546
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
Log:
JBIDE-10565
https://issues.jboss.org/browse/JBIDE-10565
There should be no EL proposals at #|{.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java 2011-12-23
01:37:19 UTC (rev 37545)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/AbstractXmlCompletionProposalComputer.java 2011-12-23
01:39:25 UTC (rev 37546)
@@ -740,6 +740,7 @@
private int length;
private String text;
private boolean isELStarted;
+ private boolean isInsideELStartToken;
private boolean isELClosed;
private boolean isAttributeValue;
private boolean hasOpenQuote;
@@ -786,7 +787,15 @@
public boolean isELStarted() {
return isELStarted;
}
+
+ public boolean isInsideELStartToken() {
+ return isInsideELStartToken;
+ }
+ void setInsideELStartToken(boolean b) {
+ isInsideELStartToken = b;
+ }
+
public boolean isELClosed() {
return isELClosed;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java 2011-12-23
01:37:19 UTC (rev 37545)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/FaceletsELCompletionProposalComputer.java 2011-12-23
01:39:25 UTC (rev 37546)
@@ -144,6 +144,10 @@
// If it is true we don't need to start any new tag proposals
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix != null && prefix.isELStarted()) {
+ if(prefix.isInsideELStartToken()) {
+ // "#|{" - wrong place to suggest anything
+ return;
+ }
addTextELProposals(contentAssistRequest, context);
} else {
addELPredicateProposals(contentAssistRequest, getTagInsertionBaseRelevance(), true);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-12-23
01:37:19 UTC (rev 37545)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlELCompletionProposalComputer.java 2011-12-23
01:39:25 UTC (rev 37546)
@@ -133,6 +133,10 @@
// If it is true we don't need to start any new tag proposals
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix != null && prefix.isELStarted()) {
+ if(prefix.isInsideELStartToken()) {
+ // "#|{" - wrong place to suggest anything
+ return;
+ }
addTextELProposals(contentAssistRequest, context);
} else {
addELPredicateProposals(contentAssistRequest, getTagInsertionBaseRelevance(), true);
@@ -150,6 +154,10 @@
// If it is true we don't need to start any new tag proposals
TextRegion prefix = getELPrefix(contentAssistRequest);
if (prefix != null && prefix.isELStarted()) {
+ if(prefix.isInsideELStartToken()) {
+ // "#|{" - wrong place to suggest anything
+ return;
+ }
addAttributeValueELProposals(contentAssistRequest, context);
return;
}
@@ -168,7 +176,7 @@
return;
TextRegion prefix = getELPrefix(contentAssistRequest);
- if (prefix == null)
+ if (prefix == null || prefix.isInsideELStartToken())
return; // Do not return any proposals here (predicate proposals may be created
instead)
if(!prefix.isELStarted()) {
@@ -327,6 +335,10 @@
contentAssistRequest.addProposal(proposal);
return;
}
+ if(prefix.isInsideELStartToken()) {
+ // "#|{" - wrong place to suggest anything
+ return;
+ }
String matchString = EL_NUMBER_PREFIX + prefix.getText();
String query = (matchString == null ? "" : matchString); //$NON-NLS-1$
String stringQuery = matchString;
@@ -941,7 +953,7 @@
ELInstance is = ELUtil.findInstance(model, inValueOffset);// ELInstance
ELInvocationExpression ie = ELUtil.findExpression(model, inValueOffset);//
ELExpression
-
+
boolean isELStarted = (model != null && is != null &&
(startsWithELBeginning(model.toString())));
boolean isELClosed = (model != null && is != null &&
model.toString().endsWith("}")); //$NON-NLS-1$
@@ -951,6 +963,10 @@
isELStarted, isELClosed,
isAttributeValue, hasOpenQuote, hasCloseQuote, quoteChar);
+ if(is != null && ie == null && is.getFirstToken() != null &&
is.getFirstToken().getStart() + is.getFirstToken().getLength() > inValueOffset) {
+ tr.setInsideELStartToken(true);
+ }
+
return tr;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2011-12-23
01:37:19 UTC (rev 37545)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/computers/XmlTagCompletionProposalComputer.java 2011-12-23
01:39:25 UTC (rev 37546)
@@ -600,6 +600,9 @@
documentRegion = documentRegion.getPrevious();
completionRegion = getCompletionRegion(request.getDocumentRegion().getStartOffset() +
request.getRegion().getStart() - 1, request.getParent());
}
+ if(documentRegion==null || completionRegion==null) {
+ return null;
+ }
if (!DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(completionRegion.getType())
&&
!DOMRegionContext.XML_CONTENT.equals(completionRegion.getType()) &&
!DOMRegionContext.BLOCK_TEXT.equals(completionRegion.getType())) {