Author: vrubezhny
Date: 2010-03-02 19:04:59 -0500 (Tue, 02 Mar 2010)
New Revision: 20574
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
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/resolver/TypeInfoCollector.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java
Log:
JBIDE-5961: JSF EL Code complition doesn't recognize static methods.
Fix enables the static methods to be present as EL operands for Seam/CDI-enabled projects,
but disables them for JSF projects. The validation is consistent with the Content Assist,
so, a warning will be shown for static methods in JSF projects, but validation will say OK
for the static mthods in Seam or CDI-enabled projects
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2010-03-02
20:57:10 UTC (rev 20573)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2010-03-03
00:04:59 UTC (rev 20574)
@@ -130,4 +130,9 @@
public ELParserFactory getParserFactory() {
return factory;
}
+
+ @Override
+ protected boolean isStaticMethodsCollectingEnabled() {
+ return true;
+ }
}
\ No newline at end of file
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 2010-03-02
20:57:10 UTC (rev 20573)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/AbstractELCompletionEngine.java 2010-03-03
00:04:59 UTC (rev 20574)
@@ -580,6 +580,8 @@
abstract protected TypeInfoCollector.MemberInfo getMemberInfoByVariable(V var, boolean
onlyEqualNames);
+ abstract protected boolean isStaticMethodsCollectingEnabled();
+
protected boolean isSingularAttribute(V var) {
return false;
}
@@ -600,7 +602,7 @@
List<TypeInfoCollector.MemberInfo> newMembers = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector(varIsUsed);
+ TypeInfoCollector infos = mbr.getTypeCollector(varIsUsed,
isStaticMethodsCollectingEnabled());
if (TypeInfoCollector.isNotParameterizedCollection(mbr) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
}
@@ -628,7 +630,7 @@
List<TypeInfoCollector.MemberInfo> newMembers = new
ArrayList<TypeInfoCollector.MemberInfo>();
for (TypeInfoCollector.MemberInfo mbr : members) {
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
+ TypeInfoCollector infos = mbr.getTypeCollector(false,
isStaticMethodsCollectingEnabled());
if (TypeInfoCollector.isNotParameterizedCollection(mbr) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
}
@@ -672,7 +674,7 @@
if (mbr.getMemberType() == null) {
continue;
}
- TypeInfoCollector infos = mbr.getTypeCollector(varIsUsed);
+ TypeInfoCollector infos = mbr.getTypeCollector(varIsUsed,
isStaticMethodsCollectingEnabled());
if (TypeInfoCollector.isNotParameterizedCollection(mbr) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
}
@@ -778,7 +780,7 @@
continue;
}
if (mbr.getMemberType() == null) continue;
- TypeInfoCollector infos = mbr.getTypeCollector();
+ TypeInfoCollector infos = mbr.getTypeCollector(false,
isStaticMethodsCollectingEnabled());
if (TypeInfoCollector.isNotParameterizedCollection(mbr) ||
TypeInfoCollector.isResourceBundle(mbr.getMemberType())) {
resolution.setMapOrCollectionOrBundleAmoungTheTokens(true);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2010-03-02
20:57:10 UTC (rev 20573)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2010-03-03
00:04:59 UTC (rev 20574)
@@ -44,6 +44,7 @@
IType fType;
MemberInfo fMember;
TypeInfo fTypeInfo;
+ boolean fIncludeStaticMethods;
List<MethodInfo> fMethods;
List<FieldInfo> fFields;
@@ -326,15 +327,11 @@
this.isDataModel = isDataModel;
}
- public TypeInfoCollector getTypeCollector() {
- return getTypeCollector(false);
- }
-
- public TypeInfoCollector getTypeCollector(boolean varIsUsed) {
+ public TypeInfoCollector getTypeCollector(boolean varIsUsed, boolean
includeStaticMethods) {
// The rev. 7651 results in a deadlock, typeInfo is not stored anymore
// The rev. 7623 results in a deadlock, so, it's rolled back
// >>> Fix for JBIDE-2090
- return new TypeInfoCollector(this, varIsUsed);
+ return new TypeInfoCollector(this, varIsUsed, includeStaticMethods);
// <<< Fix for JBIDE-2090
}
@@ -685,13 +682,10 @@
}
}
- public TypeInfoCollector(MemberInfo member) {
- this(member, false);
- }
-
- public TypeInfoCollector(MemberInfo member, boolean varIsUsed) {
+ public TypeInfoCollector(MemberInfo member, boolean varIsUsed, boolean
includeStaticMethods) {
this.fMember = member;
this.fType = member.getMemberType();
+ this.fIncludeStaticMethods = includeStaticMethods;
collectInfo(varIsUsed);
}
@@ -957,7 +951,8 @@
try {
if (((info.getSourceType()!=null && info.getSourceType().isInterface()) ||
info.isPublic())
&& !info.isConstructor()
- && !info.isStatic() && !info.isJavaLangObject()
+ && (fIncludeStaticMethods || !info.isStatic()) // Fix for JBIDE-5961: JSF
EL Code complition doesn't recognize static methods.
+ && !info.isJavaLangObject()
// && !info.isGetter() && !info.isSetter() // Fix for JBIDE-3378
) {
methods.add(info);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java 2010-03-02
20:57:10 UTC (rev 20573)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFELCompletionEngine.java 2010-03-03
00:04:59 UTC (rev 20574)
@@ -73,6 +73,7 @@
*/
public List<IJSFVariable> resolveVariables(IFile file, ELInvocationExpression
expr, boolean isFinal, boolean onlyEqualNames) {
IModelNature project = EclipseResourceUtil.getModelNature(file.getProject());
+
return resolveVariables(file, project, expr, isFinal, onlyEqualNames);
}
@@ -188,4 +189,9 @@
return name;
}
}
+
+ @Override
+ protected boolean isStaticMethodsCollectingEnabled() {
+ return false;
+ }
}
\ No newline at end of file
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2010-03-02
20:57:10 UTC (rev 20573)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2010-03-03
00:04:59 UTC (rev 20574)
@@ -531,4 +531,9 @@
ELInvocationExpression expr, boolean isFinal, boolean onlyEqualNames) {
return null;
}
+
+ @Override
+ protected boolean isStaticMethodsCollectingEnabled() {
+ return false;
+ }
}
\ No newline at end of file
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 2010-03-02
20:57:10 UTC (rev 20573)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/el/SeamELCompletionEngine.java 2010-03-03
00:04:59 UTC (rev 20574)
@@ -382,4 +382,9 @@
public static boolean isSeamMessagesComponentVariable(ISeamContextVariable variable) {
return (null != getSeamMessagesComponentVariable(variable));
}
+
+ @Override
+ protected boolean isStaticMethodsCollectingEnabled() {
+ return true; // Static methods are always enabled for Seam
+ }
}
\ No newline at end of file