Author: scabanovich
Date: 2012-04-05 14:02:59 -0400 (Thu, 05 Apr 2012)
New Revision: 40077
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELUtil.java
Log:
JBIDE-11477
https://issues.jboss.org/browse/JBIDE-11477
ELUtil.findExpression(ELModel, int) fixed to return parameter expression, not parent
method expression.
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELUtil.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELUtil.java 2012-04-05
13:05:07 UTC (rev 40076)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/model/ELUtil.java 2012-04-05
18:02:59 UTC (rev 40077)
@@ -43,18 +43,28 @@
for (ELInvocationExpression inv: invs) {
if(inv.getStartPosition() <= offset && inv.getEndPosition() >= offset)
{
if(off < inv.getStartPosition()) {
- result = inv;
+ ELInvocationExpression res = inv;
off = inv.getStartPosition();
ELInvocationExpression l = inv.getLeft();
while(l != null && l.getEndPosition() >= offset) {
- result = l;
+ res = l;
l = l.getLeft();
}
- return result;
+ if(result == null || result.toString().length() > res.toString().length()) {
+ result = res;
+ }
}
}
}
-
+ if(result != null) {
+ if(result instanceof ELMethodInvocation &&
((ELMethodInvocation)result).getParameters() != null) {
+ ELParameters p = ((ELMethodInvocation)result).getParameters();
+ if(p.getStartPosition() < offset && p.getEndPosition() > offset) {
+ result = null;
+ }
+ }
+ return result;
+ }
}
return result;