Class SearchableEnvironment
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.SearchableEnvironment
- All Implemented Interfaces:
IJavaSearchConstants,IModuleAwareNameEnvironment,INameEnvironment
- Direct Known Subclasses:
CancelableNameEnvironment
public class SearchableEnvironment
extends Object
implements IModuleAwareNameEnvironment, IJavaSearchConstants
This class provides a
SearchableBuilderEnvironment for code assist which
uses the Java model as a search tool.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.aspectj.org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment
IModuleAwareNameEnvironment.LookupStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected WorkingCopyOwnerprotected JavaProjectprotected IJavaSearchScopeprotected ICompilationUnitprotected ICompilationUnit[]Fields inherited from interface org.aspectj.org.eclipse.jdt.core.search.IJavaSearchConstants
ALL_OCCURRENCES, ALL_UNNAMED, 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, METHOD_REFERENCE_EXPRESSION, MODULE, MODULE_GRAPH, PACKAGE, PARAMETER_DECLARATION_TYPE_REFERENCE, PATTERN_MATCH, PERMITTYPE_TYPE_REFERENCE, 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
ConstructorsConstructorDescriptionSearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies) Deprecated.SearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies, boolean excludeTestCode) Creates a SearchableEnvironment on the given projectSearchableEnvironment(JavaProject project, WorkingCopyOwner owner) Deprecated.SearchableEnvironment(JavaProject project, WorkingCopyOwner owner, boolean excludeTestCode) Creates a SearchableEnvironment on the given project -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyModuleUpdates(IUpdatableModule module, IUpdatableModule.UpdateKind kind) Ask the name environment to perform any updates (add-exports or add-reads) to the given module.voidcleanup()This method cleans the environment.protected NameEnvironmentAnswerfind(String typeName, String packageName, IPackageFragmentRoot[] moduleContext) Returns the given type in the the given package if it exists, otherwisenull.voidfindConstructorDeclarations(char[] prefix, int matchRule, boolean resolveDocumentName, ISearchRequestor storage, org.eclipse.core.runtime.IProgressMonitor monitor) Must be used only by CompletionEngine.voidfindExactTypes(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.voidfindModules(char[] prefix, ISearchRequestor requestor, IJavaProject javaProject) Find the modules that start with the given prefix.voidfindPackages(char[] prefix, ISearchRequestor requestor) Find the packages that start with the given prefix.voidfindPackages(char[] prefix, ISearchRequestor requestor, IPackageFragmentRoot[] moduleContext, boolean followRequires) Find the packages that start with the given prefix and belong to the given module.findType(char[][] compoundTypeName, char[] moduleName) findType(char[] name, char[][] packageName, char[] moduleName) Answer a type identified by the given names.findTypeInModules(char[][] compoundTypeName, ModuleBinding module) Find a type in the given module or any module read by it.voidfindTypes(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.voidfindTypes(char[] prefix, boolean findMembers, int matchRule, int searchFor, boolean resolveDocumentName, ISearchRequestor storage, org.eclipse.core.runtime.IProgressMonitor monitor) Must be used only by CompletionEngine.voidfindTypes(char[] prefix, boolean findMembers, int matchRule, int searchFor, ISearchRequestor storage, org.eclipse.core.runtime.IProgressMonitor monitor) Must be used only by CompletionEngine.char[][]getModule(char[] name) Get the module with the given name, which must denote a named module.char[][]getModulesDeclaringPackage(char[][] packageName, char[] moduleName) static IPackageFragmentRoot[]getOwnedPackageFragmentRoots(IJavaProject javaProject) booleanhasCompilationUnit(char[][] pkgName, char[] moduleName, boolean checkCUs) Answer whether the given package (within the given module) contains any compilation unit.char[][]listPackages(char[] moduleName) Lists all packages in the module identified by the given, real module name (i.e., this method is implemented only forIModuleAwareNameEnvironment.LookupStrategy.Named).voidprotected StringtoStringChar(char[] name) Returns a printable string for the array.protected StringtoStringCharChar(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, waitMethods inherited from interface org.aspectj.org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment
findType, findType, getUniqueModulesDeclaringPackage, isPackage
-
Field Details
-
nameLookup
-
unitToSkip
-
workingCopies
-
owner
-
project
-
searchScope
-
checkAccessRestrictions
protected boolean checkAccessRestrictions
-
-
Constructor Details
-
SearchableEnvironment
@Deprecated public SearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies) throws JavaModelException Deprecated.- Throws:
JavaModelException
-
SearchableEnvironment
public SearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies, boolean excludeTestCode) throws JavaModelException Creates a SearchableEnvironment on the given project- Throws:
JavaModelException
-
SearchableEnvironment
@Deprecated public SearchableEnvironment(JavaProject project, WorkingCopyOwner owner) throws JavaModelException Deprecated.Note: this is required for (abandoned) Scala-IDE- Throws:
JavaModelException
-
SearchableEnvironment
public SearchableEnvironment(JavaProject project, WorkingCopyOwner owner, boolean excludeTestCode) throws JavaModelException Creates a SearchableEnvironment on the given project- Throws:
JavaModelException
-
-
Method Details
-
find
protected NameEnvironmentAnswer find(String typeName, String packageName, IPackageFragmentRoot[] moduleContext) Returns the given type in the the given package if it exists, otherwisenull. -
findModules
Find the modules 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.acceptModule(char[][] moduleName) -
findPackages
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) -
findPackages
public void findPackages(char[] prefix, ISearchRequestor requestor, IPackageFragmentRoot[] moduleContext, boolean followRequires) Find the packages that start with the given prefix and belong to the given module. 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. -
findTypeInModules
Find a type in the given module or any module read by it. Does not check accessibility / unique visibility, but returns the first observable type found.- Parameters:
compoundTypeName- name of the sought typemodule- start into the module graph- Returns:
- the answer :)
-
findType
- Specified by:
findTypein interfaceIModuleAwareNameEnvironment- See Also:
-
findType
Description copied from interface:IModuleAwareNameEnvironmentAnswer a type identified by the given names. moduleName may be one of the special names from ModuleBinding (ANY, ANY_NAMED, UNNAMED).- Specified by:
findTypein interfaceIModuleAwareNameEnvironment- See Also:
-
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, int matchRule, int searchFor, ISearchRequestor storage, org.eclipse.core.runtime.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. -
findTypes
public void findTypes(char[] prefix, boolean findMembers, int matchRule, int searchFor, boolean resolveDocumentName, ISearchRequestor storage, org.eclipse.core.runtime.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, int matchRule, boolean resolveDocumentName, ISearchRequestor storage, org.eclipse.core.runtime.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(...) -
getModulesDeclaringPackage
public char[][] getModulesDeclaringPackage(char[][] packageName, char[] moduleName) - Specified by:
getModulesDeclaringPackagein interfaceIModuleAwareNameEnvironment- See Also:
-
hasCompilationUnit
public boolean hasCompilationUnit(char[][] pkgName, char[] moduleName, boolean checkCUs) Description copied from interface:IModuleAwareNameEnvironmentAnswer whether the given package (within the given module) contains any compilation unit.- Specified by:
hasCompilationUnitin interfaceIModuleAwareNameEnvironment- Parameters:
checkCUs- - if true, check contained Compilation Units for a matching package declaration- Returns:
- true iff the package contains at least one compilation unit.
-
toStringChar
Returns a printable string for the array. -
toStringCharChar
Returns a printable string for the array. -
cleanup
public void cleanup()Description copied from interface:INameEnvironmentThis method cleans the environment. 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:
cleanupin interfaceINameEnvironment
-
getModule
Description copied from interface:IModuleAwareNameEnvironmentGet the module with the given name, which must denote a named module.- Specified by:
getModulein interfaceIModuleAwareNameEnvironment
-
getAllAutomaticModules
public char[][] getAllAutomaticModules()- Specified by:
getAllAutomaticModulesin interfaceIModuleAwareNameEnvironment
-
applyModuleUpdates
Description copied from interface:IModuleAwareNameEnvironmentAsk the name environment to perform any updates (add-exports or add-reads) to the given module.- Specified by:
applyModuleUpdatesin interfaceIModuleAwareNameEnvironment- Parameters:
module- the compiler representation of the module to updateskind- selects what kind of updates should be performed
-
getOwnedPackageFragmentRoots
public static IPackageFragmentRoot[] getOwnedPackageFragmentRoots(IJavaProject javaProject) throws JavaModelException - Throws:
JavaModelException
-
listPackages
public char[][] listPackages(char[] moduleName) Description copied from interface:IModuleAwareNameEnvironmentLists all packages in the module identified by the given, real module name (i.e., this method is implemented only forIModuleAwareNameEnvironment.LookupStrategy.Named).- Specified by:
listPackagesin interfaceIModuleAwareNameEnvironment- Returns:
- array of flat, dot-separated package names
-
printTimeSpent
public void printTimeSpent()
-