private @NotNull CompletableFuture<@Nullable List<Pair<VirtualFile,DownloadableFileDescription>>> downloadWithBackgroundProcess(final File targetDir,
                                                                                  Project project) {
    final Ref<List<Pair<File, DownloadableFileDescription>>> localFiles = Ref.create(null);
    final Ref<IOException> exceptionRef = Ref.create(null);

    CompletableFuture<List<Pair<VirtualFile, DownloadableFileDescription>>> result = new CompletableFuture<>();

    ProgressManager.getInstance().run(new Task.Backgroundable(project, myDialogTitle, true) {

      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        try {
          localFiles.set(download(targetDir));
        }
        catch (IOException exception) {
          final boolean tryAgain = IdeUiService.getInstance().showErrorDialog(myDialogTitle, exception.getMessage());
          if (tryAgain) {
            downloadWithBackgroundProcess(targetDir, project).thenAccept(pairs -> result.complete(pairs));
          }
          result.complete(null);
        }
      }

      @Override
      public void onSuccess() {
        List<Pair<File, DownloadableFileDescription>> files = localFiles.get();
        result.complete(files != null ? findVirtualFiles(files) : null);
      }

      @Override
      public void onCancel() {
        result.complete(null);
      }
    });

    return result;
  }
private @NotNull CompletableFuture<@Nullable List<Pair<VirtualFile,DownloadableFileDescription>>> downloadWithBackgroundProcess(final File targetDir,
                                                                                  Project project)