Author: akazakov
Date: 2012-10-03 21:03:04 -0400 (Wed, 03 Oct 2012)
New Revision: 44275
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
Log:
https://issues.jboss.org/browse/JBIDE-12778 EL completition doesn't understand Seam
EntityHome<E> anymore
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 2012-10-03
22:51:56 UTC (rev 44274)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2012-10-04
01:03:04 UTC (rev 44275)
@@ -13,6 +13,7 @@
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
@@ -811,37 +812,8 @@
fTypeInfo = new TypeInfo(binType, fMember, fMember.isDataModel());
}
TypeInfo parent = fTypeInfo;
- List<IType> allTypes = new ArrayList<IType>();
- Set<IType> allTypesSet = new HashSet<IType>();
- Set<IType> superinterfaces = new HashSet<IType>();
- while (binType != null && binType.exists()) {
- if(allTypesSet.contains(binType)) break;
- allTypes.add(binType);
- allTypesSet.add(binType);
- initSuperinterfaces(binType, superinterfaces); // JBIDE-10809
- binType = getSuperclass(binType);
- if(binType!=null) {
- TypeInfo superType = new TypeInfo(binType, originalParent, parent.isDataModel());
- parent.setSuperType(superType);
- parent = superType;
- }
- }
+ initSuperTypes(binType, var, parent, originalParent, new TreeSet<String>());
- allTypes.addAll(superinterfaces);
- for (IType type : allTypes) {
- IMethod[] binMethods = type.getMethods();
- for (int i = 0; binMethods != null && i < binMethods.length; i++) {
- if (binMethods[i].isConstructor()) {
- continue;
- }
- MethodInfo info = new MethodInfo(binMethods[i], fTypeInfo, parent, false);
- if(info.getType().isArray() && var) {
- info.setDataModel(true);
- }
- fMethods.add(info);
- }
- }
-
// This inserts here methods "public int size()" and "public boolean
isEmpty()" for javax.faces.model.DataModel
// as requested by Gavin in JBIDE-1256
if(isDataModelObject(fType)) {
@@ -856,6 +828,46 @@
}
}
+ private void initSuperTypes(IType binType, boolean var, TypeInfo parent, MemberInfo
originalParent, Collection<String> allTypes) throws JavaModelException {
+ IMethod[] binMethods = binType.getMethods();
+ for (int i = 0; binMethods != null && i < binMethods.length; i++) {
+ if (binMethods[i].isConstructor()) {
+ continue;
+ }
+ MethodInfo info = new MethodInfo(binMethods[i], fTypeInfo, parent, false);
+ if(info.getType().isArray() && var) {
+ info.setDataModel(true);
+ }
+ fMethods.add(info);
+ }
+
+ String[] superinterfaceNames = binType.getSuperInterfaceNames();
+ for (String superinterface : superinterfaceNames) {
+ String fullSuperInterfaceName = EclipseJavaUtil.resolveType(binType, superinterface);
+ if(fullSuperInterfaceName!=null) {
+ if(fullSuperInterfaceName.equals(binType.getFullyQualifiedName())) {
+ break;
+ }
+ IType superBinType = binType.getJavaProject().findType(fullSuperInterfaceName);
+ if(superBinType!=null &&
!allTypes.contains(superBinType.getFullyQualifiedName())) {
+ initType(superBinType, var, parent, originalParent, allTypes);
+ }
+ }
+ }
+
+ IType superBinType = getSuperclass(binType);
+ if(superBinType!=null &&
!allTypes.contains(superBinType.getFullyQualifiedName())) {
+ initType(superBinType, var, parent, originalParent, allTypes);
+ }
+ }
+
+ private void initType(IType binType, boolean var, TypeInfo parent, MemberInfo
originalParent, Collection<String> allTypes) throws JavaModelException {
+ TypeInfo superType = new TypeInfo(binType, originalParent, parent.isDataModel());
+ parent.setSuperType(superType);
+ allTypes.add(binType.getFullyQualifiedName());
+ initSuperTypes(binType, var, superType, originalParent, allTypes);
+ }
+
boolean isDataModelObject(IType type) throws JavaModelException {
return isInstanceofType(type, "javax.faces.model.DataModel"); //$NON-NLS-1$
}
@@ -983,25 +995,6 @@
return null;
}
- public static void initSuperinterfaces(IType type, Set<IType> result) throws
JavaModelException {
-// IType superType = getSuperclass(type);
-// if(superType)
- String[] superinterfaceNames = type.getSuperInterfaceNames();
- for (String superinterface : superinterfaceNames) {
- String fullySuperclassName = EclipseJavaUtil.resolveType(type, superinterface);
- if(fullySuperclassName!=null) {
- if(fullySuperclassName.equals(type.getFullyQualifiedName())) {
- break;
- }
- IType superType = type.getJavaProject().findType(fullySuperclassName);
- if(superType != null) {
- result.add(superType);
- initSuperinterfaces(superType, result);
- }
- }
- }
- }
-
public MethodInfo[] findMethodInfos(IMethod iMethod) {
List<MethodInfo> methods = new ArrayList<MethodInfo>();