org.eclipse.jdt.internal.core
Class SearchableEnvironment

java.lang.Object
  extended by org.eclipse.jdt.internal.core.SearchableEnvironment
All Implemented Interfaces:
IJavaSearchConstants, INameEnvironment
Direct Known Subclasses:
CancelableNameEnvironment

public class SearchableEnvironment
extends java.lang.Object
implements INameEnvironment, IJavaSearchConstants

This class provides a SearchableBuilderEnvironment for code assist which uses the Java model as a search tool.


Field Summary
 NameLookup nameLookup
           
 
Fields inherited from interface org.eclipse.jdt.core.search.IJavaSearchConstants
ALL_OCCURRENCES, ANNOTATION_TYPE, ANNOTATION_TYPE_REFERENCE, CANCEL_IF_NOT_READY_TO_SEARCH, CASE_INSENSITIVE, CASE_SENSITIVE, CAST_TYPE_REFERENCE, CATCH_TYPE_REFERENCE, CLASS, CLASS_AND_ENUM, CLASS_AND_INTERFACE, CLASS_INSTANCE_CREATION_TYPE_REFERENCE, CONSTRUCTOR, DECLARATIONS, ENUM, EXACT_MATCH, FIELD, FIELD_DECLARATION_TYPE_REFERENCE, FORCE_IMMEDIATE_SEARCH, IGNORE_DECLARING_TYPE, IGNORE_RETURN_TYPE, IMPLEMENTORS, IMPLICIT_THIS_REFERENCE, IMPORT_DECLARATION_TYPE_REFERENCE, INSTANCEOF_TYPE_REFERENCE, INTERFACE, INTERFACE_AND_ANNOTATION, LOCAL_VARIABLE_DECLARATION_TYPE_REFERENCE, METHOD, PACKAGE, PARAMETER_DECLARATION_TYPE_REFERENCE, PATTERN_MATCH, PREFIX_MATCH, QUALIFIED_REFERENCE, READ_ACCESSES, REFERENCES, RETURN_TYPE_REFERENCE, SUPER_REFERENCE, SUPERTYPE_TYPE_REFERENCE, THIS_REFERENCE, THROWS_CLAUSE_TYPE_REFERENCE, TYPE, TYPE_ARGUMENT_TYPE_REFERENCE, TYPE_VARIABLE_BOUND_TYPE_REFERENCE, UNKNOWN, WAIT_UNTIL_READY_TO_SEARCH, WILDCARD_BOUND_TYPE_REFERENCE, WRITE_ACCESSES
 
Constructor Summary
SearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies)
          Creates a SearchableEnvironment on the given project
SearchableEnvironment(JavaProject project, WorkingCopyOwner owner)
          Creates a SearchableEnvironment on the given project
 
Method Summary
 void cleanup()
          This method cleans the environment uo.
 void findExactTypes(char[] name, boolean findMembers, int searchFor, ISearchRequestor storage)
          Find the top-level types that are defined in the current environment and whose simple name matches the given name.
 void findPackages(char[] prefix, ISearchRequestor requestor)
          Find the packages that start with the given prefix.
 NameEnvironmentAnswer findType(char[][] compoundTypeName)
          Find a type with the given compound name.
 NameEnvironmentAnswer findType(char[] name, char[][] packageName)
          Find a type named in the package .
 void findTypes(char[] prefix, boolean findMembers, boolean camelCaseMatch, int searchFor, ISearchRequestor storage)
          Find the top-level types that are defined in the current environment and whose name starts with the given prefix.
 boolean isPackage(char[][] parentPackageName, char[] subPackageName)
          Answer whether packageName is the name of a known subpackage inside the package parentPackageName.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nameLookup

public NameLookup nameLookup
Constructor Detail

SearchableEnvironment

public SearchableEnvironment(JavaProject project,
                             ICompilationUnit[] workingCopies)
                      throws JavaModelException
