public class MatchLocator extends java.lang.Object implements ITypeRequestor
| Modifier and Type | Class and Description |
|---|---|
static class |
MatchLocator.WorkingCopyDocument |
static class |
MatchLocator.WrappedCoreException |
| Modifier and Type | Field and Description |
|---|---|
char[][][] |
allSuperTypeNames |
PossibleMatch |
currentPossibleMatch |
HandleFactory |
handleFactory |
HierarchyResolver |
hierarchyResolver |
LookupEnvironment |
lookupEnvironment |
int |
matchContainer |
PossibleMatch[] |
matchesToProcess |
static int |
MAX_AT_ONCE |
INameEnvironment |
nameEnvironment |
NameLookup |
nameLookup |
int |
numberOfMatches |
CompilerOptions |
options |
MatchLocatorParser |
parser |
SearchPattern |
pattern |
PatternLocator |
patternLocator |
IProgressMonitor |
progressMonitor |
SearchRequestor |
requestor |
long |
resultCollectorTime |
IJavaSearchScope |
scope |
ICompilationUnit[] |
workingCopies |
| Constructor and Description |
|---|
MatchLocator(SearchPattern pattern,
SearchRequestor requestor,
IJavaSearchScope scope,
IProgressMonitor progressMonitor) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(IBinaryType binaryType,
PackageBinding packageBinding,
AccessRestriction accessRestriction)
Add an additional binary type
|
void |
accept(ICompilationUnit sourceUnit,
AccessRestriction accessRestriction)
Add an additional compilation unit into the loop
-> build compilation unit declarations, their bindings and record their results.
|
void |
accept(ISourceType[] sourceTypes,
PackageBinding packageBinding,
AccessRestriction accessRestriction)
Add additional source types
|
static SearchDocument[] |
addWorkingCopies(SearchPattern pattern,
SearchDocument[] indexMatches,
ICompilationUnit[] copies,
SearchParticipant participant) |
protected Parser |
basicParser() |
protected BinaryTypeBinding |
cacheBinaryType(IType type,
IBinaryType binaryType) |
static ClassFileReader |
classFileReader(IType type) |
protected char[][][] |
computeSuperTypeNames(IType focusType) |
protected IJavaElement |
createHandle(AbstractMethodDeclaration method,
IJavaElement parent)
Creates an IMethod from the given method declaration and type.
|
protected IJavaElement |
createHandle(AbstractVariableDeclaration variableDeclaration,
IJavaElement parent)
Create an handle for a local variable declaration (may be a local variable or type parameter).
|
protected IJavaElement |
createHandle(Annotation annotation,
IAnnotatable parent)
Create an handle for a local variable declaration (may be a local variable or type parameter).
|
protected IJavaElement |
createHandle(FieldDeclaration fieldDeclaration,
TypeDeclaration typeDeclaration,
IJavaElement parent)
Creates an IField from the given field declaration and type.
|
protected IJavaElement |
createHandle(LambdaExpression lambdaExpression,
IJavaElement parent)
Creates an IMethod from the given lambda declaration and type.
|
protected boolean |
createHierarchyResolver(IType focusType,
PossibleMatch[] possibleMatches) |
protected IJavaElement |
createImportHandle(ImportReference importRef)
Creates an IImportDeclaration from the given import statement
|
protected IJavaElement |
createPackageDeclarationHandle(CompilationUnitDeclaration unit)
Creates an IImportDeclaration from the given import statement
|
protected IType |
createTypeHandle(java.lang.String simpleTypeName)
Creates an IType from the given simple top level type name.
|
protected boolean |
encloses(IJavaElement element) |
static void |
findIndexMatches(SearchPattern pattern,
Index index,
IndexQueryRequestor requestor,
SearchParticipant participant,
IJavaSearchScope scope,
IProgressMonitor monitor)
Query a given index for matching entries.
|
protected IBinaryType |
getBinaryInfo(ClassFile classFile,
IResource resource) |
protected IType |
getFocusType() |
MethodBinding |
getMethodBinding(MethodPattern methodPattern) |
protected void |
getMethodBodies(CompilationUnitDeclaration unit,
MatchingNodeSet nodeSet) |
SearchParticipant |
getParticipant() |
static IJavaElement |
getProjectOrJar(IJavaElement element) |
protected TypeBinding |
getType(java.lang.Object typeKey,
char[] typeName) |
protected boolean |
hasAlreadyDefinedType(CompilationUnitDeclaration parsedUnit) |
void |
initialize(JavaProject project,
int possibleMatchSize)
Create a new parser for the given project, as well as a lookup environment.
|
protected void |
locateMatches(JavaProject javaProject,
PossibleMatch[] possibleMatches,
int start,
int length) |
protected void |
locateMatches(JavaProject javaProject,
PossibleMatchSet matchSet,
int expected)
Locate the matches amongst the possible matches.
|
void |
locateMatches(SearchDocument[] searchDocuments)
Locate the matches in the given files and report them using the search requestor.
|
protected void |
locatePackageDeclarations(SearchParticipant participant,
IJavaProject[] projects)
Locates the package declarations corresponding to this locator's pattern.
|
protected void |
locatePackageDeclarations(SearchPattern searchPattern,
SearchParticipant participant,
IJavaProject[] projects)
Locates the package declarations corresponding to the search pattern.
|
protected IType |
lookupType(ReferenceBinding typeBinding) |
SearchMatch |
newDeclarationMatch(IJavaElement element,
Binding binding,
int accuracy,
int offset,
int length) |
SearchMatch |
newDeclarationMatch(IJavaElement element,
Binding binding,
int accuracy,
int offset,
int length,
SearchParticipant participant,
IResource resource) |
FieldReferenceMatch |
newFieldReferenceMatch(IJavaElement enclosingElement,
IJavaElement localElement,
Binding enclosingBinding,
int accuracy,
int offset,
int length,
ASTNode reference) |
SearchMatch |
newLocalVariableReferenceMatch(IJavaElement enclosingElement,
int accuracy,
int offset,
int length,
ASTNode reference) |
MethodReferenceMatch |
newMethodReferenceMatch(IJavaElement enclosingElement,
Binding enclosingBinding,
int accuracy,
int offset,
int length,
boolean isConstructor,
boolean isSynthetic,
ASTNode reference) |
PackageReferenceMatch |
newPackageReferenceMatch(IJavaElement enclosingElement,
int accuracy,
int offset,
int length,
ASTNode reference) |
SearchMatch |
newTypeParameterReferenceMatch(IJavaElement enclosingElement,
int accuracy,
int offset,
int length,
ASTNode reference) |
TypeReferenceMatch |
newTypeReferenceMatch(IJavaElement enclosingElement,
Binding enclosingBinding,
int accuracy,
ASTNode reference) |
TypeReferenceMatch |
newTypeReferenceMatch(IJavaElement enclosingElement,
Binding enclosingBinding,
int accuracy,
int offset,
int length,
ASTNode reference) |
protected boolean |
parseAndBuildBindings(PossibleMatch possibleMatch,
boolean mustResolve)
Add the possibleMatch to the loop
-> build compilation unit declarations, their bindings and record their results.
|
protected void |
process(PossibleMatch possibleMatch,
boolean bindingsWereCreated) |
static IJavaElement |
projectOrJarFocus(SearchPattern pattern) |
protected void |
purgeMethodStatements(TypeDeclaration type,
boolean checkEachMethod) |
protected void |
reduceParseTree(CompilationUnitDeclaration unit)
Called prior to the unit being resolved.
|
protected void |
report(SearchMatch match) |
protected void |
reportAccurateEnumConstructorReference(SearchMatch match,
FieldDeclaration field,
AllocationExpression allocation)
Finds the accurate positions of each valid token in the source and
reports a reference to this token to the search requestor.
|
protected void |
reportAccurateFieldReference(SearchMatch[] matches,
QualifiedNameReference qNameRef)
Finds the accurate positions of each valid token in the source and
reports a reference to this token to the search requestor.
|
protected void |
reportAccurateParameterizedMethodReference(SearchMatch match,
ASTNode statement,
TypeReference[] typeArguments)
Finds the accurate positions of the sequence of tokens given by qualifiedName
in the source and reports a reference to this parameterized type name
to the search requestor.
|
protected void |
reportAccurateParameterizedTypeReference(SearchMatch match,
TypeReference typeRef,
int index,
TypeReference[] typeArguments)
Finds the accurate positions of the sequence of tokens given by qualifiedName
in the source and reports a reference to this parameterized type name
to the search requestor.
|
protected void |
reportAccurateTypeReference(SearchMatch match,
ASTNode typeRef,
char[] name)
Finds the accurate positions of the sequence of tokens given by qualifiedName
in the source and reports a reference to this this qualified name
to the search requestor.
|
protected void |
reportBinaryMemberDeclaration(IResource resource,
IMember binaryMember,
Binding binaryMemberBinding,
IBinaryType info,
int accuracy) |
protected void |
reportMatching(AbstractMethodDeclaration method,
TypeDeclaration type,
IJavaElement parent,
int accuracy,
boolean typeInHierarchy,
MatchingNodeSet nodeSet)
Visit the given method declaration and report the nodes that match exactly the
search pattern (i.e.
|
protected void |
reportMatching(Annotation[] annotations,
IJavaElement enclosingElement,
IJavaElement[] otherElements,
Binding elementBinding,
MatchingNodeSet nodeSet,
boolean matchedContainer,
boolean enclosesElement)
Report matching in annotations.
|
protected void |
reportMatching(CompilationUnitDeclaration unit,
boolean mustResolve)
Visit the given resolved parse tree and report the nodes that match the search pattern.
|
protected void |
reportMatching(FieldDeclaration field,
FieldDeclaration[] otherFields,
TypeDeclaration type,
IJavaElement parent,
int accuracy,
boolean typeInHierarchy,
MatchingNodeSet nodeSet)
Visit the given field declaration and report the nodes that match exactly the
search pattern (i.e.
|
protected void |
reportMatching(LambdaExpression lambdaExpression,
IJavaElement parent,
int accuracy,
MatchingNodeSet nodeSet,
boolean typeInHierarchy) |
protected void |
reportMatching(TypeDeclaration type,
IJavaElement parent,
int accuracy,
MatchingNodeSet nodeSet,
int occurrenceCount)
Visit the given type declaration and report the nodes that match exactly the
search pattern (i.e.
|
protected void |
reportMatching(TypeParameter[] typeParameters,
IJavaElement enclosingElement,
IJavaElement parent,
Binding binding,
MatchingNodeSet nodeSet)
Report matches in type parameters.
|
protected void |
reportMatchingSuper(TypeReference superReference,
IJavaElement enclosingElement,
Binding elementBinding,
MatchingNodeSet nodeSet,
boolean matchedClassContainer) |
static void |
setFocus(SearchPattern pattern,
IJavaElement focus) |
protected boolean |
typeInHierarchy(ReferenceBinding binding) |
public static final int MAX_AT_ONCE
public SearchPattern pattern
public PatternLocator patternLocator
public int matchContainer
public SearchRequestor requestor
public IJavaSearchScope scope
public IProgressMonitor progressMonitor
public ICompilationUnit[] workingCopies
public HandleFactory handleFactory
public char[][][] allSuperTypeNames
public MatchLocatorParser parser
public INameEnvironment nameEnvironment
public NameLookup nameLookup
public LookupEnvironment lookupEnvironment
public HierarchyResolver hierarchyResolver
public CompilerOptions options
public int numberOfMatches
public PossibleMatch[] matchesToProcess
public PossibleMatch currentPossibleMatch
public long resultCollectorTime
public MatchLocator(SearchPattern pattern, SearchRequestor requestor, IJavaSearchScope scope, IProgressMonitor progressMonitor)
public static SearchDocument[] addWorkingCopies(SearchPattern pattern, SearchDocument[] indexMatches, ICompilationUnit[] copies, SearchParticipant participant)
public static void setFocus(SearchPattern pattern, IJavaElement focus)
public static ClassFileReader classFileReader(IType type)
public static void findIndexMatches(SearchPattern pattern, Index index, IndexQueryRequestor requestor, SearchParticipant participant, IJavaSearchScope scope, IProgressMonitor monitor) throws java.io.IOException
java.io.IOExceptionpublic static IJavaElement getProjectOrJar(IJavaElement element)
public static IJavaElement projectOrJarFocus(SearchPattern pattern)
public void accept(IBinaryType binaryType, PackageBinding packageBinding, AccessRestriction accessRestriction)
accept in interface ITypeRequestorpublic void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction)
accept in interface ITypeRequestorpublic void accept(ISourceType[] sourceTypes, PackageBinding packageBinding, AccessRestriction accessRestriction)
accept in interface ITypeRequestorprotected Parser basicParser()
protected BinaryTypeBinding cacheBinaryType(IType type, IBinaryType binaryType) throws JavaModelException
JavaModelExceptionprotected char[][][] computeSuperTypeNames(IType focusType)
protected IJavaElement createHandle(LambdaExpression lambdaExpression, IJavaElement parent)
protected IJavaElement createHandle(AbstractMethodDeclaration method, IJavaElement parent)
protected IJavaElement createHandle(FieldDeclaration fieldDeclaration, TypeDeclaration typeDeclaration, IJavaElement parent)
protected IJavaElement createHandle(AbstractVariableDeclaration variableDeclaration, IJavaElement parent)
protected IJavaElement createHandle(Annotation annotation, IAnnotatable parent)
protected boolean createHierarchyResolver(IType focusType, PossibleMatch[] possibleMatches)
protected IJavaElement createImportHandle(ImportReference importRef)
protected IJavaElement createPackageDeclarationHandle(CompilationUnitDeclaration unit)
protected IType createTypeHandle(java.lang.String simpleTypeName)
protected boolean encloses(IJavaElement element)
protected IBinaryType getBinaryInfo(ClassFile classFile, IResource resource) throws CoreException
CoreExceptionprotected IType getFocusType()
protected void getMethodBodies(CompilationUnitDeclaration unit, MatchingNodeSet nodeSet)
protected TypeBinding getType(java.lang.Object typeKey, char[] typeName)
public MethodBinding getMethodBinding(MethodPattern methodPattern)
protected boolean hasAlreadyDefinedType(CompilationUnitDeclaration parsedUnit)
public void initialize(JavaProject project, int possibleMatchSize) throws JavaModelException
JavaModelExceptionprotected void locateMatches(JavaProject javaProject, PossibleMatch[] possibleMatches, int start, int length) throws CoreException
CoreExceptionprotected void locateMatches(JavaProject javaProject, PossibleMatchSet matchSet, int expected) throws CoreException
CoreExceptionpublic void locateMatches(SearchDocument[] searchDocuments) throws CoreException
CoreExceptionprotected void locatePackageDeclarations(SearchParticipant participant, IJavaProject[] projects) throws CoreException
CoreExceptionprotected void locatePackageDeclarations(SearchPattern searchPattern, SearchParticipant participant, IJavaProject[] projects) throws CoreException
CoreExceptionprotected IType lookupType(ReferenceBinding typeBinding)
public SearchMatch newDeclarationMatch(IJavaElement element, Binding binding, int accuracy, int offset, int length)
public SearchMatch newDeclarationMatch(IJavaElement element, Binding binding, int accuracy, int offset, int length, SearchParticipant participant, IResource resource)
public FieldReferenceMatch newFieldReferenceMatch(IJavaElement enclosingElement, IJavaElement localElement, Binding enclosingBinding, int accuracy, int offset, int length, ASTNode reference)
public SearchMatch newLocalVariableReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, ASTNode reference)
public MethodReferenceMatch newMethodReferenceMatch(IJavaElement enclosingElement, Binding enclosingBinding, int accuracy, int offset, int length, boolean isConstructor, boolean isSynthetic, ASTNode reference)
public PackageReferenceMatch newPackageReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, ASTNode reference)
public SearchMatch newTypeParameterReferenceMatch(IJavaElement enclosingElement, int accuracy, int offset, int length, ASTNode reference)
public TypeReferenceMatch newTypeReferenceMatch(IJavaElement enclosingElement, Binding enclosingBinding, int accuracy, int offset, int length, ASTNode reference)
public TypeReferenceMatch newTypeReferenceMatch(IJavaElement enclosingElement, Binding enclosingBinding, int accuracy, ASTNode reference)
protected boolean parseAndBuildBindings(PossibleMatch possibleMatch, boolean mustResolve) throws CoreException
CoreExceptionprotected void process(PossibleMatch possibleMatch, boolean bindingsWereCreated) throws CoreException
CoreExceptionprotected void purgeMethodStatements(TypeDeclaration type, boolean checkEachMethod)
protected void reduceParseTree(CompilationUnitDeclaration unit)
public SearchParticipant getParticipant()
protected void report(SearchMatch match) throws CoreException
CoreExceptionprotected void reportAccurateTypeReference(SearchMatch match, ASTNode typeRef, char[] name) throws CoreException
CoreExceptionprotected void reportAccurateParameterizedMethodReference(SearchMatch match, ASTNode statement, TypeReference[] typeArguments) throws CoreException
CoreExceptionprotected void reportAccurateParameterizedTypeReference(SearchMatch match, TypeReference typeRef, int index, TypeReference[] typeArguments) throws CoreException
CoreExceptionprotected void reportAccurateEnumConstructorReference(SearchMatch match, FieldDeclaration field, AllocationExpression allocation) throws CoreException
CoreExceptionprotected void reportAccurateFieldReference(SearchMatch[] matches, QualifiedNameReference qNameRef) throws CoreException
CoreExceptionprotected void reportBinaryMemberDeclaration(IResource resource,
IMember binaryMember,
Binding binaryMemberBinding,
IBinaryType info,
int accuracy)
throws CoreException
CoreExceptionprotected void reportMatching(LambdaExpression lambdaExpression, IJavaElement parent, int accuracy, MatchingNodeSet nodeSet, boolean typeInHierarchy) throws CoreException
CoreExceptionprotected void reportMatching(AbstractMethodDeclaration method, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException
CoreExceptionprotected void reportMatching(Annotation[] annotations, IJavaElement enclosingElement, IJavaElement[] otherElements, Binding elementBinding, MatchingNodeSet nodeSet, boolean matchedContainer, boolean enclosesElement) throws CoreException
otherElements - TODOCoreExceptionprotected void reportMatching(CompilationUnitDeclaration unit, boolean mustResolve) throws CoreException
CoreExceptionprotected void reportMatching(FieldDeclaration field, FieldDeclaration[] otherFields, TypeDeclaration type, IJavaElement parent, int accuracy, boolean typeInHierarchy, MatchingNodeSet nodeSet) throws CoreException
CoreExceptionprotected void reportMatching(TypeDeclaration type, IJavaElement parent, int accuracy, MatchingNodeSet nodeSet, int occurrenceCount) throws CoreException
CoreExceptionprotected void reportMatching(TypeParameter[] typeParameters, IJavaElement enclosingElement, IJavaElement parent, Binding binding, MatchingNodeSet nodeSet) throws CoreException
CoreExceptionprotected void reportMatchingSuper(TypeReference superReference, IJavaElement enclosingElement, Binding elementBinding, MatchingNodeSet nodeSet, boolean matchedClassContainer) throws CoreException
CoreExceptionprotected boolean typeInHierarchy(ReferenceBinding binding)