public static @NotNull DataContext getEditorDataContext(@NotNull Editor editor) {
    DataContext context = DataManager.getInstance().getDataContext(editor.getContentComponent());
    if (PROJECT.getData(context) == editor.getProject()) {
      return context;
    }
    return CustomizedDataContext.create(context, dataId -> {
      if (PROJECT.is(dataId)) {
        return Objects.requireNonNullElse(editor.getProject(), CustomizedDataContext.EXPLICIT_NULL);
      }
      return null;
    });
  }
public static @NotNull DataContext getEditorDataContext(@NotNull Editor editor)