Author: scabanovich
Date: 2011-11-11 17:16:01 -0500 (Fri, 11 Nov 2011)
New Revision: 36308
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
Log:
JBIDE-10159
https://issues.jboss.org/browse/JBIDE-10159
Content assist outside expression in Java sources provided. White spaces after the last
dot are included into expression to provide ca for members rather than beans in that
region.
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2011-11-11
22:11:35 UTC (rev 36307)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2011-11-11
22:16:01 UTC (rev 36308)
@@ -56,7 +56,9 @@
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberPresentation;
import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.el.internal.core.model.ELPropertyInvocationImpl;
import org.jboss.tools.common.el.internal.core.parser.token.JavaNameTokenDescription;
+import org.jboss.tools.common.el.internal.core.parser.token.WhiteSpaceTokenDescription;
import org.jboss.tools.common.text.TextProposal;
public abstract class AbstractELCompletionEngine<V extends IVariable> implements
ELResolver, ELCompletionEngine {
@@ -95,6 +97,25 @@
return getProposals(context, el, offset);
}
}
+ List<ELInstance> is = ref.getELModel().getInstances();
+ for (ELInstance i: is) {
+ ELExpression exp = i.getExpression();
+ if(exp == null || exp.getFirstToken() == null) {
+ continue;
+ }
+ LexicalToken b = exp.getFirstToken();
+ while(b.getPreviousToken() != null && b.getPreviousToken().getType() ==
WhiteSpaceTokenDescription.WHITESPACE) {
+ b = b.getPreviousToken();
+ }
+ LexicalToken e = exp.getLastToken();
+ if(e == null) e = b;
+ while(e.getNextToken() != null && e.getNextToken().getType() ==
WhiteSpaceTokenDescription.WHITESPACE) {
+ e = e.getNextToken();
+ }
+ if(exp != null && ref.getStartPosition() + b.getStart() <= offset
&& ref.getStartPosition() + e.getStart() + e.getLength() >= offset) {
+ return getProposals(context, "#{", offset);
+ }
+ }
}
return Collections.emptyList();
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-11-11
22:11:35 UTC (rev 36307)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/internal/core/parser/ELParserImpl.java 2011-11-11
22:16:01 UTC (rev 36308)
@@ -295,6 +295,10 @@
ELPropertyInvocationImpl incompleteProperty = new ELPropertyInvocationImpl();
incompleteProperty.setSeparator(dot);
incompleteProperty.setLastToken(dot);
+ LexicalToken n = dot.getNextToken();
+ if(n != null && n.getType() == WhiteSpaceTokenDescription.WHITESPACE) {
+ incompleteProperty.setLastToken(n);
+ }
incompleteProperty.setLeft(result);
incompleteProperty.setLeftIsFake(isLeftFake);
result = incompleteProperty;