Changeset 8913 in josm for trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
- Timestamp:
- 2015-10-19T23:30:55+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r8802 r8913 64 64 @Override 65 65 public void actionPerformed(ActionEvent e) { 66 try { 67 saveSession(); 68 } catch (CancelException ignore) { 69 } 70 } 71 72 /** 73 * Denotes that the user has cancelled the save process. 74 * @since 8913 75 */ 76 public static class CancelException extends Exception { 77 } 78 79 /** 80 * Attempts to save the session. 81 * @throws CancelException when the user has cancelled the save process. 82 * @since 8913 83 */ 84 public void saveSession() throws CancelException { 66 85 if (!isEnabled()) { 67 86 return; … … 70 89 SessionSaveAsDialog dlg = new SessionSaveAsDialog(); 71 90 dlg.showDialog(); 72 if (dlg.getValue() != 1) return; 91 if (dlg.getValue() != 1) { 92 throw new CancelException(); 93 } 73 94 74 95 boolean zipRequired = false; … … 93 114 } 94 115 95 if (fc == null) 96 return; 116 if (fc == null) { 117 throw new CancelException(); 118 } 97 119 98 120 File file = fc.getSelectedFile(); … … 116 138 if (fn.indexOf('.') == -1) { 117 139 file = new File(file.getPath() + (zip ? ".joz" : ".jos")); 118 if (!SaveActionBase.confirmOverwrite(file)) 119 return; 140 if (!SaveActionBase.confirmOverwrite(file)) { 141 throw new CancelException(); 142 } 120 143 } 121 144
Note:
See TracChangeset
for help on using the changeset viewer.