@Override public int match(Annotation node, MatchingNodeSet nodeSet) { return match(node.type, nodeSet); } @Override
@Override protected int matchLevel(ImportReference importRef) { return matchLevelForTokens(importRef.tokens); } protected int matchLevelForTokens(char[][] tokens) {
@Override protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { matchReportReference(reference, element, null, null, elementBinding, accuracy, locator); } @Override
if (compoundName != null && matchesName(this.pattern.pkgName, CharOperation.concatWith(compoundName, '.'))) { if (this.pattern.focus instanceof IPackageFragment && binding instanceof ReferenceBinding) { if (!isDeclaringPackageFragment((IPackageFragment) this.pattern.focus, (ReferenceBinding)binding)) return IMPOSSIBLE_MATCH;
public int resolveLevel(ASTNode node) { if (node instanceof JavadocQualifiedTypeReference) { JavadocQualifiedTypeReference qualifRef = (JavadocQualifiedTypeReference) node; if (qualifRef.packageBinding != null) return resolveLevel(qualifRef.packageBinding); return resolveLevel(qualifRef.resolvedType); } if (node instanceof JavadocSingleTypeReference) { JavadocSingleTypeReference singleRef = (JavadocSingleTypeReference) node; if (singleRef.packageBinding != null) return resolveLevel(singleRef.packageBinding); return IMPOSSIBLE_MATCH; } if (node instanceof QualifiedTypeReference) return resolveLevel(((QualifiedTypeReference) node).resolvedType); if (node instanceof QualifiedNameReference) return this.resolveLevel((QualifiedNameReference) node); // if (node instanceof ImportReference) - Not called when resolve is true, see MatchingNodeSet.reportMatching(unit) return IMPOSSIBLE_MATCH; } public int resolveLevel(Binding binding) {
public int match(ASTNode node, MatchingNodeSet nodeSet) { // interested in ImportReference if (!(node instanceof ImportReference)) return IMPOSSIBLE_MATCH; return nodeSet.addMatch(node, matchLevel((ImportReference) node)); } //public int match(ConstructorDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
public static PatternLocator patternLocator(SearchPattern pattern) { switch (pattern.kind) { case IIndexConstants.PKG_REF_PATTERN : return new PackageReferenceLocator((PackageReferencePattern) pattern); case IIndexConstants.PKG_DECL_PATTERN : return new PackageDeclarationLocator((PackageDeclarationPattern) pattern); case IIndexConstants.TYPE_REF_PATTERN : return new TypeReferenceLocator((TypeReferencePattern) pattern); case IIndexConstants.TYPE_DECL_PATTERN : return new TypeDeclarationLocator((TypeDeclarationPattern) pattern); case IIndexConstants.SUPER_REF_PATTERN : return new SuperTypeReferenceLocator((SuperTypeReferencePattern) pattern); case IIndexConstants.CONSTRUCTOR_PATTERN : return new ConstructorLocator((ConstructorPattern) pattern); case IIndexConstants.FIELD_PATTERN : return new FieldLocator((FieldPattern) pattern); case IIndexConstants.METHOD_PATTERN : return new MethodLocator((MethodPattern) pattern); case IIndexConstants.OR_PATTERN : return new OrLocator((OrPattern) pattern); case IIndexConstants.AND_PATTERN : return new AndLocator((AndPattern) pattern); case IIndexConstants.LOCAL_VAR_PATTERN : return new LocalVariableLocator((LocalVariablePattern) pattern); case IIndexConstants.TYPE_PARAM_PATTERN: return new TypeParameterLocator((TypeParameterPattern) pattern); } return null; } public static char[] qualifiedPattern(char[] simpleNamePattern, char[] qualificationPattern) {
if (compoundName != null && matchesName(this.pattern.pkgName, CharOperation.concatWith(compoundName, '.'))) { if (this.pattern.focus instanceof IPackageFragment && binding instanceof ReferenceBinding) { if (!isDeclaringPackageFragment((IPackageFragment) this.pattern.focus, (ReferenceBinding)binding)) return IMPOSSIBLE_MATCH;
public int resolveLevel(ASTNode node) { if (node instanceof JavadocQualifiedTypeReference) { JavadocQualifiedTypeReference qualifRef = (JavadocQualifiedTypeReference) node; if (qualifRef.packageBinding != null) return resolveLevel(qualifRef.packageBinding); return resolveLevel(qualifRef.resolvedType); } if (node instanceof JavadocSingleTypeReference) { JavadocSingleTypeReference singleRef = (JavadocSingleTypeReference) node; if (singleRef.packageBinding != null) return resolveLevel(singleRef.packageBinding); return IMPOSSIBLE_MATCH; } if (node instanceof QualifiedTypeReference) return resolveLevel(((QualifiedTypeReference) node).resolvedType); if (node instanceof QualifiedNameReference) return this.resolveLevel((QualifiedNameReference) node); // if (node instanceof ImportReference) - Not called when resolve is true, see MatchingNodeSet.reportMatching(unit) return IMPOSSIBLE_MATCH; } public int resolveLevel(Binding binding) {
public int match(ASTNode node, MatchingNodeSet nodeSet) { // interested in ImportReference if (!(node instanceof ImportReference)) return IMPOSSIBLE_MATCH; return nodeSet.addMatch(node, matchLevel((ImportReference) node)); } //public int match(ConstructorDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
public static PatternLocator patternLocator(SearchPattern pattern) { switch (pattern.kind) { case IIndexConstants.PKG_REF_PATTERN : return new PackageReferenceLocator((PackageReferencePattern) pattern); case IIndexConstants.PKG_DECL_PATTERN : return new PackageDeclarationLocator((PackageDeclarationPattern) pattern); case IIndexConstants.TYPE_REF_PATTERN : return new TypeReferenceLocator((TypeReferencePattern) pattern); case IIndexConstants.TYPE_DECL_PATTERN : return new TypeDeclarationLocator((TypeDeclarationPattern) pattern); case IIndexConstants.SUPER_REF_PATTERN : return new SuperTypeReferenceLocator((SuperTypeReferencePattern) pattern); case IIndexConstants.CONSTRUCTOR_PATTERN : return new ConstructorLocator((ConstructorPattern) pattern); case IIndexConstants.FIELD_PATTERN : return new FieldLocator((FieldPattern) pattern); case IIndexConstants.METHOD_PATTERN : return new MethodLocator((MethodPattern) pattern); case IIndexConstants.OR_PATTERN : return new OrLocator((OrPattern) pattern); case IIndexConstants.AND_PATTERN : return new AndLocator((AndPattern) pattern); case IIndexConstants.LOCAL_VAR_PATTERN : return new LocalVariableLocator((LocalVariablePattern) pattern); case IIndexConstants.TYPE_PARAM_PATTERN: return new TypeParameterLocator((TypeParameterPattern) pattern); } return null; } public static char[] qualifiedPattern(char[] simpleNamePattern, char[] qualificationPattern) {
if (compoundName != null && matchesName(this.pattern.pkgName, CharOperation.concatWith(compoundName, '.'))) { if (this.pattern.focus instanceof IPackageFragment && binding instanceof ReferenceBinding) { if (!isDeclaringPackageFragment((IPackageFragment) this.pattern.focus, (ReferenceBinding)binding)) return IMPOSSIBLE_MATCH;
protected int matchLevel(ImportReference importRef) { return matchLevelForTokens(importRef.tokens); } protected int matchLevelForTokens(char[][] tokens) {
protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { matchReportReference(reference, element, null, null, elementBinding, accuracy, locator); } protected void matchReportReference(ASTNode reference, IJavaElement element, IJavaElement localElement, IJavaElement[] otherElements, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException {
public int resolveLevel(ASTNode node) { if (node instanceof JavadocQualifiedTypeReference) { JavadocQualifiedTypeReference qualifRef = (JavadocQualifiedTypeReference) node; if (qualifRef.packageBinding != null) return resolveLevel(qualifRef.packageBinding); return resolveLevel(qualifRef.resolvedType); } if (node instanceof JavadocSingleTypeReference) { JavadocSingleTypeReference singleRef = (JavadocSingleTypeReference) node; if (singleRef.packageBinding != null) return resolveLevel(singleRef.packageBinding); return IMPOSSIBLE_MATCH; } if (node instanceof QualifiedTypeReference) return resolveLevel(((QualifiedTypeReference) node).resolvedType); if (node instanceof QualifiedNameReference) return this.resolveLevel((QualifiedNameReference) node); // if (node instanceof ImportReference) - Not called when resolve is true, see MatchingNodeSet.reportMatching(unit) return IMPOSSIBLE_MATCH; } public int resolveLevel(Binding binding) {
public int match(Annotation node, MatchingNodeSet nodeSet) { return match(node.type, nodeSet); } public int match(ASTNode node, MatchingNodeSet nodeSet) { // interested in ImportReference
@Override public int match(ASTNode node, MatchingNodeSet nodeSet) { // interested in ImportReference if (!(node instanceof ImportReference)) return IMPOSSIBLE_MATCH; return nodeSet.addMatch(node, matchLevel((ImportReference) node)); } //public int match(ConstructorDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
public static PatternLocator patternLocator(SearchPattern pattern) { switch (pattern.kind) { case IIndexConstants.PKG_REF_PATTERN : return new PackageReferenceLocator((PackageReferencePattern) pattern); case IIndexConstants.PKG_DECL_PATTERN : return new PackageDeclarationLocator((PackageDeclarationPattern) pattern); case IIndexConstants.TYPE_REF_PATTERN : return new TypeReferenceLocator((TypeReferencePattern) pattern); case IIndexConstants.TYPE_DECL_PATTERN : return new TypeDeclarationLocator((TypeDeclarationPattern) pattern); case IIndexConstants.SUPER_REF_PATTERN : return new SuperTypeReferenceLocator((SuperTypeReferencePattern) pattern); case IIndexConstants.CONSTRUCTOR_PATTERN : return new ConstructorLocator((ConstructorPattern) pattern); case IIndexConstants.FIELD_PATTERN : return new FieldLocator((FieldPattern) pattern); case IIndexConstants.METHOD_PATTERN : return new MethodLocator((MethodPattern) pattern); case IIndexConstants.OR_PATTERN : return new OrLocator((OrPattern) pattern); case IIndexConstants.AND_PATTERN : return new AndLocator((AndPattern) pattern); case IIndexConstants.LOCAL_VAR_PATTERN : return new LocalVariableLocator((LocalVariablePattern) pattern); case IIndexConstants.TYPE_PARAM_PATTERN: return new TypeParameterLocator((TypeParameterPattern) pattern); } return null; } public static char[] qualifiedPattern(char[] simpleNamePattern, char[] qualificationPattern) {
if (compoundName != null && matchesName(this.pattern.pkgName, CharOperation.concatWith(compoundName, '.'))) { if (this.pattern.focus instanceof IPackageFragment && binding instanceof ReferenceBinding) { if (!isDeclaringPackageFragment((IPackageFragment) this.pattern.focus, (ReferenceBinding)binding)) return IMPOSSIBLE_MATCH;
protected int matchLevel(ImportReference importRef) { return matchLevelForTokens(importRef.tokens); } protected int matchLevelForTokens(char[][] tokens) {