@Override public void run() { GuiHelper.runInEDTAndWait( () -> { model.setMode(SaveLayersModel.Mode.UPLOADING_AND_SAVING); List<SaveLayerInfo> toUpload = model.getLayersToUpload(); if (!toUpload.isEmpty()) { uploadLayers(toUpload); } List<SaveLayerInfo> toSave = model.getLayersToSave(); if (!toSave.isEmpty()) { saveLayers(toSave); } model.setMode(SaveLayersModel.Mode.EDITING_DATA); if (model.hasUnsavedData()) { warnBecauseOfUnsavedData(); model.setMode(Mode.EDITING_DATA); if (canceled) { setUserAction(UserAction.CANCEL); closeDialog(); } } else { setUserAction(UserAction.PROCEED); closeDialog(); } }); worker.shutdownNow(); }
protected void cancelSafeAndUploadTask() { if (this.saveAndUploadTask != null) { this.saveAndUploadTask.cancel(); } model.setMode(Mode.EDITING_DATA); }