mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
SSR: find annotations in more places
This commit is contained in:
-12
@@ -589,18 +589,6 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor {
|
||||
}
|
||||
|
||||
private MatchingStrategy findStrategy(PsiElement el) {
|
||||
// identify matching strategy
|
||||
final MatchingHandler handler = myCompilingVisitor.getContext().getPattern().getHandler(el);
|
||||
|
||||
//if (handler instanceof SubstitutionHandler) {
|
||||
// final SubstitutionHandler shandler = (SubstitutionHandler) handler;
|
||||
if (handler.getFilter() instanceof SymbolNodeFilter ||
|
||||
handler.getFilter() instanceof TypedSymbolNodeFilter
|
||||
) {
|
||||
return SymbolMatchingStrategy.getInstance();
|
||||
}
|
||||
//}
|
||||
|
||||
if (el instanceof PsiDocComment) {
|
||||
return JavaDocMatchingStrategy.getInstance();
|
||||
}
|
||||
|
||||
+21
@@ -7,6 +7,27 @@ import com.intellij.psi.*;
|
||||
*/
|
||||
public class ExprMatchingStrategy extends MatchingStrategyBase {
|
||||
|
||||
@Override
|
||||
public void visitTypeElement(PsiTypeElement type) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitReferenceParameterList(PsiReferenceParameterList psiReferenceParameterList) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitReferenceElement(PsiJavaCodeReferenceElement psiJavaCodeReferenceElement) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitTypeParameterList(PsiTypeParameterList psiTypeParameterList) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitReferenceList(final PsiReferenceList list) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitAnnotation(final PsiAnnotation annotation) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
package com.intellij.structuralsearch.impl.matcher.strategies;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
|
||||
/**
|
||||
* CommonStrategy to match symbols
|
||||
*/
|
||||
public class SymbolMatchingStrategy extends ExprMatchingStrategy {
|
||||
@Override public void visitReferenceList(final PsiReferenceList list) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitAnnotation(final PsiAnnotation annotation) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitAnnotationParameterList(final PsiAnnotationParameterList list) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitModifierList(final PsiModifierList list) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitNameValuePair(final PsiNameValuePair pair) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitTypeParameterList(PsiTypeParameterList psiTypeParameterList) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitTypeElement(PsiTypeElement psiTypeElement) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitReferenceElement(PsiJavaCodeReferenceElement psiJavaCodeReferenceElement) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
@Override public void visitReferenceParameterList(PsiReferenceParameterList psiReferenceParameterList) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
private SymbolMatchingStrategy() {}
|
||||
|
||||
private static class SymbolMatchingStrategyHolder {
|
||||
private static final SymbolMatchingStrategy instance = new SymbolMatchingStrategy();
|
||||
}
|
||||
|
||||
public static MatchingStrategy getInstance() {
|
||||
return SymbolMatchingStrategyHolder.instance;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user