void (@NotNull final Project project, @NotNull ProblemDescriptor descriptor) { boolean tryAgain = true; final DownloadManager.DownloadException[] ex = new DownloadManager.DownloadException[1]; final Runnable runnable = () -> { final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); final DownloadManager downloadManager = new MyDownloadManager(project, progress); try { downloadManager.fetch(myLocation); } catch (DownloadManager.DownloadException e) { ex[0] = e; } }; while (tryAgain) { tryAgain = false; if (ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, XPathBundle.message("progress.title.downloading.resource"), true, project)) { if (ex[0] != null) { tryAgain = IOExceptionDialog.showErrorDialog(XPathBundle.message("dialog.title.error.during.download"), XPathBundle.message("text.error.downloading", ex[0].getLocation())); ex[0] = null; } else { break; } } } }