Changeset 3461 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2010-08-24T10:32:50+02:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r3435 r3461 25 25 import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter; 26 26 import org.openstreetmap.josm.data.osm.event.DataSetListenerAdapter.Listener; 27 import org.openstreetmap.josm.data.preferences.BooleanProperty; 27 28 import org.openstreetmap.josm.data.preferences.IntegerProperty; 28 29 import org.openstreetmap.josm.gui.MapView; … … 41 42 private static final String DELETED_LAYERS_DIR = "autosave/deleted_layers"; 42 43 43 44 public static final BooleanProperty PROP_AUTOSAVE_ENABLED = new BooleanProperty("autosave.enabled", true); 44 45 public static final IntegerProperty PROP_FILES_PER_LAYER = new IntegerProperty("autosave.filesPerLayer", 1); 45 46 public static final IntegerProperty PROP_DELETED_LAYERS = new IntegerProperty("autosave.deletedLayersBackupCount", 5); 46 47 public static final IntegerProperty PROP_INTERVAL = new IntegerProperty("autosave.interval", 5 * 60); 48 public static final IntegerProperty PROP_INDEX_LIMIT = new IntegerProperty("autosave.index-limit", 1000); 47 49 48 50 private static class AutosaveLayerInfo { … … 59 61 private final List<AutosaveLayerInfo> layersInfo = new ArrayList<AutosaveLayerInfo>(); 60 62 private Timer timer; 61 private Object layersLock = new Object();63 private final Object layersLock = new Object(); 62 64 private final Deque<File> deletedLayers = new LinkedList<File>(); 63 65 … … 136 138 else { 137 139 System.out.println(tr("Unable to create file {0}, other filename will be used", result.getAbsolutePath())); 140 if (index > PROP_INDEX_LIMIT.get()) 141 throw new IOException("index limit exceeded"); 138 142 } 139 143 } catch (IOException e) { … … 278 282 } 279 283 284 public void dicardUnsavedLayers() { 285 for (File f: getUnsavedLayersFiles()) { 286 f.renameTo(new File(deletedLayersDir, f.getName())); 287 } 288 } 280 289 281 290 } -
trunk/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java
r3451 r3461 22 22 } 23 23 24 /** 25 * parses and saves an integer value 26 * @param value the value to be parsed 27 * @return true - preference value has changed 28 * false - parsing failed or preference value has not changed 29 */ 30 public boolean parseAndPut(String value) { 31 Integer intVal; 32 try { 33 intVal = Integer.parseInt(value); 34 } catch (NumberFormatException ex) { 35 return false; 36 } 37 return put(intVal); 38 } 39 24 40 public String getKey() { 25 41 return key;
Note:
See TracChangeset
for help on using the changeset viewer.