boolean (@NotNull Project project, Editor editor, PsiFile file) { PsiAnnotation annotation = PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PsiAnnotation.class); if (annotation != null && annotation.getQualifiedName() != null && annotation.getManager().isInProject(annotation)) { PsiModifierListOwner modifierListOwner = PsiTreeUtil.getParentOfType(annotation, PsiModifierListOwner.class); if (modifierListOwner != null && ExternalAnnotationsManagerImpl.areExternalAnnotationsApplicable(modifierListOwner)) { VirtualFile virtualFile = PsiUtilCore.getVirtualFile(modifierListOwner); if (JavaCodeStyleSettings.getInstance(file).USE_EXTERNAL_ANNOTATIONS || virtualFile != null && ExternalAnnotationsManager.getInstance(project).hasAnnotationRootsForFile(virtualFile)) { setText(JavaBundle.message("intention.text.annotate.externally")); return true; } } } return false; }