List of usage examples for org.eclipse.jdt.internal.core SingleTypeRequestor getType
public IType getType()
null if no type has been accepted. From source file:com.codenvy.ide.ext.java.server.internal.core.NameLookup.java
License:Open Source License
/** * Returns the first type in the given package whose name * matches the given (unqualified) name, or <code>null</code> if none * exist. Specifying a <code>null</code> package will result in no matches. * The domain of the search is bounded by the Java project from which * this name lookup was obtained.//from w w w . j av a 2s . c o m * * @param name * the name of the type to find * @param pkg * the package to search * @param partialMatch * partial name matches qualify when <code>true</code>, * only exact name matches qualify when <code>false</code> * @param acceptFlags * a bit mask describing if classes, interfaces or both classes and interfaces * are desired results. If no flags are specified, all types are returned. * @param considerSecondaryTypes * flag to know whether secondary types has to be considered * during the search * @see #ACCEPT_CLASSES * @see #ACCEPT_INTERFACES * @see #ACCEPT_ENUMS * @see #ACCEPT_ANNOTATIONS */ public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, boolean waitForIndices, boolean considerSecondaryTypes) { if (pkg == null) return null; SingleTypeRequestor typeRequestor = new SingleTypeRequestor(); seekTypes(name, pkg, partialMatch, acceptFlags, typeRequestor, considerSecondaryTypes); IType type = typeRequestor.getType(); if (type == null && considerSecondaryTypes) { type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), waitForIndices, null); } return type; }
From source file:com.codenvy.ide.ext.java.server.internal.core.NameLookup.java
License:Open Source License
/** * Returns the first type in the given package whose name * matches the given (unqualified) name, or <code>null</code> if none * exist. Specifying a <code>null</code> package will result in no matches. * The domain of the search is bounded by the Java project from which * this name lookup was obtained.//from www . j a v a 2 s . c o m * <br> * Note that this method does not find secondary types. * <br> * * @param name * the name of the type to find * @param pkg * the package to search * @param partialMatch * partial name matches qualify when <code>true</code>, * only exact name matches qualify when <code>false</code> * @param acceptFlags * a bit mask describing if classes, interfaces or both classes and interfaces * are desired results. If no flags are specified, all types are returned. * @see #ACCEPT_CLASSES * @see #ACCEPT_INTERFACES * @see #ACCEPT_ENUMS * @see #ACCEPT_ANNOTATIONS */ public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags) { if (pkg == null) return null; // Return first found (ignore duplicates). SingleTypeRequestor typeRequestor = new SingleTypeRequestor(); seekTypes(name, pkg, partialMatch, acceptFlags, typeRequestor, false); return typeRequestor.getType(); }