void (@NotNull SdkDownloadTask task, @NotNull List<? extends Sdk> sdks, @NotNull ProgressIndicator indicator) { ApplicationManager.getApplication().assertIsNonDispatchThread(); if (sdks.isEmpty()) throw new IllegalArgumentException("There must be at least one SDK in the list for " + task); @NotNull Sdk sdk = Objects.requireNonNull(ContainerUtil.getFirstItem(sdks)); var tracker = new PendingDownloadModalityTracker() { @Override public void updateModality() { } @Override public void invokeLater(@NotNull Runnable r) { //we need to make sure our tasks are executed in-place for the blocking mode ApplicationManager.getApplication().invokeAndWait(r); } }; PendingDownload pd = new PendingDownload(sdk, task, tracker) { @Override protected void runTask(@NotNull @NlsContexts.ProgressTitle String title, @NotNull Progressive progressive) { indicator.pushState(); try { progressive.run(indicator); } finally { indicator.popState(); } } @Override protected void handleDownloadError(@NotNull SdkType type, @NotNull @Nls String title, @NotNull Throwable exception) { throw new RuntimeException("Failed to download and configure " + type.getPresentableName() + " for " + myEditableSdks.copy() + ". " + exception.getMessage(), exception); } }; myPendingTasks.add(pd); tracker.invokeLater(() -> sdks.forEach(pd::configureSdk)); for (Sdk otherSdk : sdks) { if (otherSdk == sdk) continue; pd.registerEditableSdk(otherSdk); } pd.startDownloadIfNeeded(sdk); }