private void downloadJar(@NotNull String jarUrl, @NotNull String jarName) {
    Project project = myModule.getProject();
    String dirPath = PropertiesComponent.getInstance(project).getValue(FIND_JAR_LAST_USED_DIR_PROPERTY);
    VirtualFile toSelect = dirPath == null ? null : LocalFileSystem.getInstance().findFileByIoFile(new File(dirPath));
    FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(
      JavaBundle.message("chooser.title.select.path.to.save.jar"))
      .withDescription(JavaBundle.message("chooser.text.choose.where.to.save.0", jarName));
    VirtualFile file = FileChooser.chooseFile(descriptor, project, toSelect);
    if (file != null) {
      PropertiesComponent.getInstance(project).setValue(FIND_JAR_LAST_USED_DIR_PROPERTY, file.getPath());
      DownloadableFileService downloader = DownloadableFileService.getInstance();
      DownloadableFileDescription description = downloader.createFileDescription(jarUrl, jarName);
      List<VirtualFile> jars =
        downloader.createDownloader(Collections.singletonList(description), jarName)
                  .downloadFilesWithProgress(file.getPath(), project, myEditorComponent);
      if (jars != null && jars.size() == 1) {
        WriteAction.run(() -> OrderEntryFix.addJarToRoots(jars.get(0).getPresentableUrl(), myModule, myRef));
      }
    }
  }
private void downloadJar(@NotNull String jarUrl, @NotNull String jarName)