boolean (@NotNull File file, @Nullable TargetEnvironmentRequest request, @NotNull TargetEnvironment remoteEnvironment, @Nullable TargetProgressIndicator indicator, @Nullable Runnable afterUploadCallback) { if (request == null || request instanceof LocalTargetEnvironmentRequest) { return false; } ApplicationManager.getApplication().executeOnPooledThread(() -> { Path parentPath = file.toPath().getParent(); for (TargetEnvironment.UploadRoot uploadRoot : request.getUploadVolumes()) { if (parentPath.equals(uploadRoot.getLocalRootPath())) { TargetProgressIndicator targetProgressIndicator = Objects.requireNonNull(indicator); try { remoteEnvironment.getUploadVolumes().get(uploadRoot).upload(file.getName(), targetProgressIndicator); } catch (Throwable t) { LOG.warn(t); targetProgressIndicator.addSystemLine(""); targetProgressIndicator.stopWithErrorMessage( ExecutionBundle.message("dialog.message.failed.to.reupload", file.getName(), StringUtil.notNullize(t.getLocalizedMessage()))); } if (afterUploadCallback != null) { afterUploadCallback.run(); } return; } } LOG.error("Did not find upload volume for " + parentPath); if (afterUploadCallback != null) { afterUploadCallback.run(); } }); return true; }