Author: scabanovich
Date: 2009-07-27 11:27:07 -0400 (Mon, 27 Jul 2009)
New Revision: 16820
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2016
In case of collection and maps default EL parser used for JSF is extended to understand
access to elements like iterator().next().
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-07-27
15:23:22 UTC (rev 16819)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-07-27
15:27:07 UTC (rev 16820)
@@ -30,6 +30,8 @@
import org.jboss.tools.common.el.core.model.ELObjectType;
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
import org.jboss.tools.common.el.core.parser.ELParser;
+import org.jboss.tools.common.el.core.parser.ELParserFactory;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
import org.jboss.tools.common.el.core.resolver.ELContext;
@@ -135,9 +137,13 @@
}
public ELExpression parseOperand(String operand) {
+ return parseOperand(operand, getParserFactory());
+ }
+
+ public ELExpression parseOperand(String operand, ELParserFactory factory) {
if(operand == null) return null;
String el = (operand.indexOf("#{") < 0 &&
operand.indexOf("${") < 0) ? "#{" + operand + "}" :
operand; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ELParser p = getParserFactory().createParser();
+ ELParser p = factory.createParser();
ELModel model = p.parse(el);
List<ELInstance> is = model.getInstances();
if(is.isEmpty()) return null;
@@ -204,7 +210,11 @@
if(prefixWasChanged && isArray) {
member.setDataModel(true);
}
- ELExpression newOperand = (prefixWasChanged) ? parseOperand(newEl) : operand;
+ ELExpression newOperand = (prefixWasChanged)
+ ? ((suffix.length() > 0 && getParserFactory() ==
ELParserUtil.getDefaultFactory())
+ ? parseOperand(newEl, ELParserUtil.getCollectionFactory())
+ : parseOperand(newEl))
+ : operand;
ELOperandResolveStatus status = resolveELOperand(file, newOperand,
returnEqualedVariablesOnly, prefixWasChanged);