private void reformatBlockParentIfNeeded(@NotNull Editor editor, @NotNull PsiFile file) {
    commit(editor);
    ASTNode block =
      BasicJavaAstTreeUtil.findElementOfClassAtOffset(file, editor.getCaretModel().getOffset(), BASIC_CODE_BLOCK, false);
    if (block != null &&
        BasicJavaAstTreeUtil.is(block.getTreeParent(), BASIC_BLOCK_STATEMENT) &&
        BasicJavaAstTreeUtil.is(block.getTreeParent().getTreeParent(), BASIC_FOR_STATEMENT)) {
      reformat(block.getTreeParent().getTreeParent().getPsi());
    }
    if (block != null && BasicJavaAstTreeUtil.is(block.getTreeParent(), BASIC_SWITCH_EXPRESSION)) {
      reformat(block.getTreeParent().getPsi());
    }
  }
private void reformatBlockParentIfNeeded(@NotNull Editor editor, @NotNull PsiFile file)