void (@NotNull SdkType type, @NotNull SdkDownloadTask item, @Nullable java.util.function.Consumer<? super Sdk> callback) { // we do not ask the SdkType to set up the SDK for us, instead, we return an incomplete SDK to the // model with an expectation it would be updated later on String suggestedName = item.getSuggestedSdkName(); String homeDir = FileUtil.toSystemIndependentName(item.getPlannedHomeDir()); if (WslPath.isWslUncPath(homeDir)) { suggestedName += " (WSL)"; } Sdk sdk = createSdk(type, suggestedName, homeDir); SdkDownloadTracker tracker = SdkDownloadTracker.getInstance(); tracker.registerSdkDownload(sdk, item); doAdd(sdk, (editableSdk) -> { tracker.registerEditableSdk(sdk, editableSdk); tracker.tryRegisterSdkDownloadFailureHandler(sdk, () -> removeSdk(editableSdk)); if (callback != null) { callback.accept(editableSdk); } }); tracker.startSdkDownloadIfNeeded(sdk); }