public static <T> T executeOnEdt(final @NotNull Computable<T> task) {
    final Application app = ApplicationManager.getApplication();
    final Ref<T> result = Ref.create();
    app.invokeAndWait(() -> result.set(task.compute()));
    return result.get();
  }
public static <T> T executeOnEdt(final @NotNull Computable<T> task)