@Override
  public boolean setupSdkPaths(@NotNull final Sdk sdk, @NotNull SdkModel sdkModel) {
    final Sandbox additionalData = (Sandbox)sdk.getSdkAdditionalData();
    if (additionalData != null) {
      additionalData.cleanupWatchedRoots();
    }

    SdkModificator sdkModificator = sdk.getSdkModificator();

    boolean result = setupSdkPaths(sdk, sdkModificator, sdkModel);

    if (result && sdkModificator.getSdkAdditionalData() == null) {
      List<String> javaSdks = new ArrayList<>();
      Sdk[] sdks = sdkModel.getSdks();
      for (Sdk jdk : sdks) {
        if (isValidInternalJdk(sdk, jdk)) {
          javaSdks.add(jdk.getName());
        }
      }
      if (javaSdks.isEmpty()) {
        JavaSdkVersion requiredVersion = getRequiredJdkVersion(sdk);
        if (requiredVersion != null) {
          Messages.showErrorDialog(DevKitBundle.message("sdk.no.java.sdk.for.idea.sdk.found", requiredVersion),
                                   DevKitBundle.message("sdk.no.java.sdk.for.idea.sdk.found.title"));
        }
        else {
          Messages.showErrorDialog(DevKitBundle.message("sdk.no.idea.sdk.version.found"),
                                   DevKitBundle.message("sdk.no.java.sdk.for.idea.sdk.found.title"));
        }
        return false;
      }

      @NlsSafe String firstSdkName = javaSdks.get(0);
      Ref<Integer> choice = Ref.create();
      ApplicationManager.getApplication().invokeAndWait(() -> {
        choice.set(Messages.showChooseDialog(
          DevKitBundle.message("sdk.select.java.sdk"),
          DevKitBundle.message("sdk.select.java.sdk.title"),
          ArrayUtilRt.toStringArray(javaSdks), firstSdkName, Messages.getQuestionIcon()));
      });
      if (choice.get() != -1) {
        String name = javaSdks.get(choice.get());
        Sdk internalJava = Objects.requireNonNull(sdkModel.findSdk(name));
        //roots from internal jre
        setInternalJdk(sdk, sdkModificator, internalJava);
      }
      else {
        result = false;
      }
    }

    ApplicationManager.getApplication().runWriteAction(() -> sdkModificator.commitChanges());
    return result;
  }
@Override
  public boolean setupSdkPaths(@NotNull final Sdk sdk, @NotNull SdkModel sdkModel)