@Override
  public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
    if (!(file instanceof PsiJavaFile)) return;

    int offset = editor.getCaretModel().getOffset();
    PsiElement context = getContext(file.findElementAt(offset));
    if (context == null) return;

    PsiClass targetClass = PsiTreeUtil.getParentOfType(context, PsiClass.class, false);

    if (!JigsawUtil.checkProviderMethodAccessible(targetClass)) return;
    if (!FileModificationService.getInstance().preparePsiElementsForWrite(targetClass)) return;

    WriteCommandAction.writeCommandAction(project, file)
      .run(() -> JigsawUtil.addProviderMethod(targetClass, editor, getOffset(context, offset)));
  }
@Override
  public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)