boolean (@NotNull PsiElement element, @NotNull Editor editor, @NotNull PsiFile file, @NotNull DataContext context, @NotNull String place) { if (!file.isValid()) return false; PsiElement targetElement = element; if (place.equals(ActionPlaces.REFACTORING_QUICKLIST)) { PsiElement caretElement = BaseRefactoringAction.getElementAtCaret(editor, file); if (! PsiTreeUtil.isAncestor(element, caretElement, false)) { targetElement = caretElement; } } return isAvailableOnElementInEditorAndFile(targetElement, editor, file, context); }