private void commitChanges(Project project, Editor editor, PsiFile psiFile, int caretOffset, @Nullable XmlTag tagToReformat) {
    if (isUncommited(project)) {
      commit(editor);
      if (tagToReformat == null) {
        tagToReformat = PsiTreeUtil.getParentOfType(getStatementAtCaret(editor, psiFile), XmlTag.class);
      }
      editor.getCaretModel().moveToOffset(caretOffset);
    }
    if (tagToReformat != null) {
      reformat(tagToReformat);
    }
    commit(editor);
  }
private void commitChanges(Project project, Editor editor, PsiFile psiFile, int caretOffset, @Nullable XmlTag tagToReformat)