Author: scabanovich
Date: 2009-01-30 10:40:19 -0500 (Fri, 30 Jan 2009)
New Revision: 13400
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
Log:
JBIDE-3686
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-01-30
14:36:53 UTC (rev 13399)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2009-01-30
15:40:19 UTC (rev 13400)
@@ -190,6 +190,10 @@
} else {
// Last resolved token is token outside "var" prefix. Correct last
resolved token.
int oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition() -
var.getElToken().getText().length() - suffix.length() + var.getName().length();
+ if(newLastResolvedToken.getLeft() == null) {
+ //In this case we do not need to take into account difference in length of var and
its expression.
+ oldLastResolvedTokenStart = newLastResolvedToken.getInvocationStartPosition();
+ }
ELInvocationExpression l = (ELInvocationExpression)operand;
while(l != null) {
if(l.getInvocationStartPosition() - l.getStartPosition() <=
oldLastResolvedTokenStart) {
@@ -377,7 +381,7 @@
TypeInfoCollector.MemberInfo bijectedAttribute = null;
for (ISeamContextVariable var : resolvedVariables) {
if(var instanceof IBijectedAttribute) {
- bijectedAttribute = SeamExpressionResolver.getMemberInfoByVariable(var, true);
+ bijectedAttribute = SeamExpressionResolver.getMemberInfoByVariable(var, true,
this);
}
String varName = var.getName();
if(operand.getLength()<=varName.length()) {
@@ -399,7 +403,7 @@
}
proposals.add(proposal);
}
- status.setMemberOfResolvedOperand(bijectedAttribute!=null?bijectedAttribute:SeamExpressionResolver.getMemberInfoByVariable(var,
true));
+ status.setMemberOfResolvedOperand(bijectedAttribute!=null?bijectedAttribute:SeamExpressionResolver.getMemberInfoByVariable(var,
true, this));
}
status.setLastResolvedToken(expr);
status.setProposals(proposals);
@@ -409,7 +413,7 @@
// First segment is found - proceed with next tokens
List<TypeInfoCollector.MemberInfo> members = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (ISeamContextVariable var : resolvedVariables) {
- TypeInfoCollector.MemberInfo member =
SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly);
+ TypeInfoCollector.MemberInfo member =
SeamExpressionResolver.getMemberInfoByVariable(var, returnEqualedVariablesOnly, this);
if (member != null && !members.contains(member))
members.add(member);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2009-01-30
14:36:53 UTC (rev 13399)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamExpressionResolver.java 2009-01-30
15:40:19 UTC (rev 13400)
@@ -21,12 +21,18 @@
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInstance;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
+import org.jboss.tools.common.el.core.model.ELModel;
+import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.Type;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.TypeInfo;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.TypeMemberInfo;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
@@ -252,10 +258,10 @@
* @param variable
* @return
*/
- public static TypeInfoCollector.MemberInfo getMemberInfoByVariable(ISeamContextVariable
variable, boolean onlyEqualNames) {
+ public static TypeInfoCollector.MemberInfo getMemberInfoByVariable(ISeamContextVariable
variable, boolean onlyEqualNames, SeamELCompletionEngine engine) {
TypeInfoCollector.MemberInfo member = null;
if(variable instanceof ISeamContextShortVariable) {
- return getMemberInfoByVariable(((ISeamContextShortVariable)variable).getOriginal(),
onlyEqualNames);
+ return getMemberInfoByVariable(((ISeamContextShortVariable)variable).getOriginal(),
onlyEqualNames, engine);
}
if(variable instanceof ISeamMessages) {
MemberInfo info = null;;
@@ -329,15 +335,31 @@
ISeamProject project = ((ISeamElement)factory).getSeamProject();
// ISeamProject project = getSeamProject(factory.getResource());
if (project != null) {
- List<ISeamContextVariable> resolvedValues = resolveVariables(project, null /*
factory.getScope()*/, value, onlyEqualNames);
+ List<ISeamContextVariable> resolvedValues = resolveVariables(project, null /*
factory.getScope()*/, value, onlyEqualNames);
for (ISeamContextVariable var : resolvedValues) {
if (var.getName().equals(value)) {
- member = getMemberInfoByVariable(var, onlyEqualNames);
+ member = getMemberInfoByVariable(var, onlyEqualNames, engine);
break;
}
}
}
}
+ if(member == null) {
+ ELParser p = ELParserUtil.getJbossFactory().createParser();
+ ELModel m = p.parse(factory.getValue());
+ ELInstance i = m.getInstances().size() == 0 ? null : m.getInstances().get(0);
+ ELExpression ex = i == null ? null : i.getExpression();
+ if(ex instanceof ELInvocationExpression) {
+ ELInvocationExpression expr = (ELInvocationExpression)ex;
+ try {
+ member = engine.resolveSeamEL(null, expr, false);
+ } catch (StringIndexOutOfBoundsException e) {
+ e.printStackTrace();
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
return member;
}
Show replies by date