private static void doRefactoring(@NotNull Project project,
                                    Editor editor,
                                    @NotNull ExtractMethodObjectProcessor processor,
                                    @NotNull ExtractMethodObjectProcessor.MyExtractMethodProcessor extractProcessor) {
    PostprocessReformattingAspect.getInstance(project).postponeFormattingInside(() -> {
      try {
        ApplicationManager.getApplication().runWriteAction(() -> extractProcessor.doRefactoring());
        processor.run();
        ApplicationManager.getApplication().runWriteAction(() -> processor.runChangeSignature());
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }

      PsiDocumentManager.getInstance(project).commitAllDocuments();
      if (processor.isCreateInnerClass()) {
        processor.moveUsedMethodsToInner();
        PsiDocumentManager.getInstance(project).commitAllDocuments();
        if (editor != null) {
          DuplicatesImpl.processDuplicates(extractProcessor, project, editor);
        }
      }
      ApplicationManager.getApplication().runWriteAction(() -> {
        if (processor.isCreateInnerClass()) {
          processor.changeInstanceAccess(project);
        }
        final PsiElement method = processor.getMethod();
        LOG.assertTrue(method != null);
        method.delete();
      });
    });
  }
private static void doRefactoring(@NotNull Project project,
                                    Editor editor,
                                    @NotNull ExtractMethodObjectProcessor processor,
                                    @NotNull ExtractMethodObjectProcessor.MyExtractMethodProcessor extractProcessor)