public void configureSdk(@NotNull Sdk sdk, @NotNull SdkDownloadTask task) {
    SdkModificator mod = sdk.getSdkModificator();
    mod.setHomePath(FileUtil.toSystemIndependentName(task.getPlannedHomeDir()));
    mod.setVersionString(task.getPlannedVersion());

    Application application = ApplicationManager.getApplication();
    Runnable runnable = () -> mod.commitChanges();
    if (application.isDispatchThread()) {
      application.runWriteAction(runnable);
    } else {
      application.invokeAndWait(() -> application.runWriteAction(runnable));
    }
  }
public void configureSdk(@NotNull Sdk sdk, @NotNull SdkDownloadTask task)