Author: vrubezhny
Date: 2011-07-28 08:16:05 -0400 (Thu, 28 Jul 2011)
New Revision: 33301
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSF2CCAttrsELCompletionEngine.java
Log:
JBIDE-9288
Open On for bundle messages doesn't work for CDI projects with International Module
enabled
Fixed resolver issues that break the resolution of long (qualified) name for bundles
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java 2011-07-28
10:45:11 UTC (rev 33300)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java 2011-07-28
12:16:05 UTC (rev 33301)
@@ -219,29 +219,8 @@
// but we have to resolve arguments of probably a message component
if (resolvedVariables != null && !resolvedVariables.isEmpty()) {
resolution.setLastResolvedToken(left);
- // Create a combined lexical token to store all the variable name (not only the name
before first dot, but all the name including all the words and dots)
- int variableTokenType = left.getFirstToken().getType();
- int variableTokenStart = left.getFirstToken().getStart();
- int variableTokenLength = 0;
- StringBuffer variableTokenText = new StringBuffer();
- LexicalToken current = left.getFirstToken();
- LexicalToken variableTokenNext = null;
- while (current != null && current != left.getLastToken()) {
- variableTokenText.append(current.getText());
- variableTokenLength += current.getLength();
- variableTokenNext = current.getNextToken();
- current = variableTokenNext;
- }
- if (current != null) {
- variableTokenText.append(current.getText());
- variableTokenLength += current.getLength();
- variableTokenNext = current.getNextToken();
- }
-
- LexicalToken variableToken = new LexicalToken(variableTokenStart,
variableTokenLength, variableTokenText, variableTokenType);
- variableToken.setNextToken(variableTokenNext);
-
- ELSegmentImpl segment = new MessagePropertyELSegmentImpl(variableToken);
+
+ ELSegmentImpl segment = new
MessagePropertyELSegmentImpl(combineLexicalTokensForExpression(left));
processMessageBundleSegment(expr, (MessagePropertyELSegmentImpl)segment,
resolvedVariables);
segment.setResolved(true);
@@ -263,7 +242,7 @@
resolvedVariables = resolvedVars;
resolution.setLastResolvedToken(left);
- ELSegmentImpl segment = new MessagePropertyELSegmentImpl(left.getFirstToken());
+ ELSegmentImpl segment = new
MessagePropertyELSegmentImpl(combineLexicalTokensForExpression(left));
processMessageBundleSegment(expr, (MessagePropertyELSegmentImpl)segment,
resolvedVariables);
segment.setResolved(true);
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-07-28
10:45:11 UTC (rev 33300)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2011-07-28
12:16:05 UTC (rev 33301)
@@ -1132,5 +1132,31 @@
value = value.substring(0, value.length() - 1);
}
return value;
- }
+ }
+
+ public static LexicalToken combineLexicalTokensForExpression(ELInvocationExpression
expr) {
+ // Create a combined lexical token to store all the variable name (not only the name
before first dot, but all the name including all the words and dots)
+ int variableTokenType = expr.getFirstToken().getType();
+ int variableTokenStart = expr.getFirstToken().getStart();
+ int variableTokenLength = 0;
+ StringBuffer variableTokenText = new StringBuffer();
+ LexicalToken current = expr.getFirstToken();
+ LexicalToken variableTokenNext = null;
+ while (current != null && current != expr.getLastToken()) {
+ variableTokenText.append(current.getText());
+ variableTokenLength += current.getLength();
+ variableTokenNext = current.getNextToken();
+ current = variableTokenNext;
+ }
+ if (current != null) {
+ variableTokenText.append(current.getText());
+ variableTokenLength += current.getLength();
+ variableTokenNext = current.getNextToken();
+ }
+
+ LexicalToken variableToken = new LexicalToken(variableTokenStart, variableTokenLength,
variableTokenText, variableTokenType);
+ variableToken.setNextToken(variableTokenNext);
+
+ return variableToken;
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSF2CCAttrsELCompletionEngine.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSF2CCAttrsELCompletionEngine.java 2011-07-28
10:45:11 UTC (rev 33300)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSF2CCAttrsELCompletionEngine.java 2011-07-28
12:16:05 UTC (rev 33301)
@@ -195,15 +195,7 @@
resolvedVariables = resolvedVars;
resolution.setLastResolvedToken(left);
- // Combine left's tokens into a single token
- LexicalToken token = left.getFirstToken();
- String singleText = left.getText();
- int start = token.getStart();
- int type = token.getType();
- int length = singleText.length();
-
- LexicalToken singleToken = new LexicalToken(start, length, singleText, type);
- ELSegmentImpl segment = new ELSegmentImpl(singleToken);
+ ELSegmentImpl segment = new ELSegmentImpl(combineLexicalTokensForExpression(left));
segment.setResolved(true);
resolution.addSegment(segment);
Show replies by date