@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
    final PsiElement leaf = file.findElementAt(editor.getCaretModel().getOffset());
    PsiAnnotation annotation = PsiTreeUtil.getParentOfType(leaf, PsiAnnotation.class);
    assert annotation != null;
    
    final PsiModifierListOwner owner = PsiTreeUtil.getParentOfType(annotation, PsiModifierListOwner.class);
    assert owner != null;
    
    ExternalAnnotationsManager externalAnnotationsManager = ExternalAnnotationsManager.getInstance(project);

    if (!FileModificationService.getInstance().preparePsiElementsForWrite(getFilesToWrite(file, owner, externalAnnotationsManager))) return;

    String qualifiedName = annotation.getQualifiedName();
    assert qualifiedName != null;
    try {
      externalAnnotationsManager.annotateExternally(owner, qualifiedName, file, annotation.getParameterList().getAttributes());
    }
    catch (ExternalAnnotationsManager.CanceledConfigurationException e) {
      return;
    }

    WriteAction.run(annotation::delete);
  }
@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file)