boolean (@NotNull JComponent parent, @NotNull SdkListItem item, @NotNull Consumer<? super SdkListItem> afterExecution) { Consumer<Sdk> onNewSdkAdded = sdk -> { reloadSdks(); SdkItem sdkItem = newSdkItem(sdk); afterExecution.consume(sdkItem); }; if (item instanceof ActionItem) { NewSdkAction action = ((ActionItem)item).action; action.actionPerformed(null, parent, onNewSdkAdded); return true; } if (item instanceof SuggestedItem suggestedItem) { String homePath = suggestedItem.homePath; ProgressManager.getInstance().run(new Task.Modal(myProject, ProjectBundle.message("progress.title.jdk.combo.box.resolving.jdk.home"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { indicator.setText(ProjectBundle.message("progress.text.jdk.combo.box.resolving.jdk.home", StringUtil.trimMiddle(homePath, 50))); // IDEA-237709 // make sure VFS has the right image of our SDK to avoid empty SDK from being created VfsUtil.markDirtyAndRefresh(false, true, true, new File(homePath)); } }); JdkDownloaderLogger.logDetected(JdkVersionDetector.getInstance().detectJdkVersionInfo(homePath)); mySdkModel.addSdk(suggestedItem.sdkType, homePath, onNewSdkAdded); return true; } return false; }