|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.core.search.SearchEngine
public class SearchEngine
A SearchEngine
searches for Java elements following a search pattern.
The search can be limited to a search scope.
Various search patterns can be created using the factory methods
SearchPattern.createPattern(String, int, int, int)
, SearchPattern.createPattern(IJavaElement, int)
,
SearchPattern.createOrPattern(SearchPattern, SearchPattern)
.
For example, one can search for references to a method in the hierarchy of a type, or one can search for the declarations of types starting with "Abstract" in a project.
This class may be instantiated.
Constructor Summary | |
---|---|
SearchEngine()
Creates a new search engine. |
|
SearchEngine(ICompilationUnit[] workingCopies)
Creates a new search engine with a list of working copies that will take precedence over their original compilation units in the subsequent search operations. |
|
SearchEngine(IWorkingCopy[] workingCopies)
Deprecated. Use SearchEngine(ICompilationUnit[]) instead. |
|
SearchEngine(WorkingCopyOwner workingCopyOwner)
Creates a new search engine with the given working copy owner. |
Method Summary | |
---|---|
static IJavaSearchScope |
createHierarchyScope(IType type)
Returns a Java search scope limited to the hierarchy of the given type. |
static IJavaSearchScope |
createHierarchyScope(IType type,
WorkingCopyOwner owner)
Returns a Java search scope limited to the hierarchy of the given type. |
static IJavaSearchScope |
createJavaSearchScope(IJavaElement[] elements)
Returns a Java search scope limited to the given Java elements. |
static IJavaSearchScope |
createJavaSearchScope(IJavaElement[] elements,
boolean includeReferencedProjects)
Returns a Java search scope limited to the given Java elements. |
static IJavaSearchScope |
createJavaSearchScope(IJavaElement[] elements,
int includeMask)
Returns a Java search scope limited to the given Java elements. |
static IJavaSearchScope |
createJavaSearchScope(IResource[] resources)
Deprecated. Use createJavaSearchScope(IJavaElement[]) instead. |
static ISearchPattern |
createOrSearchPattern(ISearchPattern leftPattern,
ISearchPattern rightPattern)
Deprecated. Use SearchPattern.createOrPattern(SearchPattern, SearchPattern) instead. |
static ISearchPattern |
createSearchPattern(IJavaElement element,
int limitTo)
Deprecated. Use SearchPattern.createPattern(IJavaElement, int) instead. |
static ISearchPattern |
createSearchPattern(java.lang.String stringPattern,
int searchFor,
int limitTo,
boolean isCaseSensitive)
Deprecated. Use SearchPattern.createPattern(String, int, int, int) instead. |
static TypeNameMatch |
createTypeNameMatch(IType type,
int modifiers)
Create a type name match on a given type with specific modifiers. |
static IJavaSearchScope |
createWorkspaceScope()
Returns a Java search scope with the workspace as the only limit. |
static SearchParticipant |
getDefaultSearchParticipant()
Returns a new default Java search participant. |
void |
search(IWorkspace workspace,
IJavaElement element,
int limitTo,
IJavaSearchScope scope,
IJavaSearchResultCollector resultCollector)
Deprecated. Use search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) instead. |
void |
search(IWorkspace workspace,
ISearchPattern searchPattern,
IJavaSearchScope scope,
IJavaSearchResultCollector resultCollector)
Deprecated. Use search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) instead. |
void |
search(IWorkspace workspace,
java.lang.String patternString,
int searchFor,
int limitTo,
IJavaSearchScope scope,
IJavaSearchResultCollector resultCollector)
Deprecated. Use search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor) instead. |
void |
search(SearchPattern pattern,
SearchParticipant[] participants,
IJavaSearchScope scope,
SearchRequestor requestor,
org.eclipse.core.runtime.IProgressMonitor monitor)
Searches for matches of a given search pattern. |
void |
searchAllTypeNames(char[][] qualifications,
char[][] typeNames,
IJavaSearchScope scope,
TypeNameMatchRequestor nameMatchRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Searches for all top-level types and member types in the given scope matching any of the given qualifications and type names in a case sensitive way. |
void |
searchAllTypeNames(char[][] qualifications,
char[][] typeNames,
IJavaSearchScope scope,
TypeNameRequestor nameRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Searches for all top-level types and member types in the given scope matching any of the given qualifications and type names in a case sensitive way. |
void |
searchAllTypeNames(char[] packageName,
char[] typeName,
int matchRule,
int searchFor,
IJavaSearchScope scope,
ITypeNameRequestor nameRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Deprecated. Use searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, TypeNameRequestor, int, IProgressMonitor) instead |
void |
searchAllTypeNames(char[] packageExactName,
char[] typeName,
int matchRule,
int searchFor,
IJavaSearchScope scope,
TypeNameRequestor nameRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Deprecated. Use searchAllTypeNames(char[], int, char[], int, int, IJavaSearchScope, TypeNameRequestor, int, IProgressMonitor)
instead |
void |
searchAllTypeNames(char[] packageName,
int packageMatchRule,
char[] typeName,
int typeMatchRule,
int searchFor,
IJavaSearchScope scope,
TypeNameMatchRequestor nameMatchRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Searches for all top-level types and member types in the given scope. |
void |
searchAllTypeNames(char[] packageName,
int packageMatchRule,
char[] typeName,
int typeMatchRule,
int searchFor,
IJavaSearchScope scope,
TypeNameRequestor nameRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Searches for all top-level types and member types in the given scope. |
void |
searchAllTypeNames(IWorkspace workspace,
char[] packageName,
char[] typeName,
int matchMode,
boolean isCaseSensitive,
int searchFor,
IJavaSearchScope scope,
ITypeNameRequestor nameRequestor,
int waitingPolicy,
org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Deprecated. Use searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, ITypeNameRequestor, int, IProgressMonitor) instead |
void |
searchDeclarationsOfAccessedFields(IJavaElement enclosingElement,
SearchRequestor requestor,
org.eclipse.core.runtime.IProgressMonitor monitor)
Searches for all declarations of the fields accessed in the given element. |
void |
searchDeclarationsOfAccessedFields(IWorkspace workspace,
IJavaElement enclosingElement,
IJavaSearchResultCollector resultCollector)
Deprecated. Use searchDeclarationsOfAccessedFields(IJavaElement, SearchRequestor, IProgressMonitor) instead. |
void |
searchDeclarationsOfReferencedTypes(IJavaElement enclosingElement,
SearchRequestor requestor,
org.eclipse.core.runtime.IProgressMonitor monitor)
Searches for all declarations of the types referenced in the given element. |
void |
searchDeclarationsOfReferencedTypes(IWorkspace workspace,
IJavaElement enclosingElement,
IJavaSearchResultCollector resultCollector)
Deprecated. Use searchDeclarationsOfReferencedTypes(IJavaElement, SearchRequestor, IProgressMonitor) instead. |
void |
searchDeclarationsOfSentMessages(IJavaElement enclosingElement,
SearchRequestor requestor,
org.eclipse.core.runtime.IProgressMonitor monitor)
Searches for all declarations of the methods invoked in the given element. |
void |
searchDeclarationsOfSentMessages(IWorkspace workspace,
IJavaElement enclosingElement,
IJavaSearchResultCollector resultCollector)
Deprecated. Use searchDeclarationsOfSentMessages(IJavaElement, SearchRequestor, IProgressMonitor) instead. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SearchEngine()
public SearchEngine(ICompilationUnit[] workingCopies)
Note that passing an empty working copy will be as if the original compilation unit had been deleted.
Since 3.0 the given working copies take precedence over primary working copies (if any).
workingCopies
- the working copies that take precedence over their original compilation unitspublic SearchEngine(IWorkingCopy[] workingCopies)
SearchEngine(ICompilationUnit[])
instead.
Note that passing an empty working copy will be as if the original compilation unit had been deleted.
Since 3.0 the given working copies take precedence over primary working copies (if any).
workingCopies
- the working copies that take precedence over their original compilation unitspublic SearchEngine(WorkingCopyOwner workingCopyOwner)
workingCopyOwner
- the owner of the working copies that take precedence over their original compilation unitsMethod Detail |
---|
public static IJavaSearchScope createHierarchyScope(IType type) throws JavaModelException
type
- the focus of the hierarchy scope
JavaModelException
- if the hierarchy could not be computed on the given typepublic static IJavaSearchScope createHierarchyScope(IType type, WorkingCopyOwner owner) throws JavaModelException
type
- the focus of the hierarchy scopeowner
- the owner of working copies that take precedence over original compilation units
JavaModelException
- if the hierarchy could not be computed on the given typepublic static IJavaSearchScope createJavaSearchScope(IResource[] resources)
createJavaSearchScope(IJavaElement[])
instead.
Resources must not overlap, for example, one cannot include a folder and its children.
resources
- the resources the scope is limited to
public static IJavaSearchScope createJavaSearchScope(IJavaElement[] elements)
If an element is an IJavaProject, then the project's source folders, its jars (external and internal) and its referenced projects (with their source folders and jars, recursively) will be included. If an element is an IPackageFragmentRoot, then only the package fragments of this package fragment root will be included. If an element is an IPackageFragment, then only the compilation unit and class files of this package fragment will be included. Subpackages will NOT be included.
In other words, this is equivalent to using SearchEngine.createJavaSearchScope(elements, true).
elements
- the Java elements the scope is limited to
public static IJavaSearchScope createJavaSearchScope(IJavaElement[] elements, boolean includeReferencedProjects)
elements
- the Java elements the scope is limited toincludeReferencedProjects
- a flag indicating if referenced projects must be
recursively included
public static IJavaSearchScope createJavaSearchScope(IJavaElement[] elements, int includeMask)
elements
- the Java elements the scope is limited toincludeMask
- the bit-wise OR of all include types of interest
IJavaSearchScope.SOURCES
,
IJavaSearchScope.APPLICATION_LIBRARIES
,
IJavaSearchScope.SYSTEM_LIBRARIES
,
IJavaSearchScope.REFERENCED_PROJECTS
public static ISearchPattern createOrSearchPattern(ISearchPattern leftPattern, ISearchPattern rightPattern)
SearchPattern.createOrPattern(SearchPattern, SearchPattern)
instead.
leftPattern
- the left patternrightPattern
- the right pattern
public static ISearchPattern createSearchPattern(java.lang.String stringPattern, int searchFor, int limitTo, boolean isCaseSensitive)
SearchPattern.createPattern(String, int, int, int)
instead.
Object
:
createSearchPattern("Object", TYPE, REFERENCES, false);
Object()
constructor:
createSearchPattern("java.lang.Object()", CONSTRUCTOR, REFERENCES, true);
java.lang.Runnable
:
createSearchPattern("java.lang.Runnable", TYPE, IMPLEMENTORS, true);
stringPattern
- the given patternsearchFor
- determines the nature of the searched elements
IJavaSearchConstants.CLASS
: only look for classesIJavaSearchConstants.INTERFACE
: only look for interfacesIJavaSearchConstants.TYPE
: look for both classes and interfacesIJavaSearchConstants.FIELD
: look for fieldsIJavaSearchConstants.METHOD
: look for methodsIJavaSearchConstants.CONSTRUCTOR
: look for constructorsIJavaSearchConstants.PACKAGE
: look for packageslimitTo
- determines the nature of the expected matches
IJavaSearchConstants.DECLARATIONS
: will search declarations matching with the corresponding
element. In case the element is a method, declarations of matching methods in subtypes will also
be found, allowing to find declarations of abstract methods, etc.IJavaSearchConstants.REFERENCES
: will search references to the given element.IJavaSearchConstants.ALL_OCCURRENCES
: will search for either declarations or references as specified
above.IJavaSearchConstants.IMPLEMENTORS
: for types, will find all types
which directly implement/extend a given interface.
Note that types may be only classes or only interfaces if IJavaSearchConstants.CLASS
or
IJavaSearchConstants.INTERFACE
is respectively used instead of IJavaSearchConstants.TYPE
.
isCaseSensitive
- indicates whether the search is case sensitive or not.
null
if the string pattern is ill-formed.public static ISearchPattern createSearchPattern(IJavaElement element, int limitTo)
SearchPattern.createPattern(IJavaElement, int)
instead.
element
- the Java element the search pattern is based onlimitTo
- determines the nature of the expected matches
IJavaSearchConstants.DECLARATIONS
: will search declarations matching with the corresponding
element. In case the element is a method, declarations of matching methods in subtypes will also
be found, allowing to find declarations of abstract methods, etc.IJavaSearchConstants.REFERENCES
: will search references to the given element.IJavaSearchConstants.ALL_OCCURRENCES
: will search for either declarations or references as specified
above.IJavaSearchConstants.IMPLEMENTORS
: for types, will find all types
which directly implement/extend a given interface.null
if the given element is ill-formedpublic static TypeNameMatch createTypeNameMatch(IType type, int modifiers)
type
- The java model handle of the typemodifiers
- Modifiers of the type
public static IJavaSearchScope createWorkspaceScope()
public static SearchParticipant getDefaultSearchParticipant()
public void search(IWorkspace workspace, java.lang.String patternString, int searchFor, int limitTo, IJavaSearchScope scope, IJavaSearchResultCollector resultCollector) throws JavaModelException
search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
instead.
search(ws, "run()", METHOD,REFERENCES, col)
searches for all references to the method run
.
Note that by default the pattern will be case insensitive. For specifying case s
sensitive search, use search(workspace, createSearchPattern(patternString, searchFor, limitTo, true), scope, resultCollector);
workspace
- the workspacepatternString
- the pattern to be searched forsearchFor
- a hint what kind of Java element the string pattern represents.
Look into IJavaSearchConstants
for valid valueslimitTo
- one of the following values:
IJavaSearchConstants.DECLARATIONS
: search
for declarations only IJavaSearchConstants.REFERENCES
: search
for all references IJavaSearchConstants.ALL_OCCURRENCES
: search
for both declarations and all references IJavaSearchConstants.IMPLEMENTORS
: for types, will find all types
which directly implement/extend a given interface.IJavaSearchConstants.CLASS
or
IJavaSearchConstants.INTERFACE
is used for searchFor parameter instead of IJavaSearchConstants.TYPE
.
scope
- the search result has to be limited to the given scoperesultCollector
- a callback object to which each match is reported
JavaModelException
- if the search failed. Reasons include:
public void search(IWorkspace workspace, IJavaElement element, int limitTo, IJavaSearchScope scope, IJavaSearchResultCollector resultCollector) throws JavaModelException
search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
instead.
workspace
- the workspaceelement
- the Java element to be searched forlimitTo
- one of the following values:
IJavaSearchConstants.DECLARATIONS
: search
for declarations only IJavaSearchConstants.REFERENCES
: search
for all references IJavaSearchConstants.ALL_OCCURRENCES
: search
for both declarations and all references IJavaSearchConstants.IMPLEMENTORS
: for types, will find all types
which directly implement/extend a given interface.scope
- the search result has to be limited to the given scoperesultCollector
- a callback object to which each match is reported
JavaModelException
- if the search failed. Reasons include:
public void search(IWorkspace workspace, ISearchPattern searchPattern, IJavaSearchScope scope, IJavaSearchResultCollector resultCollector) throws JavaModelException
search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, IProgressMonitor)
instead.
workspace
- the workspacesearchPattern
- the pattern to be searched forscope
- the search result has to be limited to the given scoperesultCollector
- a callback object to which each match is reported
JavaModelException
- if the search failed. Reasons include:
public void search(SearchPattern pattern, SearchParticipant[] participants, IJavaSearchScope scope, SearchRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
pattern
- the pattern to searchparticipants
- the particpants in the searchscope
- the search scoperequestor
- the requestor to report the matches tomonitor
- the progress monitor used to report progress
org.eclipse.core.runtime.CoreException
- if the search failed. Reasons include:
public void searchAllTypeNames(char[] packageExactName, char[] typeName, int matchRule, int searchFor, IJavaSearchScope scope, TypeNameRequestor nameRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
searchAllTypeNames(char[], int, char[], int, int, IJavaSearchScope, TypeNameRequestor, int, IProgressMonitor)
instead
packageExactName
- the exact package full name of the searched types.searchAllTypeNames(char[], int, char[], int, int, IJavaSearchScope, TypeNameRequestor, int, IProgressMonitor)
method instead. May be null
, then any package name is accepted.typeName
- the dot-separated qualified name of the searched type (the qualification include
the enclosing types if the searched type is a member type), or a prefix
for this type, or a wild-carded string for this type.
May be null
, then any type name is accepted.matchRule
- type name match rule one of
SearchPattern.R_EXACT_MATCH
if the package name and type
name are the full names of the searched types.SearchPattern.R_PREFIX_MATCH
if the package name and type
name are prefixes of the names of the searched types.SearchPattern.R_PATTERN_MATCH
if the package name and
type name contain wild-cards.SearchPattern.R_CAMELCASE_MATCH
if the type name is a
camel case of the searched types name.SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
if the type name is a camel case with same part count of the searched
types name.SearchPattern.R_CASE_SENSITIVE
,
e.g. SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
or SearchPattern.R_PREFIX_MATCH
if a prefix non case sensitive match is requested.searchFor
- determines the nature of the searched elements
IJavaSearchConstants.CLASS
: only look for classesIJavaSearchConstants.INTERFACE
: only look for interfacesIJavaSearchConstants.ENUM
: only look for enumerationIJavaSearchConstants.ANNOTATION_TYPE
: only look for annotation typeIJavaSearchConstants.CLASS_AND_ENUM
: only look for classes and enumerationsIJavaSearchConstants.CLASS_AND_INTERFACE
: only look for classes and interfacesIJavaSearchConstants.TYPE
: look for all types (ie. classes, interfaces, enum and annotation types)scope
- the scope to search innameRequestor
- the requestor that collects the results of the searchwaitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchAllTypeNames(char[] packageName, int packageMatchRule, char[] typeName, int typeMatchRule, int searchFor, IJavaSearchScope scope, TypeNameRequestor nameRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
packageName
- the full name of the package of the searched types, or a prefix for this
package, or a wild-carded string for this package.
May be null
, then any package name is accepted.typeName
- the dot-separated qualified name of the searched type (the qualification include
the enclosing types if the searched type is a member type), or a prefix
for this type, or a wild-carded string for this type.
May be null
, then any type name is accepted.packageMatchRule
- one of
SearchPattern.R_EXACT_MATCH
if the package name and type
name are the full names of the searched types.SearchPattern.R_PREFIX_MATCH
if the package name and type
name are prefixes of the names of the searched types.SearchPattern.R_PATTERN_MATCH
if the package name and
type name contain wild-cards.SearchPattern.R_CAMELCASE_MATCH
if the package name is a
camel case of the searched types package name.SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
if the package name is a camel case with same part count of the searched
types package name.SearchPattern.R_CASE_SENSITIVE
,
e.g. SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
or SearchPattern.R_PREFIX_MATCH
if a prefix non case sensitive match is requested.typeMatchRule
- one of
SearchPattern.R_EXACT_MATCH
if the package name and type
name are the full names of the searched types.SearchPattern.R_PREFIX_MATCH
if the package name and type
name are prefixes of the names of the searched types.SearchPattern.R_PATTERN_MATCH
if the package name and
type name contain wild-cards.SearchPattern.R_CAMELCASE_MATCH
if the type name is a
camel case of the searched types name.SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
if the type name is a camel case with same part count of the searched
types name.SearchPattern.R_CASE_SENSITIVE
,
e.g. SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
or SearchPattern.R_PREFIX_MATCH
if a prefix non case sensitive match is requested.searchFor
- determines the nature of the searched elements
IJavaSearchConstants.CLASS
: only look for classesIJavaSearchConstants.INTERFACE
: only look for interfacesIJavaSearchConstants.ENUM
: only look for enumerationIJavaSearchConstants.ANNOTATION_TYPE
: only look for annotation typeIJavaSearchConstants.CLASS_AND_ENUM
: only look for classes and enumerationsIJavaSearchConstants.CLASS_AND_INTERFACE
: only look for classes and interfacesIJavaSearchConstants.TYPE
: look for all types (ie. classes, interfaces, enum and annotation types)scope
- the scope to search innameRequestor
- the requestor that collects the results of the searchwaitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchAllTypeNames(char[] packageName, int packageMatchRule, char[] typeName, int typeMatchRule, int searchFor, IJavaSearchScope scope, TypeNameMatchRequestor nameMatchRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
Provided TypeNameMatchRequestor
requestor will collect TypeNameMatch
matches found during the search.
packageName
- the full name of the package of the searched types, or a prefix for this
package, or a wild-carded string for this package.
May be null
, then any package name is accepted.packageMatchRule
- one of
SearchPattern.R_EXACT_MATCH
if the package name and type
name are the full names of the searched types.SearchPattern.R_PREFIX_MATCH
if the package name and type
name are prefixes of the names of the searched types.SearchPattern.R_PATTERN_MATCH
if the package name and
type name contain wild-cards.SearchPattern.R_CAMELCASE_MATCH
if the package name is a
camel case of the searched types package name.SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
if the package name is a camel case with same part count of the searched
types package name.SearchPattern.R_CASE_SENSITIVE
,
e.g. SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
or SearchPattern.R_PREFIX_MATCH
if a prefix non case sensitive match is requested.typeName
- the dot-separated qualified name of the searched type (the qualification include
the enclosing types if the searched type is a member type), or a prefix
for this type, or a wild-carded string for this type.
May be null
, then any type name is accepted.typeMatchRule
- one of
SearchPattern.R_EXACT_MATCH
if the package name and type
name are the full names of the searched types.SearchPattern.R_PREFIX_MATCH
if the package name and type
name are prefixes of the names of the searched types.SearchPattern.R_PATTERN_MATCH
if the package name and
type name contain wild-cards.SearchPattern.R_CAMELCASE_MATCH
if the type name is a
camel case of the searched types name.SearchPattern.R_CAMELCASE_SAME_PART_COUNT_MATCH
if the type name is a camel case with same part count of the searched
types name.SearchPattern.R_CASE_SENSITIVE
,
e.g. SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
or SearchPattern.R_PREFIX_MATCH
if a prefix non case sensitive match is requested.searchFor
- determines the nature of the searched elements
IJavaSearchConstants.CLASS
: only look for classesIJavaSearchConstants.INTERFACE
: only look for interfacesIJavaSearchConstants.ENUM
: only look for enumerationIJavaSearchConstants.ANNOTATION_TYPE
: only look for annotation typeIJavaSearchConstants.CLASS_AND_ENUM
: only look for classes and enumerationsIJavaSearchConstants.CLASS_AND_INTERFACE
: only look for classes and interfacesIJavaSearchConstants.TYPE
: look for all types (ie. classes, interfaces, enum and annotation types)scope
- the scope to search innameMatchRequestor
- the requestor
that collects
matches
of the search.waitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchAllTypeNames(char[][] qualifications, char[][] typeNames, IJavaSearchScope scope, TypeNameRequestor nameRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
qualifications
- the qualified name of the package/enclosing type of the searched types.
May be null
, then any package name is accepted.typeNames
- the simple names of the searched types.
If this parameter is null
, then no type will be found.scope
- the scope to search innameRequestor
- the requestor that collects the results of the searchwaitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchAllTypeNames(char[][] qualifications, char[][] typeNames, IJavaSearchScope scope, TypeNameMatchRequestor nameMatchRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
Provided TypeNameMatchRequestor
requestor will collect TypeNameMatch
matches found during the search.
qualifications
- the qualified name of the package/enclosing type of the searched types.
May be null
, then any package name is accepted.typeNames
- the simple names of the searched types.
If this parameter is null
, then no type will be found.scope
- the scope to search innameMatchRequestor
- the requestor
that collects
matches
of the search.waitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchAllTypeNames(char[] packageName, char[] typeName, int matchRule, int searchFor, IJavaSearchScope scope, ITypeNameRequestor nameRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, TypeNameRequestor, int, IProgressMonitor)
instead
packageName
- the full name of the package of the searched types, or a prefix for this
package, or a wild-carded string for this package.typeName
- the dot-separated qualified name of the searched type (the qualification include
the enclosing types if the searched type is a member type), or a prefix
for this type, or a wild-carded string for this type.matchRule
- one of
SearchPattern.R_EXACT_MATCH
if the package name and type name are the full names
of the searched types.SearchPattern.R_PREFIX_MATCH
if the package name and type name are prefixes of the names
of the searched types.SearchPattern.R_PATTERN_MATCH
if the package name and type name contain wild-cards.SearchPattern.R_CASE_SENSITIVE
,
e.g. SearchPattern.R_EXACT_MATCH
| SearchPattern.R_CASE_SENSITIVE
if an exact and case sensitive match is requested,
or SearchPattern.R_PREFIX_MATCH
if a prefix non case sensitive match is requested.searchFor
- one of
IJavaSearchConstants.CLASS
if searching for classes onlyIJavaSearchConstants.INTERFACE
if searching for interfaces onlyIJavaSearchConstants.TYPE
if searching for both classes and interfacesscope
- the scope to search innameRequestor
- the requestor that collects the results of the searchwaitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchAllTypeNames(IWorkspace workspace, char[] packageName, char[] typeName, int matchMode, boolean isCaseSensitive, int searchFor, IJavaSearchScope scope, ITypeNameRequestor nameRequestor, int waitingPolicy, org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws JavaModelException
searchAllTypeNames(char[], char[], int, int, IJavaSearchScope, ITypeNameRequestor, int, IProgressMonitor)
instead
workspace
- the workspace to search inpackageName
- the full name of the package of the searched types, or a prefix for this
package, or a wild-carded string for this package.typeName
- the dot-separated qualified name of the searched type (the qualification include
the enclosing types if the searched type is a member type), or a prefix
for this type, or a wild-carded string for this type.matchMode
- one of
IJavaSearchConstants.EXACT_MATCH
if the package name and type name are the full names
of the searched types.IJavaSearchConstants.PREFIX_MATCH
if the package name and type name are prefixes of the names
of the searched types.IJavaSearchConstants.PATTERN_MATCH
if the package name and type name contain wild-cards.isCaseSensitive
- whether the search should be case sensitivesearchFor
- one of
IJavaSearchConstants.CLASS
if searching for classes onlyIJavaSearchConstants.INTERFACE
if searching for interfaces onlyIJavaSearchConstants.TYPE
if searching for both classes and interfacesscope
- the scope to search innameRequestor
- the requestor that collects the results of the searchwaitingPolicy
- one of
IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH
if the search should start immediatelyIJavaSearchConstants.CANCEL_IF_NOT_READY_TO_SEARCH
if the search should be cancelled if the
underlying indexer has not finished indexing the workspaceIJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH
if the search should wait for the
underlying indexer to finish indexing the workspaceprogressMonitor
- the progress monitor to report progress to, or null
if no progress
monitor is provided
JavaModelException
- if the search failed. Reasons include:
public void searchDeclarationsOfAccessedFields(IJavaElement enclosingElement, SearchRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
Consider the following code:
then searching for declarations of accessed fields in method
class A {
int field1;
}
class B extends A {
String value;
}
class X {
void test() {
B b = new B();
System.out.println(b.value + b.field1);
};
}
X.test()
would collect the fields
B.value
and A.field1
.
enclosingElement
- the field, method, type, or compilation unit to be searched inrequestor
- a callback object to which each match is reportedmonitor
- the progress monitor used to report progress
JavaModelException
- if the search failed. Reasons include:
java.lang.IllegalArgumentException
- if the given java element has not the right typepublic void searchDeclarationsOfAccessedFields(IWorkspace workspace, IJavaElement enclosingElement, IJavaSearchResultCollector resultCollector) throws JavaModelException
searchDeclarationsOfAccessedFields(IJavaElement, SearchRequestor, IProgressMonitor)
instead.
Consider the following code:
then searching for declarations of accessed fields in method
class A {
int field1;
}
class B extends A {
String value;
}
class X {
void test() {
B b = new B();
System.out.println(b.value + b.field1);
};
}
X.test()
would collect the fields
B.value
and A.field1
.
workspace
- the workspaceenclosingElement
- the method, type, or compilation unit to be searched inresultCollector
- a callback object to which each match is reported
JavaModelException
- if the search failed. Reasons include:
public void searchDeclarationsOfReferencedTypes(IJavaElement enclosingElement, SearchRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
Consider the following code:
then searching for declarations of referenced types in method
class A {
}
class B extends A {
}
interface I {
int VALUE = 0;
}
class X {
void test() {
B b = new B();
this.foo(b, I.VALUE);
};
}
X.test()
would collect the class B
and the interface I
.
enclosingElement
- the field, method, type, or compilation unit to be searched inrequestor
- a callback object to which each match is reportedmonitor
- the progress monitor used to report progress
JavaModelException
- if the search failed. Reasons include:
java.lang.IllegalArgumentException
- if the given java element has not the right typepublic void searchDeclarationsOfReferencedTypes(IWorkspace workspace, IJavaElement enclosingElement, IJavaSearchResultCollector resultCollector) throws JavaModelException
searchDeclarationsOfReferencedTypes(IJavaElement, SearchRequestor, IProgressMonitor)
instead.
Consider the following code:
then searching for declarations of referenced types in method
class A {
}
class B extends A {
}
interface I {
int VALUE = 0;
}
class X {
void test() {
B b = new B();
this.foo(b, I.VALUE);
};
}
X.test()
would collect the class B
and the interface I
.
workspace
- the workspaceenclosingElement
- the method, type, or compilation unit to be searched inresultCollector
- a callback object to which each match is reported
JavaModelException
- if the search failed. Reasons include:
public void searchDeclarationsOfSentMessages(IJavaElement enclosingElement, SearchRequestor requestor, org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException
Consider the following code:
then searching for declarations of sent messages in method
class A {
void foo() {};
void bar() {};
}
class B extends A {
void foo() {};
}
class X {
void test() {
A a = new B();
a.foo();
B b = (B)a;
b.bar();
};
}
X.test()
would collect the methods
A.foo()
, B.foo()
, and A.bar()
.
enclosingElement
- the field, method, type or compilation unit to be searched inrequestor
- a callback object to which each match is reportedmonitor
- the progress monitor used to report progress
JavaModelException
- if the search failed. Reasons include:
java.lang.IllegalArgumentException
- if the given java element has not the right typepublic void searchDeclarationsOfSentMessages(IWorkspace workspace, IJavaElement enclosingElement, IJavaSearchResultCollector resultCollector) throws JavaModelException
searchDeclarationsOfSentMessages(IJavaElement, SearchRequestor, IProgressMonitor)
instead.
Consider the following code:
then searching for declarations of sent messages in method
class A {
void foo() {};
void bar() {};
}
class B extends A {
void foo() {};
}
class X {
void test() {
A a = new B();
a.foo();
B b = (B)a;
b.bar();
};
}
X.test()
would collect the methods
A.foo()
, B.foo()
, and A.bar()
.
workspace
- the workspaceenclosingElement
- the method, type, or compilation unit to be searched inresultCollector
- a callback object to which each match is reported
JavaModelException
- if the search failed. Reasons include:
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |