Class CancelableNameEnvironment
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.SearchableEnvironment
org.aspectj.org.eclipse.jdt.internal.core.CancelableNameEnvironment
- All Implemented Interfaces:
IJavaSearchConstants, IModuleAwareNameEnvironment, INameEnvironment, INameEnvironmentExtension, INameEnvironmentWithProgress
public class CancelableNameEnvironment
extends SearchableEnvironment
implements INameEnvironmentWithProgress
-
Nested Class Summary
Nested classes/interfaces inherited from interface IModuleAwareNameEnvironment
IModuleAwareNameEnvironment.LookupStrategyModifier and TypeInterfaceDescriptionstatic enumStrategies for searching types and packages in classpath locations and modules. -
Field Summary
Fields inherited from class SearchableEnvironment
checkAccessRestrictions, nameLookup, owner, project, searchScope, unitToSkip, workingCopiesModifier and TypeFieldDescriptionprotected booleanprotected WorkingCopyOwnerprotected JavaProjectprotected IJavaSearchScopeprotected ICompilationUnitprotected ICompilationUnit[]Fields inherited from interface 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_ACCESSESModifier and TypeFieldDescriptionstatic final intThe search result is a declaration, a reference, or an implementer of an interface.static final char[]The unnamed module is represented by this constant for making the intent explicit in searches involving modulesstatic final intThe searched element is an annotation type.static final intReturn only type references used as an annotation.static final intThe search operation throws anorg.eclipse.core.runtime.OperationCanceledExceptionif the underlying indexer has not finished indexing the workspace.static final booleanDeprecated.static final booleanDeprecated.Use the methods that take the matchMode withSearchPattern.R_CASE_SENSITIVEas a matchRule instead.static final intReturn only type references used in a cast expression.static final intReturn only type references used in a catch header.static final intThe searched element is a class.static final intThe searched element is a class or enum type.static final intThe searched element is a class or interface type.static final intReturn only type references used in class instance creation.static final intThe searched element is a constructor.static final intThe search result is a declaration.static final intThe searched element is an enum.static final intDeprecated.UseSearchPattern.R_EXACT_MATCHinstead.static final intThe searched element is a field.static final intReturn only type references used as the type of a field declaration.static final intThe search operation starts immediately, even if the underlying indexer has not finished indexing the workspace.static final intIgnore declaring type while searching result.static final intIgnore return type while searching result.static final intThe search result is a type that implements an interface or extends a class.static final intReturn only field accesses or method invocations without any qualification.static final intReturn only type references used in an import declaration.static final intReturn only type references used as a type of aninstanceofexpression.static final intThe searched element is an interface.static final intThe searched element is an interface or annotation type.static final intReturn only type references used as the type of a local variable declaration.static final intThe searched element is a method.static final intReturn only method reference expressions, e.g.static final intThe searched element is a module.static final intWhen searching for Type Declaration matches, and if a module is given, this will find type declaration matches in this module as well as the dependent module graph of the given module.static final intThe searched element is a package.static final intReturn only type references used as the type of a method parameter declaration.static final intDeprecated.UseSearchPattern.R_PATTERN_MATCHinstead.static final intReturn only type references used as a permit type (Java 17)static final intDeprecated.UseSearchPattern.R_PREFIX_MATCHinstead.static final intReturn only qualified field accesses or qualified method invocations.static final intWhen searching for field matches, it will exclusively find read accesses, as opposed to write accesses.static final intThe search result is a reference.static final intReturn only type references used as a method return type.static final intReturn only super field accesses or super method invocations (e.g.static final intReturn only type references used as a super type or as a super interface.static final intReturn only primary field accesses or primary method invocations (e.g.static final intReturn only type references used in a throws clause.static final intThe searched element is a type, which may include classes, interfaces, enums, and annotation types.static final intReturn only type references used as a type argument in a parameterized type or a parameterized method.static final intReturn only type references used as a type variable bound.static final intThe nature of searched element or the nature of match in unknown.static final intThe search operation waits for the underlying indexer to finish indexing the workspace before starting the search.static final intReturn only type references used as a wildcard bound.static final intWhen searching for field matches, it will exclusively find write accesses, as opposed to read accesses. -
Constructor Summary
ConstructorsConstructorDescriptionCancelableNameEnvironment(JavaProject project, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) CancelableNameEnvironment(JavaProject project, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor, boolean excludeTestCode, int release) -
Method Summary
Modifier and TypeMethodDescriptionvoidfindPackages(char[] prefix, ISearchRequestor requestor) Find the packages that start with the given prefix.findType(char[][] compoundTypeName) Find a type with the given compound name.findType(char[] name, char[][] packageName) Find a type named<typeName>in the package<packageName>.findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes, char[] moduleName) Find a type named<typeName>in the package<packageName>.voidfindTypes(char[] prefix, boolean findMembers, int matchRule, int searchFor, ISearchRequestor storage, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Must be used only by CompletionEngine.voidsetMonitor(org.eclipse.core.runtime.IProgressMonitor monitor) Set the monitor for the given name environment.Methods inherited from class SearchableEnvironment
applyModuleUpdates, cleanup, find, findConstructorDeclarations, findExactTypes, findModules, findPackages, findType, findType, findTypeInModules, findTypes, findTypes, getAllAutomaticModules, getModule, getModulesDeclaringPackage, getOwnedPackageFragmentRoots, hasCompilationUnit, isOnModulePath, listPackages, printTimeSpent, toStringChar, toStringCharCharModifier 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, 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.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.booleanIf this environment focusses on one IJavaProject answer if the given compilation unit is found on the module path, rather than the class path.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 Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IModuleAwareNameEnvironment
getUniqueModulesDeclaringPackage, isPackageModifier and TypeMethodDescriptiondefault char[][]getUniqueModulesDeclaringPackage(char[][] packageName, char[] moduleName) default booleanisPackage(char[][] parentPackageName, char[] packageName) Answer whether packageName is the name of a known subpackage inside the package parentPackageName.Methods inherited from interface INameEnvironmentExtension
findTypeModifier and TypeMethodDescriptiondefault NameEnvironmentAnswerfindType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes)
-
Constructor Details
-
CancelableNameEnvironment
public CancelableNameEnvironment(JavaProject project, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException - Throws:
JavaModelException
-
CancelableNameEnvironment
public CancelableNameEnvironment(JavaProject project, WorkingCopyOwner owner, org.eclipse.core.runtime.IProgressMonitor monitor, boolean excludeTestCode, int release) throws JavaModelException - Throws:
JavaModelException
-
-
Method Details
-
findPackages
Description copied from class:SearchableEnvironmentFind 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)- Overrides:
findPackagesin classSearchableEnvironment
-
findType
Description copied from interface:INameEnvironmentFind a type named<typeName>in the package<packageName>. 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:
findTypein interfaceIModuleAwareNameEnvironment- Specified by:
findTypein interfaceINameEnvironment
-
findType
Description copied from interface:INameEnvironmentFind 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:
findTypein interfaceIModuleAwareNameEnvironment- Specified by:
findTypein interfaceINameEnvironment
-
findType
public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes, char[] moduleName) Description copied from interface:INameEnvironmentExtensionFind a type named<typeName>in the package<packageName>. 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. The flag<searchWithSecondaryTypes>can be used to switch on/off the search for secondary types. This is useful because the search for secondary types may by very expensive regarding the performance and in many cases it isn't necessary to search for secondary types.- Specified by:
findTypein interfaceINameEnvironmentExtension- Parameters:
typeName- type to findpackageName- package of the searched typesearchWithSecondaryTypes- flag to switch on/off the search for secondary typesmoduleName- the name of the module to search in, or one of ModuleBinding.ANY, ModuleBinding.UNNAMED- Returns:
NameEnvironmentAnswer
-
findTypes
public void findTypes(char[] prefix, boolean findMembers, int matchRule, int searchFor, ISearchRequestor storage, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Description copied from class:SearchableEnvironmentMust 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.- Overrides:
findTypesin classSearchableEnvironment
-
setMonitor
public void setMonitor(org.eclipse.core.runtime.IProgressMonitor monitor) Description copied from interface:INameEnvironmentWithProgressSet the monitor for the given name environment. In order to be able to cancel this name environment calls, a non-null monitor should be given.- Specified by:
setMonitorin interfaceINameEnvironmentWithProgress- Parameters:
monitor- the given monitor
-
SearchPattern.R_CASE_SENSITIVEas a matchRule instead.