Search in sources :

Example 1 with MethodTextOccurrenceProcessor

use of com.intellij.psi.impl.search.MethodTextOccurrenceProcessor in project intellij-community by JetBrains.

the class GrLiteralMethodSearcher method processQuery.

@Override
public void processQuery(@NotNull MethodReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> consumer) {
    final PsiMethod method = p.getMethod();
    final PsiClass aClass = method.getContainingClass();
    if (aClass == null)
        return;
    final String name = method.getName();
    if (StringUtil.isEmpty(name))
        return;
    final boolean strictSignatureSearch = p.isStrictSignatureSearch();
    final PsiMethod[] methods = strictSignatureSearch ? new PsiMethod[] { method } : aClass.findMethodsByName(name, false);
    SearchScope accessScope = GroovyScopeUtil.getEffectiveScope(methods);
    final SearchScope restrictedByAccess = GroovyScopeUtil.restrictScopeToGroovyFiles(p.getEffectiveSearchScope(), accessScope);
    final String textToSearch = findLongestWord(name);
    p.getOptimizer().searchWord(textToSearch, restrictedByAccess, UsageSearchContext.IN_STRINGS, true, method, new MethodTextOccurrenceProcessor(aClass, strictSignatureSearch, methods));
}
Also used : PsiMethod(com.intellij.psi.PsiMethod) PsiClass(com.intellij.psi.PsiClass) SearchScope(com.intellij.psi.search.SearchScope) MethodTextOccurrenceProcessor(com.intellij.psi.impl.search.MethodTextOccurrenceProcessor)

Aggregations

PsiClass (com.intellij.psi.PsiClass)1 PsiMethod (com.intellij.psi.PsiMethod)1 MethodTextOccurrenceProcessor (com.intellij.psi.impl.search.MethodTextOccurrenceProcessor)1 SearchScope (com.intellij.psi.search.SearchScope)1