Changeset 6357 in josm
- Timestamp:
- 2013-11-02T21:28:24+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r6248 r6357 34 34 import org.openstreetmap.josm.gui.MapView; 35 35 import org.openstreetmap.josm.gui.MapView.LayerChangeListener; 36 import org.openstreetmap.josm.gui.Notification; 36 37 import org.openstreetmap.josm.gui.layer.Layer; 37 38 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 39 import org.openstreetmap.josm.gui.util.GuiHelper; 38 40 import org.openstreetmap.josm.io.OsmExporter; 39 41 import org.openstreetmap.josm.io.OsmImporter; … … 67 69 public static final IntegerProperty PROP_INTERVAL = new IntegerProperty("autosave.interval", 5 * 60); 68 70 public static final IntegerProperty PROP_INDEX_LIMIT = new IntegerProperty("autosave.index-limit", 1000); 71 /** Defines if a notification should be displayed after each autosave */ 72 public static final BooleanProperty PROP_NOTIFICATION = new BooleanProperty("autosave.notification", false); 69 73 70 74 private static class AutosaveLayerInfo { … … 205 209 } 206 210 changedDatasets.clear(); 211 if (PROP_NOTIFICATION.get() && !layersInfo.isEmpty()) { 212 displayNotification(); 213 } 207 214 } catch (Throwable t) { 208 215 // Don't let exception stop time thread … … 212 219 } 213 220 } 221 } 222 223 protected void displayNotification() { 224 GuiHelper.runInEDT(new Runnable() { 225 @Override 226 public void run() { 227 new Notification(tr("Your work has been saved automatically.")) 228 .setDuration(Notification.TIME_SHORT) 229 .show(); 230 } 231 }); 214 232 } 215 233 -
trunk/src/org/openstreetmap/josm/gui/Notification.java
r6340 r6357 58 58 private String helpTopic; 59 59 60 /** 61 * Constructs a new {@code Notification} without content. 62 */ 60 63 public Notification() { 61 64 duration = NotificationManager.defaultNotificationTime; 62 65 } 63 66 67 /** 68 * Constructs a new {@code Notification} with the given textual content. 69 * @param msg The text to display 70 */ 64 71 public Notification(String msg) { 65 72 this(); -
trunk/src/org/openstreetmap/josm/gui/preferences/map/BackupPreference.java
r6084 r6357 23 23 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 24 24 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 25 import org.openstreetmap.josm.gui.widgets.JosmTextField; 25 26 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 26 27 import org.openstreetmap.josm.tools.GBC; 27 import org.openstreetmap.josm.gui.widgets.JosmTextField;28 28 29 29 public class BackupPreference implements SubPreferenceSetting { … … 36 36 } 37 37 private static final BooleanProperty PROP_KEEP_BACKUP = new BooleanProperty("save.keepbackup", false); 38 private JCheckBox notification; 38 39 private JCheckBox keepBackup; 39 40 private JCheckBox autosave; … … 84 85 GBC.eop().fill(GBC.HORIZONTAL).insets(5,0,0,0)); 85 86 87 panel.add(new JSeparator(), GBC.eop().fill(GBC.HORIZONTAL)); 88 89 notification = new JCheckBox(tr("Notification at each save")); 90 notification.setSelected(AutosaveTask.PROP_NOTIFICATION.get()); 91 notification.setToolTipText(tr("When saving, display a small notification")); 92 panel.add(notification, GBC.eop()); 93 86 94 ActionListener autosaveEnabled = new ActionListener(){ 87 95 @Override … … 113 121 restartRequired |= AutosaveTask.PROP_INTERVAL.parseAndPut(autosaveInterval.getText()); 114 122 AutosaveTask.PROP_FILES_PER_LAYER.parseAndPut(backupPerLayer.getText()); 123 AutosaveTask.PROP_NOTIFICATION.put(notification.isSelected()); 115 124 return restartRequired; 116 125 }
Note:
See TracChangeset
for help on using the changeset viewer.