org.aspectj.org.eclipse.jdt.internal.core
Class SearchableEnvironment

java.lang.Object
  extended by org.aspectj.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
protected  boolean checkAccessRestrictions
           
 NameLookup nameLookup
           
protected  WorkingCopyOwner owner
           
protected  JavaProject project
           
protected  IJavaSearchScope searchScope
           
protected  ICompilationUnit unitToSkip
           
protected  ICompilationUnit[] workingCopies
           
 
Fields inherited from interface org.aspectj.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.
protected  NameEnvironmentAnswer find(java.lang.String typeName, java.lang.String packageName)
          Returns the given type in the the given package if it exists, otherwise null.
 void findConstructorDeclarations(char[] prefix, boolean camelCaseMatch, ISearchRequestor storage, IProgressMonitor monitor)
          Must be used only by CompletionEngine.
 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.
 void findTypes(char[] prefix, boolean findMembers, boolean camelCaseMatch, int searchFor, ISearchRequestor storage, IProgressMonitor monitor)
          Must be used only by CompletionEngine.
 boolean isPackage(char[][] parentPackageName, char[] subPackageName)
          Answer whether packageName is the name of a known subpackage inside the package parentPackageName.
protected  java.lang.String toStringChar(char[] name)
          Returns a printable string for the array.
protected  java.lang.String toStringCharChar(char[][] names)
          Returns a printable string for the array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nameLookup

public NameLookup nameLookup

unitToSkip

protected ICompilationUnit unitToSkip

workingCopies

protected ICompilationUnit[] workingCopies

owner

protected WorkingCopyOwner owner

project

protected JavaProject project

searchScope

protected IJavaSearchScope searchScope

checkAccessRestrictions

protected boolean checkAccessRestrictions
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

find

protected NameEnvironmentAnswer find(java.lang.String typeName,
                                     java.lang.String packageName)
Returns the given type in the the given package if it exists, otherwise null.


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.


findTypes

public void findTypes(char[] prefix,
                      boolean findMembers,
                      boolean camelCaseMatch,
                      int searchFor,
                      ISearchRequestor storage,
                      IProgressMonitor monitor)
Must be used only by CompletionEngine. The progress monitor is used to be able to cancel completion operations 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.


findConstructorDeclarations

public void findConstructorDeclarations(char[] prefix,
                                        boolean camelCaseMatch,
                                        ISearchRequestor storage,
                                        IProgressMonitor monitor)
Must be used only by CompletionEngine. The progress monitor is used to be able to cancel completion operations Find constructor declarations 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 constructors found are passed to one of the following methods: ISearchRequestor.acceptConstructor(...)


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[])

toStringChar

protected java.lang.String toStringChar(char[] name)
Returns a printable string for the array.


toStringCharChar

protected java.lang.String toStringCharChar(char[][] names)
Returns a printable string for the array.


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