List of usage examples for org.eclipse.jdt.internal.core NameLookup ACCEPT_ALL
int ACCEPT_ALL
To view the source code for org.eclipse.jdt.internal.core NameLookup ACCEPT_ALL.
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:/*from w w w . j av a2s. com*/ return NameLookup.ACCEPT_ALL; } }
From source file:org.codehaus.groovy.eclipse.dsl.inferencing.suggestions.AbstractJavaTypeVerifiedRule.java
License:Apache License
protected IType getActualType(String name) throws JavaModelException { NameLookup nameLkUp = getNameLookup(); if (nameLkUp != null) { return nameLkUp.findType(name, false, NameLookup.ACCEPT_ALL); }//from w w w . ja v a 2 s .co m return null; }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
/** * @see IJavaProject#findElement(IPath, WorkingCopyOwner) *//*from www. ja v a 2 s. c o m*/ public IJavaElement findElement(IPath path, WorkingCopyOwner owner) throws JavaModelException { if (path == null || path.isAbsolute()) { throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, path)); } try { String extension = path.getFileExtension(); if (extension == null) { String packageName = path.toString().replace(IPath.SEPARATOR, '.'); return findPackageFragment(packageName); } else if (Util.isJavaLikeFileName(path.lastSegment()) || extension.equalsIgnoreCase(EXTENSION_class)) { IPath packagePath = path.removeLastSegments(1); String packageName = packagePath.toString().replace(IPath.SEPARATOR, '.'); String typeName = path.lastSegment(); typeName = typeName.substring(0, typeName.length() - extension.length() - 1); String qualifiedName = null; if (packageName.length() > 0) { qualifiedName = packageName + "." + typeName; //$NON-NLS-1$ } else { qualifiedName = typeName; } // lookup type NameLookup lookup = newNameLookup(owner); NameLookup.Answer answer = lookup.findType(qualifiedName, false, NameLookup.ACCEPT_ALL, true/* consider secondary types */, false/* do NOT wait for indexes */, false/*don't check restrictions*/, null); if (answer != null) { return answer.type.getParent(); } else { return null; } } else { // unsupported extension return null; } } catch (JavaModelException e) { if (e.getStatus().getCode() == IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST) { return null; } else { throw e; } } }
From source file:org.eclipse.jdt.internal.core.JavaProject.java
License:Open Source License
IType findType(String fullyQualifiedName, NameLookup lookup, boolean considerSecondaryTypes, IProgressMonitor progressMonitor) throws JavaModelException { NameLookup.Answer answer = lookup.findType(fullyQualifiedName, false, NameLookup.ACCEPT_ALL, considerSecondaryTypes, true, /* wait for indexes (only if consider secondary types)*/ false/*don't check restrictions*/, progressMonitor); if (answer == null) { // try to find enclosing type int lastDot = fullyQualifiedName.lastIndexOf('.'); if (lastDot == -1) return null; IType type = findType(fullyQualifiedName.substring(0, lastDot), lookup, considerSecondaryTypes, progressMonitor);//from ww w . j a v a 2 s. c o m if (type != null) { type = type.getType(fullyQualifiedName.substring(lastDot + 1)); if (!type.exists()) { return null; } } return type; } return answer.type; }
From source file:org.eclipse.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 v a 2 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; }