List of usage examples for org.eclipse.jdt.internal.core NameLookup ACCEPT_INTERFACES
int ACCEPT_INTERFACES
To view the source code for org.eclipse.jdt.internal.core NameLookup ACCEPT_INTERFACES.
Click Source Link
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.JavaSearchNameEnvironment.java
License:Open Source License
private static int convertSearchFilterToModelFilter(int searchFilter) { switch (searchFilter) { case org.eclipse.jdt.core.search.IJavaSearchConstants.CLASS: return NameLookup.ACCEPT_CLASSES; case org.eclipse.jdt.core.search.IJavaSearchConstants.INTERFACE: return NameLookup.ACCEPT_INTERFACES; case org.eclipse.jdt.core.search.IJavaSearchConstants.ENUM: return NameLookup.ACCEPT_ENUMS; case org.eclipse.jdt.core.search.IJavaSearchConstants.ANNOTATION_TYPE: return NameLookup.ACCEPT_ANNOTATIONS; case org.eclipse.jdt.core.search.IJavaSearchConstants.CLASS_AND_ENUM: return NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_ENUMS; case org.eclipse.jdt.core.search.IJavaSearchConstants.CLASS_AND_INTERFACE: return NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_INTERFACES; default:/* ww w . j a va2s. c om*/ return NameLookup.ACCEPT_ALL; } }
From source file:com.codenvy.ide.ext.java.server.internal.core.search.matching.MatchLocator.java
License:Open Source License
protected IType lookupType(ReferenceBinding typeBinding) { if (typeBinding == null || !typeBinding.isValidBinding()) return null; char[] packageName = typeBinding.qualifiedPackageName(); IPackageFragment[] pkgs = this.nameLookup.findPackageFragments( (packageName == null || packageName.length == 0) ? IPackageFragment.DEFAULT_PACKAGE_NAME : new String(packageName), false);// w w w.j a v a 2 s .c om // iterate type lookup in each package fragment char[] sourceName = typeBinding.qualifiedSourceName(); String typeName = new String(sourceName); int acceptFlag = 0; if (typeBinding.isAnnotationType()) { acceptFlag = NameLookup.ACCEPT_ANNOTATIONS; } else if (typeBinding.isEnum()) { acceptFlag = NameLookup.ACCEPT_ENUMS; } else if (typeBinding.isInterface()) { acceptFlag = NameLookup.ACCEPT_INTERFACES; } else if (typeBinding.isClass()) { acceptFlag = NameLookup.ACCEPT_CLASSES; } if (pkgs != null) { for (int i = 0, length = pkgs.length; i < length; i++) { IType type = this.nameLookup.findType(typeName, pkgs[i], false, acceptFlag, true/*consider secondary types*/); if (type != null) return type; } } // search inside enclosing element char[][] qualifiedName = CharOperation.splitOn('.', sourceName); int length = qualifiedName.length; if (length == 0) return null; IType type = createTypeHandle(new String(qualifiedName[0])); // find the top-level type if (type == null) return null; for (int i = 1; i < length; i++) { type = type.getType(new String(qualifiedName[i])); if (type == null) return null; } if (type.exists()) return type; return null; }
From source file:org.eclipse.ajdt.internal.ui.refactoring.PushInRefactoring.java
License:Open Source License
private IType findType(String packageName, String simpleName, IType type) throws JavaModelException { NameLookup lookup = getLookup(type); Answer answer = lookup.findType(simpleName, packageName, false, NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_INTERFACES, true, false, false, null); if (answer != null) { return answer.type; }/*from w w w . java 2 s .co m*/ // might be an inner type int dotIndex = packageName.lastIndexOf('.'); if (dotIndex > 0) { IType foundType = findType(packageName.substring(0, dotIndex), packageName.substring(dotIndex + 1), type); if (foundType != null && foundType.getType(simpleName).exists()) { return foundType.getType(simpleName); } } return null; }
From source file:org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.java
License:Open Source License
/** * Looks up and returns a handle for the given binary info. *///from w w w . j a va 2 s . c o m protected IType lookupBinaryHandle(IBinaryType typeInfo) { int flag; String qualifiedName; switch (TypeDeclaration.kind(typeInfo.getModifiers())) { case TypeDeclaration.CLASS_DECL: flag = NameLookup.ACCEPT_CLASSES; break; case TypeDeclaration.INTERFACE_DECL: flag = NameLookup.ACCEPT_INTERFACES; break; case TypeDeclaration.ENUM_DECL: flag = NameLookup.ACCEPT_ENUMS; break; default: //case IGenericType.ANNOTATION : flag = NameLookup.ACCEPT_ANNOTATIONS; break; } char[] bName = typeInfo.getName(); qualifiedName = new String(ClassFile.translatedName(bName)); if (qualifiedName.equals(this.focusQualifiedName)) return getType(); NameLookup.Answer answer = this.nameLookup.findType(qualifiedName, false, flag, true/* consider secondary types */, false/* do NOT wait for indexes */, false/*don't check restrictions*/, null); return answer == null || answer.type == null || !answer.type.isBinary() ? null : answer.type; }
From source file:org.eclipse.jdt.internal.core.search.matching.MatchLocator.java
License:Open Source License
protected IType lookupType(ReferenceBinding typeBinding) { if (typeBinding == null) return null; char[] packageName = typeBinding.qualifiedPackageName(); IPackageFragment[] pkgs = this.nameLookup.findPackageFragments( (packageName == null || packageName.length == 0) ? IPackageFragment.DEFAULT_PACKAGE_NAME : new String(packageName), false);//ww w. j ava 2s. c o m // iterate type lookup in each package fragment char[] sourceName = typeBinding.qualifiedSourceName(); String typeName = new String(sourceName); int acceptFlag = 0; if (typeBinding.isAnnotationType()) { acceptFlag = NameLookup.ACCEPT_ANNOTATIONS; } else if (typeBinding.isEnum()) { acceptFlag = NameLookup.ACCEPT_ENUMS; } else if (typeBinding.isInterface()) { acceptFlag = NameLookup.ACCEPT_INTERFACES; } else if (typeBinding.isClass()) { acceptFlag = NameLookup.ACCEPT_CLASSES; } if (pkgs != null) { for (int i = 0, length = pkgs.length; i < length; i++) { IType type = this.nameLookup.findType(typeName, pkgs[i], false, acceptFlag, true/*consider secondary types*/); if (type != null) return type; } } // search inside enclosing element char[][] qualifiedName = CharOperation.splitOn('.', sourceName); int length = qualifiedName.length; if (length == 0) return null; IType type = createTypeHandle(new String(qualifiedName[0])); // find the top-level type if (type == null) return null; for (int i = 1; i < length; i++) { type = type.getType(new String(qualifiedName[i])); if (type == null) return null; } if (type.exists()) return type; return null; }