void (final @NotNull ProgressIndicator indicator) { final byte[] bytes; try { LOG.info("Downloading sources JAR: " + myUrl); indicator.checkCanceled(); bytes = HttpRequests.request(myUrl).readBytes(indicator); } catch (IOException e) { LOG.warn(e); ApplicationManager.getApplication().invokeLater(() -> { String message = JavaUiBundle.message("error.message.failed.to.download.sources.0", myUrl); new Notification(myMessageGroupId, JavaUiBundle.message("notification.title.downloading.failed"), message, NotificationType.ERROR).notify(getProject()); callback.setDone(); }); return; } ApplicationManager.getApplication().invokeLater(() -> { try { WriteAction.run(() -> storeFile(bytes)); } finally { callback.setDone(); } }); }