List of usage examples for org.eclipse.jdt.internal.core NameLookup findType
public Answer findType(String typeName, String packageName, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes, boolean waitForIndexes, boolean checkRestrictions, IProgressMonitor monitor)
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 ww w . j a v a 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.che.jdt.internal.core.JavaProject.java
License:Open Source License
IType findType(String packageName, String typeQualifiedName, NameLookup lookup, boolean considerSecondaryTypes, IProgressMonitor progressMonitor) throws JavaModelException { NameLookup.Answer answer = lookup.findType(typeQualifiedName, packageName, false, NameLookup.ACCEPT_ALL, considerSecondaryTypes, true, // wait for indexes (in case we need to consider secondary types) false/*don't check restrictions*/, progressMonitor); return answer == null ? null : answer.type; }
From source file:org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider.java
License:Open Source License
/** * @since 2.9/*from ww w . j a va2 s .c o m*/ */ protected IType findPrimaryType(String packageName, String typeName) throws JavaModelException { JavaProject casted = (JavaProject) javaProject; NameLookup nameLookup = getNameLookup(casted); NameLookup.Answer answer = nameLookup.findType(typeName, packageName, false, NameLookup.ACCEPT_ALL, false, // do not consider secondary types true, // wait for indexes (in case we need to consider secondary types) false/*don't check restrictions*/, null); return answer == null ? null : answer.type; }