Changeset 745 in josm
- Timestamp:
- 2008-08-04T16:51:56+02:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r744 r745 22 22 import javax.swing.JLabel; 23 23 import javax.swing.JList; 24 import javax.swing.JOptionPane; 24 25 import javax.swing.JPanel; 25 26 import javax.swing.JScrollPane; … … 69 70 int sel = instance.getSelectedIndex(); 70 71 Layer l = layer != null ? layer : (Layer)instance.getSelectedValue(); 71 if (l instanceof OsmDataLayer && !DontShowAgainInfo.show("delete_layer", tr("Do you really want to delete the whole layer?"))) 72 return; 72 if (l instanceof OsmDataLayer) 73 { 74 if (((OsmDataLayer)l).isModified()) 75 { 76 if(JOptionPane.showConfirmDialog(instance, tr("There are unsaved changes. Delete the layer anwyay?"), 77 tr("Unsaved Changes"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) 78 return; 79 } 80 else if(!DontShowAgainInfo.show("delete_layer", tr("Do you really want to delete the whole layer?"), false)) 81 return; 82 } 73 83 Main.main.removeLayer(l); 74 84 if (sel >= instance.getModel().getSize()) -
trunk/src/org/openstreetmap/josm/tools/DontShowAgainInfo.java
r627 r745 17 17 18 18 public static boolean show(String prefKey, String msg) { 19 return show(prefKey, new JLabel(msg)); 19 return show(prefKey, new JLabel(msg), true); 20 } 21 22 public static boolean show(String prefKey, String msg, Boolean state) { 23 return show(prefKey, new JLabel(msg), state); 20 24 } 21 25 22 26 public static boolean show(String prefKey, Container msg) { 27 return show(prefKey, msg, true); 28 } 29 30 public static boolean show(String prefKey, Container msg, Boolean state) { 23 31 if (!Main.pref.getBoolean("message."+prefKey)) { 24 32 JCheckBox dontshowagain = new JCheckBox(tr("Do not show again")); 25 dontshowagain.setSelected(Main.pref.getBoolean("message."+prefKey, true));33 dontshowagain.setSelected(Main.pref.getBoolean("message."+prefKey, state)); 26 34 JPanel all = new JPanel(new GridBagLayout()); 27 35 all.add(msg, GBC.eop());
Note:
See TracChangeset
for help on using the changeset viewer.