FindUsagesHandler (@NotNull PsiElement element, @NotNull OperationMode operationMode) { return new JavaFindUsagesHandler(element, this) { @Override public PsiElement @NotNull [] getSecondaryElements() { PsiElement element = getPsiElement(); final PsiField field = (PsiField)element; PsiClass containingClass = field.getContainingClass(); if (containingClass != null) { PsiMethod[] getters = GroovyPropertyUtils.getAllGettersByField(field); PsiMethod[] setters = GroovyPropertyUtils.getAllSettersByField(field); if (getters.length + setters.length > 0) { final boolean doSearch; if (arePhysical(getters) || arePhysical(setters)) { if (ApplicationManager.getApplication().isUnitTestMode()) return PsiElement.EMPTY_ARRAY; doSearch = getFindVariableOptions().isSearchForAccessors; } else { doSearch = true; } if (doSearch) { final List<PsiElement> elements = new ArrayList<>(); if (getFindVariableOptions().isSearchForBaseAccessors) { for (PsiMethod getter : getters) { ContainerUtil.addAll(elements, SuperMethodWarningUtil.getTargetMethodCandidates(getter, Collections.emptyList())); } for (PsiMethod setter : setters) { ContainerUtil.addAll(elements, SuperMethodWarningUtil.getTargetMethodCandidates(setter, Collections.emptyList())); } } for (Iterator<PsiElement> iterator = elements.iterator(); iterator.hasNext(); ) { if (iterator.next() instanceof GrAccessorMethod) iterator.remove(); } return PsiUtilCore.toPsiElementArray(elements); } else { return PsiElement.EMPTY_ARRAY; } } } return super.getSecondaryElements(); } }; }