Creates a SearchableEnvironment on the given project

Throws:
JavaModelException

SearchableEnvironment

public SearchableEnvironment(JavaProject project,
                             WorkingCopyOwner owner)
                      throws JavaModelException
Creates a SearchableEnvironment on the given project

Throws:
JavaModelException
Method Detail

findPackages

public void findPackages(char[] prefix,
                         ISearchRequestor requestor)
Find the packages that start with the given prefix. A valid prefix is a qualified name separated by periods (ex. java.util). The packages found are passed to: ISearchRequestor.acceptPackage(char[][] packageName)


findExactTypes

public void findExactTypes(char[] name,
                           boolean findMembers,
                           int searchFor,
                           ISearchRequestor storage)
Find the top-level types that are defined in the current environment and whose simple name matches the given name. The types found are passed to one of the following methods (if additional information is known about the types): ISearchRequestor.acceptType(char[][] packageName, char[] typeName) ISearchRequestor.acceptClass(char[][] packageName, char[] typeName, int modifiers) ISearchRequestor.acceptInterface(char[][] packageName, char[] typeName, int modifiers) This method can not be used to find member types... member types are found relative to their enclosing type.


findType

public NameEnvironmentAnswer findType(char[][] compoundTypeName)
Description copied from interface: INameEnvironment
Find a type with the given compound name. Answer the binary form of the type if it is known to be consistent. Otherwise, answer the compilation unit which defines the type or null if the type does not exist. Types in the default package are specified as {{typeName}}. It is unknown whether the package containing the type actually exists. NOTE: This method can be used to find a member type using its internal name A$B, but the source file for A is answered if the binary file is inconsistent.

Specified by:
findType in interface INameEnvironment
See Also:
INameEnvironment.findType(char[][])

findType

public NameEnvironmentAnswer findType(char[] name,
                                      char[][] packageName)
Description copied from interface: INameEnvironment
Find a type named in the package . Answer the binary form of the type if it is known to be consistent. Otherwise, answer the compilation unit which defines the type or null if the type does not exist. The default package is indicated by char[0][]. It is known that the package containing the type exists. NOTE: This method can be used to find a member type using its internal name A$B, but the source file for A is answered if the binary file is inconsistent.

Specified by:
findType in interface INameEnvironment
See Also:
INameEnvironment.findType(char[], char[][])

findTypes

public void findTypes(char[] prefix,
                      boolean findMembers,
                      boolean camelCaseMatch,
                      int searchFor,
                      ISearchRequestor storage)
Find the top-level types that are defined in the current environment and whose name starts with the given prefix. The prefix is a qualified name separated by periods or a simple name (ex. java.util.V or V). The types found are passed to one of the following methods (if additional information is known about the types): ISearchRequestor.acceptType(char[][] packageName, char[] typeName) ISearchRequestor.acceptClass(char[][] packageName, char[] typeName, int modifiers) ISearchRequestor.acceptInterface(char[][] packageName, char[] typeName, int modifiers) This method can not be used to find member types... member types are found relative to their enclosing type.


isPackage

public boolean isPackage(char[][] parentPackageName,
                         char[] subPackageName)
Description copied from interface: INameEnvironment
Answer whether packageName is the name of a known subpackage inside the package parentPackageName. A top level package is found relative to null. The default package is always assumed to exist. For example: isPackage({{java}, {awt}}, {event}); isPackage(null, {java});

Specified by:
isPackage in interface INameEnvironment
See Also:
INameEnvironment.isPackage(char[][], char[])

cleanup

public void cleanup()
Description copied from interface: INameEnvironment
This method cleans the environment uo. It is responsible for releasing the memory and freeing resources. Passed that point, the name environment is no longer usable. A name environment can have a long life cycle, therefore it is the responsibility of the code which created it to decide when it is a good time to clean it up.

Specified by:
cleanup in interface INameEnvironment