private static @NotNull DataContext prepareContext(@NotNull Project project, @NotNull Editor editor) {
    // There is a possible case that formatting is performed from project view and editor is not opened yet. The problem is that
    // its data context doesn't contain information about project then. So, we explicitly support that here (see IDEA-72791).
    Project editorProject = editor.getProject();
    DataContext context = EditorUtil.getEditorDataContext(editor);
    if (editorProject != null) return context;
    return SimpleDataContext.getSimpleContext(PROJECT, project, context);
  }
private static @NotNull DataContext prepareContext(@NotNull Project project, @NotNull Editor editor)