diff options
Diffstat (limited to 'org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java')
-rw-r--r-- | org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java | 187 |
1 files changed, 66 insertions, 121 deletions
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java index 3df5910324..217f472543 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ISearchFactory.java @@ -1,62 +1,7 @@ package org.eclipse.jdt.internal.core.builder;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jdt.core.*;
-/**
- * <code>ISearchFactory</code> creates <code>ISearch</code> objects which can
- * search some subset of the image. These <code>ISearch</code> objects can
- * be configured with a name, a scope, and a search context.
- * <p>
- * <ul>
- * <li><b>Name:</b>
- * The name of the search specifies what the search is actually looking for.
- * It can be the name of a type, a field, a package, a method, or a constructor.
- * Searches for methods and constructors may also supply parameter and return
- * type information. Wildcarding is supported.
- * <li><b>Scope:</b>
- * The scope of the search defines the subset of the image that is to be searched.
- * Including a type in the scope includes all inner types, fields, methods and
- * constructors of that type in the search. Inner types also have all of their
- * inner types, fields, methods and constructors included in the scope of the
- * search, recursively. Including a package in the scope includes all types contained
- * in the package in the scope and, therefore, all inner types, fields, methods and
- * constructors. The items in the scope must belong to the same state as the
- * image from which this search engine was obtained. Results of the search will also
- * be in the same state as the image. If the image is non-state-specific, the
- * items in the scope must be non-state-specific as well. Furthermore, results
- * found by the search will also be non-state-specific.
- * <li><b>Context:</b>
- * The search context is defined using flags which specify whether the search is
- * looking for declarations or references. Furthermore, when looking for
- * references, the search can look either in the principle structure or the
- * source of each type in the search scope. The flags can be 'OR'ed
- * together to allow searches for declarations and references.
- * </ul>
- * <p>
- * <b>Example:</b><br>
- * Search for all references to a type named "String" in the scope of the
- * package "hanoiExample". Wait for the results, and then print them out.
- * <pre><code>
- * IImage image = dc.getImage();
- * ISearchFactory sf = image.newSearchFactory();
- * IHandle[] scope = {image.getPackageHandle("hanoiExample", false)};
- * ISearch search =
- * sf.searchForType(
- * "String",
- * scope,
- * ISearchFactory.SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS |
- * ISearchFactory.SEARCH_FOR_SOURCE_REFS);
- * search.run(); // perform the search
- * for (int i = 0; i < search.getItemCount(); i++)
- * System.out.println(search.getItem(i));
- * </code></pre>
- * @see ISearch
- */
public interface ISearchFactory
-{
+{
/* Flags for search context */
/**
@@ -90,26 +35,26 @@ public interface ISearchFactory * name.
* <p>
* <b>Example:</b> Searching for declarations of fields named <code>width</code>
- * in package <code>java.awt</code>.
+ * in package <code>java.awt</code>.
* <pre><code>
* IImage image = dc.getImage();
* ISearchFactory sf = image.newSearchFactory();
* IHandle[] scope = {image.getPackageHandle("java.awt", false)};
* ISearch search =
- * sf.searchForField(
- * "width",
- * scope,
- * ISearchFactory.SEARCH_FOR_DECLS);
+ * sf.searchForField(
+ * "width",
+ * scope,
+ * ISearchFactory.SEARCH_FOR_DECLS);
* search.run();
* </code></pre>
* @param fieldName the name of the field to search for, possibly containing
- * wildcards ("*")
+ * wildcards ("*")
* @param scope the packages and types to search in
* @param context the context flags. SEARCH_FOR_DECLS, and
- * SEARCH_FOR_SOURCE_REFS are valid flags for field searches.
- * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect on
- * the search because there are no field references in the principle
- * structure.
+ * SEARCH_FOR_SOURCE_REFS are valid flags for field searches.
+ * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect on
+ * the search because there are no field references in the principle
+ * structure.
*
*
* @see ISearch
@@ -127,34 +72,34 @@ ISearch searchForField( * <b>Example:</b> Search for declarations of methods named <code>toString</code>
* whose second argument is <code>int</code>. The search will be conducted
* in the scope of the <code>hanoiExample</code> package.
- * <code><pre>
+ * <code><pre>
* IImage image = dc.getImage();
* ISearchFactory factory = image.newSearchFactory();
* IHandle[] scope = {image.getPackageHandle("hanoiExample")};
* ISearch search =
- * factory.searchForMethod(
- * "toString",
- * new String[] {"*", "int"},
- * "*",
- * scope,
- * SEARCH_FOR_DECLS);
+ * factory.searchForMethod(
+ * "toString",
+ * new String[] {"*", "int"},
+ * "*",
+ * scope,
+ * SEARCH_FOR_DECLS);
* search.run();
- * </code></pre>
+ * </code></pre>
* <br>
* @param methodName the method name to search for, possibly containing wildcards ("*")
* @param paramTypes the names of parameter types the method being searched for must
- * have, possibly containing wildcards. An empty array indicates a method with
- * zero parameters.
+ * have, possibly containing wildcards. An empty array indicates a method with
+ * zero parameters.
* @param returnType the name of the return type the method being
- * searched for must have, possibly containing wildcards. A return type
- * of "*" effectively ignores the return type.
+ * searched for must have, possibly containing wildcards. A return type
+ * of "*" effectively ignores the return type.
* @param scope the packages and types to search in
* @param context the context flags. SEARCH_FOR_DECLS make sense as a flag for
- * this method search. Using SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will have no effect since methods
- * cannot be referenced in the principle structure. When searching the source,
- * SEARCH_FOR_SOURCE_REFS will ignore the return type, and only use the
- * number of parameters, not the parameter types. This is because at the source
- * level only the method name and number of parameters are
+ * this method search. Using SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will have no effect since methods
+ * cannot be referenced in the principle structure. When searching the source,
+ * SEARCH_FOR_SOURCE_REFS will ignore the return type, and only use the
+ * number of parameters, not the parameter types. This is because at the source
+ * level only the method name and number of parameters are
* known.
* @see ISearch
*/
@@ -175,50 +120,50 @@ ISearch searchForMethod( * which have 2 arguments. The search will be conducted in the scope of the <code>hanoiExample</code>
* package. Note that the principle structure is not searched for references
* since it never contains information about references to methods.
- * <code><pre>
+ * <code><pre>
* IImage image = dc.getImage();
* ISearchFactory factory = image.newSearchFactory();
* IHandle[] scope = {image.getPackageHandle("hanoiExample")};
* ISearch search =
- * factory.searchForMethod(
- * "add",
- * 2,
- * "*",
- * scope,
- * SEARCH_FOR_DECLS |
- * SEARCH_FOR_SOURCE_REFS);
+ * factory.searchForMethod(
+ * "add",
+ * 2,
+ * "*",
+ * scope,
+ * SEARCH_FOR_DECLS |
+ * SEARCH_FOR_SOURCE_REFS);
* search.run();
- * </code></pre>
+ * </code></pre>
* <br>
* <b>Example 2:</b> Search for references to a constructor for a class named
* <code>Disk</code> which takes any number of arguments. The search will be conducted in
* the scope of the <code>hanoiExample</code> package. Note that the principle structure is not searched for references
* since it never contains information about references to methods.
- * <code><pre>
+ * <code><pre>
* IImage image = dc.getImage();
* ISearchFactory factory = image.newSearchFactory();
* IHandle[] scope = {image.getPackageHandle("hanoiExample")};
* ISearch search =
- * factory.searchForMethod(
- * "Disk",
- * -1,
- * "", // return type ignored for constructors
- * scope,
- * SEARCH_FOR_SOURCE_REFS);
+ * factory.searchForMethod(
+ * "Disk",
+ * -1,
+ * "", // return type ignored for constructors
+ * scope,
+ * SEARCH_FOR_SOURCE_REFS);
* search.run();
- * </code></pre>
+ * </code></pre>
*
* @param methodName the method name to search for, possibly containing wildcards ("*")
* @param parameterCount the number of parameters the method being
- * searched for has. Use -1 if number of parameters doesn't matter
+ * searched for has. Use -1 if number of parameters doesn't matter
* @param returnType the name of the return type the method being
- * searched for must have, possibly containing wildcards. A return type of
- * "*" effectively ignores return type.
+ * searched for must have, possibly containing wildcards. A return type of
+ * "*" effectively ignores return type.
* @param scope the packages and types to search in
* @param context the context flags. SEARCH_FOR_DECLS and
- * SEARCH_FOR_SOURCE_REFS make sense as flags for this method search.
- * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect since
- * principle structures cannot reference methods.
+ * SEARCH_FOR_SOURCE_REFS make sense as flags for this method search.
+ * SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS will not have any effect since
+ * principle structures cannot reference methods.
*
* @see ISearch
*/
@@ -241,21 +186,21 @@ ISearch searchForMethod( * ISearchFactory sf = image.newSearchFactory();
* IHandle[] scope = {image.getPackageHandle("hanoiExample", false)};
* ISearch search =
- * sf.searchForPackage(
- * "java.aw*",
- * scope,
- * ISearchFactory.SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS |
- * ISearchFactory.SEARCH_FOR_SOURCE_REFS);
+ * sf.searchForPackage(
+ * "java.aw*",
+ * scope,
+ * ISearchFactory.SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS |
+ * ISearchFactory.SEARCH_FOR_SOURCE_REFS);
* search.run();
* </code></pre>
*
* @param packageName the name of the package to search for, possibly
- * containing wildcards ("*")
+ * containing wildcards ("*")
* @param scope the packages and types to search in
* @param context the context flags. SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS,
- * and SEARCH_FOR_SOURCE_REFS make sense as flags for package
- * searches. Using SEARCH_FOR_DECLS will not have any effect because
- * packages are not declared anywhere.
+ * and SEARCH_FOR_SOURCE_REFS make sense as flags for package
+ * searches. Using SEARCH_FOR_DECLS will not have any effect because
+ * packages are not declared anywhere.
*
* @see ISearch
*/
@@ -275,17 +220,17 @@ ISearch searchForPackage( * ISearchFactory sf = image.newSearchFactory();
* IHandle[] scope = {image.getPackageHandle("hanoiExample", false)};
* ISearch search =
- * sf.searchForType(
- * "Post",
- * scope,
- * ISearchFactory.SEARCH_FOR_DECLS);
+ * sf.searchForType(
+ * "Post",
+ * scope,
+ * ISearchFactory.SEARCH_FOR_DECLS);
* search.run();
* </code></pre>
* @param typeName the simple name of the type to search for, possibly
- * containing wildcards ("*")
+ * containing wildcards ("*")
* @param scope the packages and types to search in
* @param context the context flags. SEARCH_FOR_DECLS, SEARCH_FOR_PRINCIPLE_STRUCTURE_REFS,
- * and SEARCH_FOR_SOURCE_REFS all make sense as flags for type searches.
+ * and SEARCH_FOR_SOURCE_REFS all make sense as flags for type searches.
*
* @see ISearch
*/
|