public class SearchableEnvironment extends java.lang.Object implements IModuleAwareNameEnvironment, IJavaSearchConstants
SearchableBuilderEnvironment for code assist which
uses the Java model as a search tool.IModuleAwareNameEnvironment.LookupStrategy| Modifier and Type | Field and Description |
|---|---|
protected boolean |
checkAccessRestrictions |
NameLookup |
nameLookup |
protected WorkingCopyOwner |
owner |
protected JavaProject |
project |
protected IJavaSearchScope |
searchScope |
protected ICompilationUnit |
unitToSkip |
protected ICompilationUnit[] |
workingCopies |
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, 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 and Description |
|---|
SearchableEnvironment(JavaProject project,
ICompilationUnit[] workingCopies)
Deprecated.
|
SearchableEnvironment(JavaProject project,
ICompilationUnit[] workingCopies,
boolean excludeTestCode)
Creates a SearchableEnvironment on the given project
|
SearchableEnvironment(JavaProject project,
WorkingCopyOwner owner)
Deprecated.
|
SearchableEnvironment(JavaProject project,
WorkingCopyOwner owner,
boolean excludeTestCode)
Creates a SearchableEnvironment on the given project
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyModuleUpdates(IUpdatableModule module,
IUpdatableModule.UpdateKind kind)
Ask the name environment to perform any updates (add-exports or add-reads) to the given module.
|
void |
cleanup()
This method cleans the environment.
|
protected NameEnvironmentAnswer |
find(java.lang.String typeName,
java.lang.String packageName,
IPackageFragmentRoot[] moduleContext)
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 |
findModules(char[] prefix,
ISearchRequestor requestor,
IJavaProject javaProject)
Find the modules that start with the given prefix.
|
void |
findPackages(char[] prefix,
ISearchRequestor requestor)
Find the packages that start with the given prefix.
|
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.
|
NameEnvironmentAnswer |
findType(char[][] compoundTypeName,
char[] moduleName) |
NameEnvironmentAnswer |
findType(char[] name,
char[][] packageName,
char[] moduleName)
Answer a type identified by the given names.
|
NameEnvironmentAnswer |
findTypeInModules(char[][] compoundTypeName,
ModuleBinding module)
Find a type in the given module or any module read by it.
|
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.
|
char[][] |
getAllAutomaticModules() |
IModule |
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) |
boolean |
hasCompilationUnit(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 for
IModuleAwareNameEnvironment.LookupStrategy.Named). |
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindType, findType, getUniqueModulesDeclaringPackage, isPackagepublic NameLookup nameLookup
protected ICompilationUnit unitToSkip
protected ICompilationUnit[] workingCopies
protected WorkingCopyOwner owner
protected JavaProject project
protected IJavaSearchScope searchScope
protected boolean checkAccessRestrictions
@Deprecated public SearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies) throws JavaModelException
JavaModelExceptionpublic SearchableEnvironment(JavaProject project, ICompilationUnit[] workingCopies, boolean excludeTestCode) throws JavaModelException
JavaModelException@Deprecated public SearchableEnvironment(JavaProject project, WorkingCopyOwner owner) throws JavaModelException
JavaModelExceptionpublic SearchableEnvironment(JavaProject project, WorkingCopyOwner owner, boolean excludeTestCode) throws JavaModelException
JavaModelExceptionprotected NameEnvironmentAnswer find(java.lang.String typeName, java.lang.String packageName, IPackageFragmentRoot[] moduleContext)
null.public void findModules(char[] prefix,
ISearchRequestor requestor,
IJavaProject javaProject)
public void findPackages(char[] prefix,
ISearchRequestor requestor)
public void findPackages(char[] prefix,
ISearchRequestor requestor,
IPackageFragmentRoot[] moduleContext,
boolean followRequires)
public void findExactTypes(char[] name,
boolean findMembers,
int searchFor,
ISearchRequestor storage)
public NameEnvironmentAnswer findTypeInModules(char[][] compoundTypeName, ModuleBinding module)
compoundTypeName - name of the sought typemodule - start into the module graphpublic NameEnvironmentAnswer findType(char[][] compoundTypeName, char[] moduleName)
findType in interface IModuleAwareNameEnvironmentIModuleAwareNameEnvironment.findType(char[][],char[])public NameEnvironmentAnswer findType(char[] name, char[][] packageName, char[] moduleName)
IModuleAwareNameEnvironmentfindType in interface IModuleAwareNameEnvironmentIModuleAwareNameEnvironment.findType(char[],char[][],char[])public void findTypes(char[] prefix,
boolean findMembers,
boolean camelCaseMatch,
int searchFor,
ISearchRequestor storage)
public void findTypes(char[] prefix,
boolean findMembers,
boolean camelCaseMatch,
int searchFor,
ISearchRequestor storage,
IProgressMonitor monitor)
public void findConstructorDeclarations(char[] prefix,
boolean camelCaseMatch,
ISearchRequestor storage,
IProgressMonitor monitor)
public char[][] getModulesDeclaringPackage(char[][] packageName,
char[] moduleName)
getModulesDeclaringPackage in interface IModuleAwareNameEnvironmentIModuleAwareNameEnvironment.getModulesDeclaringPackage(char[][], char[])public boolean hasCompilationUnit(char[][] pkgName,
char[] moduleName,
boolean checkCUs)
IModuleAwareNameEnvironmenthasCompilationUnit in interface IModuleAwareNameEnvironmentcheckCUs - - if true, check contained Compilation Units for a matching package declarationprotected java.lang.String toStringChar(char[] name)
protected java.lang.String toStringCharChar(char[][] names)
public void cleanup()
INameEnvironmentcleanup in interface INameEnvironmentpublic IModule getModule(char[] name)
IModuleAwareNameEnvironmentgetModule in interface IModuleAwareNameEnvironmentpublic char[][] getAllAutomaticModules()
getAllAutomaticModules in interface IModuleAwareNameEnvironmentpublic void applyModuleUpdates(IUpdatableModule module, IUpdatableModule.UpdateKind kind)
IModuleAwareNameEnvironmentapplyModuleUpdates in interface IModuleAwareNameEnvironmentmodule - the compiler representation of the module to updateskind - selects what kind of updates should be performedpublic static IPackageFragmentRoot[] getOwnedPackageFragmentRoots(IJavaProject javaProject) throws JavaModelException
JavaModelExceptionpublic char[][] listPackages(char[] moduleName)
IModuleAwareNameEnvironmentIModuleAwareNameEnvironment.LookupStrategy.Named).listPackages in interface IModuleAwareNameEnvironment