- Timestamp:
- 2009-02-07T22:03:47+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r1356 r1373 30 30 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 31 31 import org.openstreetmap.josm.actions.mapmode.MapMode; 32 import org.openstreetmap.josm.actions.SaveAction; 32 33 import org.openstreetmap.josm.actions.search.SearchAction; 33 34 import org.openstreetmap.josm.data.Bounds; … … 37 38 import org.openstreetmap.josm.data.projection.Epsg4326; 38 39 import org.openstreetmap.josm.data.projection.Projection; 40 import org.openstreetmap.josm.gui.ExtendedDialog; 39 41 import org.openstreetmap.josm.gui.GettingStarted; 40 42 import org.openstreetmap.josm.gui.MainMenu; … … 340 342 } 341 343 if (modified) { 342 final String msg = uploadedModified ? "\n"+tr("Hint: Some changes came from uploading new data to the server.") : ""; 343 final int answer = JOptionPane.showConfirmDialog( 344 parent, tr("There are unsaved changes. Discard the changes and continue?")+msg, 345 tr("Unsaved Changes"), JOptionPane.YES_NO_OPTION); 346 if (answer != JOptionPane.YES_OPTION) 344 final String msg = uploadedModified ? "\n" 345 +tr("Hint: Some changes came from uploading new data to the server.") : ""; 346 int result = new ExtendedDialog(parent, tr("Unsaved Changes"), 347 new javax.swing.JLabel(tr("There are unsaved changes. Discard the changes and continue?")+msg), 348 new String[] {tr("Save and Exit"), tr("Discard and Exit"), tr("Cancel")}, 349 new String[] {"save.png", "exit.png", "cancel.png"}).getValue(); 350 351 // Save before exiting 352 if(result == 1) { 353 Boolean savefailed = false; 354 for (final Layer l : map.mapView.getAllLayers()) { 355 if (l instanceof OsmDataLayer && ((OsmDataLayer)l).isModified()) { 356 SaveAction save = new SaveAction(l); 357 if(!save.doSave()) 358 savefailed = true; 359 } 360 } 361 return savefailed; 362 } 363 else if(result != 2) // Cancel exiting unless the 2nd button was clicked 347 364 return true; 348 365 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1180 r1373 34 34 35 35 public void actionPerformed(ActionEvent e) { 36 doSave(); 37 } 38 39 public Boolean doSave() { 36 40 Layer layer = this.layer; 37 41 if (layer == null && Main.map != null && (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer … … 42 46 43 47 if (!checkSaveConditions(layer)) 44 return ;48 return false; 45 49 46 50 47 51 File file = getFile(layer); 48 52 if (file == null) 49 return ;53 return false; 50 54 51 55 save(file, layer); … … 54 58 layer.associatedFile = file; 55 59 Main.parent.repaint(); 60 return true; 56 61 } 57 62
Note:
See TracChangeset
for help on using the changeset viewer.