Example usage for org.eclipse.jdt.internal.core.search TypeNameMatchRequestorWrapper TypeNameMatchRequestorWrapper

List of usage examples for org.eclipse.jdt.internal.core.search TypeNameMatchRequestorWrapper TypeNameMatchRequestorWrapper

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.search TypeNameMatchRequestorWrapper TypeNameMatchRequestorWrapper.

Prototype

public TypeNameMatchRequestorWrapper(TypeNameMatchRequestor requestor, IJavaSearchScope scope) 

Source Link

Usage

From source file:org.eclipse.jdt.core.search.SearchEngine.java

License:Open Source License

/**
 * Searches for all top-level types and member types in the given scope.
 * The search can be selecting specific types (given a package name using specific match mode
 * and/or a type name using another specific match mode).
 * <p>// ww w  .  java 2s. c o m
 * Provided {@link TypeNameMatchRequestor} requestor will collect {@link TypeNameMatch}
 * matches found during the search.
 * </p>
 *
 * @param packageName the full name of the package of the searched types, or a prefix for this
 *                  package, or a wild-carded string for this package.
 *                  May be <code>null</code>, then any package name is accepted.
 * @param packageMatchRule one of
 * <ul>
 *      <li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
 *         name are the full names of the searched types.</li>
 *      <li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
 *         name are prefixes of the names of the searched types.</li>
 *      <li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
 *         type name contain wild-cards.</li>
 *      <li>{@link SearchPattern#R_CAMELCASE_MATCH} if the package name is a
 *         camel case of the searched types package name.</li>
 *      <li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
 *         if the package name is a camel case with same part count of the searched
 *         types package name.</li>
 * </ul>
 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested,
 *   or {@link SearchPattern#R_PREFIX_MATCH} if a prefix non case sensitive match is requested.
 * @param typeName the dot-separated qualified name of the searched type (the qualification include
 *               the enclosing types if the searched type is a member type), or a prefix
 *               for this type, or a wild-carded string for this type.
 *               May be <code>null</code>, then any type name is accepted.
 * @param typeMatchRule one of
 * <ul>
 *      <li>{@link SearchPattern#R_EXACT_MATCH} if the package name and type
 *         name are the full names of the searched types.</li>
 *      <li>{@link SearchPattern#R_PREFIX_MATCH} if the package name and type
 *         name are prefixes of the names of the searched types.</li>
 *      <li>{@link SearchPattern#R_PATTERN_MATCH} if the package name and
 *         type name contain wild-cards.</li>
 *      <li>{@link SearchPattern#R_CAMELCASE_MATCH} if the type name is a
 *         camel case of the searched types name.</li>
 *      <li>{@link SearchPattern#R_CAMELCASE_SAME_PART_COUNT_MATCH}
 *         if the type name is a camel case with same part count of the searched
 *         types name.</li>
 * </ul>
 * combined with {@link SearchPattern#R_CASE_SENSITIVE},
 *   e.g. {@link SearchPattern#R_EXACT_MATCH} | {@link SearchPattern#R_CASE_SENSITIVE} if an exact and case sensitive match is requested,
 *   or {@link SearchPattern#R_PREFIX_MATCH} if a prefix non case sensitive match is requested.
 * @param searchFor determines the nature of the searched elements
 *   <ul>
 *    <li>{@link IJavaSearchConstants#CLASS}: only look for classes</li>
 *      <li>{@link IJavaSearchConstants#INTERFACE}: only look for interfaces</li>
 *    <li>{@link IJavaSearchConstants#ENUM}: only look for enumeration</li>
 *      <li>{@link IJavaSearchConstants#ANNOTATION_TYPE}: only look for annotation type</li>
 *    <li>{@link IJavaSearchConstants#CLASS_AND_ENUM}: only look for classes and enumerations</li>
 *      <li>{@link IJavaSearchConstants#CLASS_AND_INTERFACE}: only look for classes and interfaces</li>
 *    <li>{@link IJavaSearchConstants#TYPE}: look for all types (i.e. classes, interfaces, enum and annotation types)</li>
 *   </ul>
 * @param scope the scope to search in
 * @param nameMatchRequestor the {@link TypeNameMatchRequestor requestor} that collects
 *             {@link TypeNameMatch matches} of the search.
 * @param waitingPolicy one of
 * <ul>
 *      <li>{@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately</li>
 *      <li>{@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the
 *         underlying indexer has not finished indexing the workspace</li>
 *      <li>{@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the
 *         underlying indexer to finish indexing the workspace</li>
 * </ul>
 * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress
 *                     monitor is provided
 * @exception JavaModelException if the search failed. Reasons include:
 *   <ul>
 *      <li>the classpath is incorrectly set</li>
 *   </ul>
 * @since 3.3
 */
public void searchAllTypeNames(final char[] packageName, final int packageMatchRule, final char[] typeName,
        final int typeMatchRule, int searchFor, IJavaSearchScope scope,
        final TypeNameMatchRequestor nameMatchRequestor, int waitingPolicy, IProgressMonitor progressMonitor)
        throws JavaModelException {

    TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper(nameMatchRequestor,
            scope);
    this.basicEngine.searchAllTypeNames(packageName, packageMatchRule, typeName, typeMatchRule, searchFor,
            scope, requestorWrapper, waitingPolicy, progressMonitor);
}

From source file:org.eclipse.jdt.core.search.SearchEngine.java

License:Open Source License

/**
 * Searches for all top-level types and member types in the given scope matching any of the given qualifications
 * and type names in a case sensitive way.
 * <p>//  w w w.jav  a 2 s .co m
 * Provided {@link TypeNameMatchRequestor} requestor will collect {@link TypeNameMatch}
 * matches found during the search.
 * </p>
 *
 * @param qualifications the qualified name of the package/enclosing type of the searched types.
 *               May be <code>null</code>, then any package name is accepted.
 * @param typeNames the simple names of the searched types.
 *               If this parameter is <code>null</code>, then no type will be found.
 * @param scope the scope to search in
 * @param nameMatchRequestor the {@link TypeNameMatchRequestor requestor} that collects
 *             {@link TypeNameMatch matches} of the search.
 * @param waitingPolicy one of
 * <ul>
 *      <li>{@link IJavaSearchConstants#FORCE_IMMEDIATE_SEARCH} if the search should start immediately</li>
 *      <li>{@link IJavaSearchConstants#CANCEL_IF_NOT_READY_TO_SEARCH} if the search should be cancelled if the
 *         underlying indexer has not finished indexing the workspace</li>
 *      <li>{@link IJavaSearchConstants#WAIT_UNTIL_READY_TO_SEARCH} if the search should wait for the
 *         underlying indexer to finish indexing the workspace</li>
 * </ul>
 * @param progressMonitor the progress monitor to report progress to, or <code>null</code> if no progress
 *                     monitor is provided
 * @exception JavaModelException if the search failed. Reasons include:
 *   <ul>
 *      <li>the classpath is incorrectly set</li>
 *   </ul>
 * @since 3.3
 */
public void searchAllTypeNames(final char[][] qualifications, final char[][] typeNames, IJavaSearchScope scope,
        final TypeNameMatchRequestor nameMatchRequestor, int waitingPolicy, IProgressMonitor progressMonitor)
        throws JavaModelException {

    TypeNameMatchRequestorWrapper requestorWrapper = new TypeNameMatchRequestorWrapper(nameMatchRequestor,
            scope);
    this.basicEngine.searchAllTypeNames(qualifications, typeNames,
            SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, IJavaSearchConstants.TYPE, scope,
            requestorWrapper, waitingPolicy, progressMonitor);
}