- Timestamp:
- 2014-04-09T23:03:16+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r6889 r6965 48 48 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 49 49 import org.openstreetmap.josm.gui.progress.SwingRenderingProgressMonitor; 50 import org.openstreetmap.josm.gui.util.GuiHelper; 50 51 import org.openstreetmap.josm.tools.ImageProvider; 51 52 import org.openstreetmap.josm.tools.WindowGeometry; … … 53 54 public class SaveLayersDialog extends JDialog implements TableModelListener { 54 55 public static enum UserAction { 55 /** 56 * save/upload layers was successful, proceed with operation 57 */ 56 /** save/upload layers was successful, proceed with operation */ 58 57 PROCEED, 59 /** 60 * save/upload of layers was not successful or user canceled operation 61 */ 58 /** save/upload of layers was not successful or user canceled operation */ 62 59 CANCEL 63 60 } … … 286 283 } 287 284 285 /** 286 * Closes this dialog and frees all native screen resources. 287 */ 288 288 public void closeDialog() { 289 289 setVisible(false); … … 556 556 @Override 557 557 public void run() { 558 model.setMode(SaveLayersModel.Mode.UPLOADING_AND_SAVING); 559 List<SaveLayerInfo> toUpload = model.getLayersToUpload(); 560 if (!toUpload.isEmpty()) { 561 uploadLayers(toUpload); 562 } 563 List<SaveLayerInfo> toSave = model.getLayersToSave(); 564 if (!toSave.isEmpty()) { 565 saveLayers(toSave); 566 } 567 model.setMode(SaveLayersModel.Mode.EDITING_DATA); 568 if (model.hasUnsavedData()) { 569 warnBecauseOfUnsavedData(); 570 model.setMode(Mode.EDITING_DATA); 571 if (canceled) { 572 setUserAction(UserAction.CANCEL); 573 closeDialog(); 574 } 575 } else { 576 setUserAction(UserAction.PROCEED); 577 closeDialog(); 578 } 558 GuiHelper.runInEDTAndWait(new Runnable() { 559 @Override 560 public void run() { 561 model.setMode(SaveLayersModel.Mode.UPLOADING_AND_SAVING); 562 List<SaveLayerInfo> toUpload = model.getLayersToUpload(); 563 if (!toUpload.isEmpty()) { 564 uploadLayers(toUpload); 565 } 566 List<SaveLayerInfo> toSave = model.getLayersToSave(); 567 if (!toSave.isEmpty()) { 568 saveLayers(toSave); 569 } 570 model.setMode(SaveLayersModel.Mode.EDITING_DATA); 571 if (model.hasUnsavedData()) { 572 warnBecauseOfUnsavedData(); 573 model.setMode(Mode.EDITING_DATA); 574 if (canceled) { 575 setUserAction(UserAction.CANCEL); 576 closeDialog(); 577 } 578 } else { 579 setUserAction(UserAction.PROCEED); 580 closeDialog(); 581 } 582 } 583 }); 579 584 } 580 585
Note:
See TracChangeset
for help on using the changeset viewer.