boolean (@NotNull Project project, @NotNull Editor editor, @NotNull PsiElement element) { if (!JavaLanguage.INSTANCE.equals(element.getLanguage())) return false; PsiMember member = findMember(element); if (!(member instanceof PsiNameIdentifierOwner)) return false; PsiElement identifier = ((PsiNameIdentifierOwner)member).getNameIdentifier(); if (identifier == null || identifier.getTextRange().getEndOffset() <= element.getTextRange().getStartOffset()) return false; List<AccessModifier> modifiers = new ArrayList<>(AccessModifier.getAvailableModifiers(member)); if (modifiers.isEmpty()) return false; if (!myErrorFix && !ContainerUtil.exists(modifiers, mod -> mod.hasModifier(member))) return false; modifiers.removeIf(mod -> mod.hasModifier(member)); if (modifiers.isEmpty()) return false; AccessModifier target = null; if (modifiers.size() == 1) { target = modifiers.get(0); String name = identifier.getText(); if (member instanceof PsiMethod) name += "()"; setText(QuickFixBundle.message("add.modifier.fix", name, target)); } else { setText(getFamilyName()); } myTarget = target; return true; }