@Override
  public void reformat(PsiElement atCaretElement) throws IncorrectOperationException {
    if (atCaretElement == null) {
      return;
    }
    ASTNode atCaret = atCaretElement.getNode();
    ASTNode parent = atCaret.getTreeParent();
    if (BasicJavaAstTreeUtil.is(parent, BASIC_FOR_STATEMENT)) {
      atCaret = parent;
    }

    if (BasicJavaAstTreeUtil.is(parent, BASIC_IF_STATEMENT) &&
        atCaret == BasicJavaAstTreeUtil.getElseBranch(parent)) {
      PsiFile file = atCaretElement.getContainingFile();
      Document document = file.getViewProvider().getDocument();
      if (document != null) {
        TextRange elseIfRange = atCaret.getTextRange();
        int lineStart = document.getLineStartOffset(document.getLineNumber(elseIfRange.getStartOffset()));
        CodeStyleManager.getInstance(atCaretElement.getProject()).reformatText(file, lineStart, elseIfRange.getEndOffset());
        return;
      }
    }

    super.reformat(atCaretElement);
  }
@Override
  public void reformat(PsiElement atCaretElement)