ModCommand (@NotNull ActionContext context) { PsiModifierListOwner listOwner = AddAnnotationPsiFix.getContainer(context.file(), context.offset(), true); if (listOwner == null) return ModCommand.nop(); var annotationsManager = ObjectUtils.tryCast(ExternalAnnotationsManager.getInstance(context.project()), ModCommandAwareExternalAnnotationsManager.class); if (annotationsManager == null) return ModCommand.nop(); if (myAnnotationName != null) { return annotationsManager.deannotateModCommand(List.of(listOwner), List.of(myAnnotationName)); } final PsiAnnotation[] externalAnnotations = annotationsManager.findExternalAnnotations(listOwner); if (externalAnnotations == null) return ModCommand.nop(); return new ModChooseAction(JavaBundle.message("deannotate.intention.chooser.title"), ContainerUtil.map(externalAnnotations, anno -> new DeannotateIntentionAction( Objects.requireNonNull(anno.getQualifiedName())))); }