boolean (@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); int choice = Messages.showChooseDialog( DevKitBundle.message("sdk.select.java.sdk"), DevKitBundle.message("sdk.select.java.sdk.title"), ArrayUtilRt.toStringArray(javaSdks), firstSdkName, Messages.getQuestionIcon()); if (choice != -1) { String name = javaSdks.get(choice); Sdk internalJava = Objects.requireNonNull(sdkModel.findSdk(name)); //roots from internal jre setInternalJdk(sdk, sdkModificator, internalJava); } else { result = false; } } sdkModificator.commitChanges(); return result; }