@Override
  public void beforeReformatText(@NotNull PsiFile file) {
    Editor editor = PsiEditorUtil.findEditor(file);
    if (editor != null) {
      EditorStateKeeper editorStateKeeper = new EditorStateKeeper(editor, CodeStyle.getSettings(file), file.getLanguage());
      file.putUserData(EDITOR_STATE_KEY, editorStateKeeper);
    }
  }
@Override
  public void beforeReformatText(@NotNull PsiFile file)