private void process(@NotNull final Editor editor, @NotNull final PsiFile file, final int attempt, boolean afterCompletion)
    throws TooManyAttemptsException {
    if (attempt > MAX_ATTEMPTS) throw new TooManyAttemptsException();

    try {
      commit(editor);
      if (myFirstErrorOffset != Integer.MAX_VALUE) {
        editor.getCaretModel().moveToOffset(myFirstErrorOffset);
      }

      myFirstErrorOffset = Integer.MAX_VALUE;

      PsiElement atCaret = getStatementAtCaret(editor, file);
      if (atCaret == null) {
        if (myJavadocFixer.process(editor, file)) {
          return;
        }
        if (!(myBreakerEnterProcessor).doEnter(editor, file, false)) {
          plainEnter(editor);
        }
        return;
      }

      List<ASTNode> queue = new ArrayList<>();
      ASTNode caretNode = atCaret.getNode();
      collectAllElements(caretNode, queue, true);
      queue.add(caretNode);

      for (ASTNode astNode : queue) {
        for (Fixer fixer : ourFixers) {
          Document document = editor.getDocument();
          int offset = myFirstErrorOffset;
          long stamp = document.getModificationStamp();
          fixer.apply(editor, this, astNode);
          Project project = file.getProject();
          if (document.getModificationStamp() != stamp || offset != myFirstErrorOffset) {
            log(fixer, project);
          }
          if (LookupManager.getInstance(project).getActiveLookup() != null) {
            return;
          }
          PsiElement psi = BasicJavaAstTreeUtil.toPsi(astNode);
          if (isUncommited(project) || !(psi != null && psi.isValid())) {
            moveCaretInsideBracesIfAny(editor, file);
            process(editor, file, attempt + 1, afterCompletion);
            return;
          }
        }
      }

      doEnter(atCaret, editor, afterCompletion);
    }
    catch (IncorrectOperationException e) {
      LOG.error(e);
    }
  }
private void process(@NotNull final Editor editor, @NotNull final PsiFile file, final int attempt, boolean afterCompletion)