@Override
  public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) {
    if (!EditorModificationUtil.checkModificationAllowed(editor)) return;
    if (!FileDocumentManager.getInstance().requestWriting(editor.getDocument(), project)) {
      return;
    }

    final PsiElementClassMember target = chooseTarget(file, editor, project);
    if (target == null) return;

    DumbService dumbService = DumbService.getInstance(project);
    final PsiMethodMember[] candidates = dumbService.computeWithAlternativeResolveEnabled(
      () -> chooseMethods(target, file, editor, project));
    if (candidates == null || candidates.length == 0) return;

    ApplicationManager.getApplication().runWriteAction(() -> {
      try {
        int offset = editor.getCaretModel().getOffset();

        List<PsiGenerationInfo<PsiMethod>> prototypes = new ArrayList<>(candidates.length);
        DumbModeAccessType.RELIABLE_DATA_ONLY.ignoreDumbMode(
          () -> {
            for (PsiMethodMember candidate : candidates) {
              prototypes.add(generateDelegatePrototype(candidate, target.getElement()));
            }
          });

        List<PsiGenerationInfo<PsiMethod>> results = dumbService.computeWithAlternativeResolveEnabled(
          () -> GenerateMembersUtil.insertMembersAtOffset(file, offset, prototypes));

        if (!results.isEmpty()) {
          PsiMethod firstMethod = results.get(0).getPsiMember();
          final PsiCodeBlock block = firstMethod.getBody();
          assert block != null;
          final PsiElement first = block.getFirstBodyElement();
          assert first != null;
          editor.getCaretModel().moveToOffset(first.getTextRange().getStartOffset());
          editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
          editor.getSelectionModel().removeSelection();
        }
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    });
  }
@Override
  public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file)