| 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"+tr("Hint: Some changes came from uploading new data to the server.") : ""; |
| | 345 | int result = new ExtendedDialog(parent, |
| | 346 | 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 | for (final Layer l : map.mapView.getAllLayers()) { |
| | 354 | if (l instanceof OsmDataLayer && ((OsmDataLayer)l).isModified()) { |
| | 355 | SaveAction save = new SaveAction(l); |
| | 356 | save.actionPerformed(null); |
| | 357 | } |
| | 358 | } |
| | 359 | return false; |
| | 360 | } |
| | 361 | |
| | 362 | // Cancel exiting unless the 2nd button was clicked |
| | 363 | if(result != 2) |