Changeset 3675 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-11-26T19:39:37+01:00 (14 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r3559 r3675 9 9 import java.io.IOException; 10 10 import java.util.ArrayList; 11 import java.util.Arrays; 11 12 import java.util.Date; 12 13 import java.util.Deque; … … 245 246 List<File> result = new ArrayList<File>(); 246 247 File[] files = autosaveDir.listFiles(); 248 System.err.println("autosave debug (getUnsavedLayersFiles) files="+(files == null ? null : Arrays.toString(files))); 247 249 if (files == null) 248 250 return result; 249 251 for (File file: files) { 252 System.err.println("autosave debug (getUnsavedLayersFiles) file="+file); 253 250 254 if (file.isFile()) { 255 System.err.println("autosave debug (getUnsavedLayersFiles) isFile"); 251 256 result.add(file); 252 257 } 253 258 } 259 System.err.println("autosave debug (getUnsavedLayersFiles) result="+result); 254 260 return result; 255 261 } … … 277 283 278 284 private void moveToDeletedLayersFolder(File f) { 285 System.err.println("autosave debug (moveToDeletedLayersFolder) f="+f); 286 System.err.println("autosave debug (moveToDeletedLayersFolder) f.getName="+f.getName()); 287 279 288 File backupFile = new File(deletedLayersDir, f.getName()); 289 290 System.err.println("autosave debug (moveToDeletedLayersFolder) backupFile="+backupFile); 280 291 if (backupFile.exists()) { 281 deletedLayers.remove(backupFile); 282 backupFile.delete(); 292 System.err.println("autosave debug (moveToDeletedLayersFolder) backupFile exisist"); 293 294 boolean res = deletedLayers.remove(backupFile); 295 296 System.err.println("autosave debug (moveToDeletedLayersFolder) res="+res); 297 298 boolean res2 = backupFile.delete(); 299 300 System.err.println("autosave debug (moveToDeletedLayersFolder) res2="+res2); 283 301 } 284 302 if (f.renameTo(backupFile)) { 303 System.err.println("autosave debug (moveToDeletedLayersFolder) rename ok"); 304 285 305 deletedLayers.add(backupFile); 306 307 System.err.println("autosave debug (moveToDeletedLayersFolder) deletedLayers="+deletedLayers); 286 308 } else { 287 309 System.err.println(String.format("Warning: Could not move autosaved file %s to %s folder", f.getName(), deletedLayersDir.getName())); 288 f.delete(); 310 boolean res3 = f.delete(); 311 312 System.err.println("autosave debug (moveToDeletedLayersFolder) res3="+res3); 289 313 } 290 314 while (deletedLayers.size() > PROP_DELETED_LAYERS.get()) { 291 deletedLayers.remove().delete(); 315 File next = deletedLayers.remove(); 316 317 System.err.println("autosave debug (moveToDeletedLayersFolder) next="+next); 318 319 boolean res4 = next.delete(); 320 321 System.err.println("autosave debug (moveToDeletedLayersFolder) res4="+res4); 292 322 } 293 323 } 294 324 295 325 public void dicardUnsavedLayers() { 296 for (File f: getUnsavedLayersFiles()) { 326 List<File> ulfs = getUnsavedLayersFiles(); 327 System.err.println("autosave debug (dicardUnsavedLayers) ulfs="+ulfs); 328 for (File f: ulfs) { 329 System.err.println("autosave debug (dicardUnsavedLayers) f="+f); 297 330 moveToDeletedLayersFolder(f); 298 331 } -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r3501 r3675 91 91 92 92 /** 93 * This method sets up the most basic options for the dialog. Add allmore93 * This method sets up the most basic options for the dialog. Add more 94 94 * advanced features with dedicated methods. 95 95 * Possible features: -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r3542 r3675 254 254 List<File> unsavedLayerFiles = autosaveTask.getUnsavedLayersFiles(); 255 255 if (!unsavedLayerFiles.isEmpty()) { 256 System.err.println("autosave debug: unsavedLayerFiles="+unsavedLayerFiles); 256 257 ExtendedDialog dialog = new ExtendedDialog( 257 258 Main.parent, … … 265 266 dialog.setButtonIcons(new String[] {"ok", "cancel", "dialogs/remove"}); 266 267 int selection = dialog.showDialog().getValue(); 268 System.err.println("autosave debug: user selection="+selection); 267 269 if (selection == 1) { 268 270 for (OsmDataLayer layer: autosaveTask.getUnsavedLayers()) { … … 271 273 AutoScaleAction.autoScale("data"); 272 274 } else if (selection == 3) { 275 System.err.println("autosave debug: discard autosaved layers"); 273 276 autosaveTask.dicardUnsavedLayers(); 277 System.err.println("autosave debug: discard autosaved layers [DONE]"); 274 278 } 275 279 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r3669 r3675 1 1 // License: GPL. See LICENSE file for details. 2 3 2 package org.openstreetmap.josm.gui; 4 3
Note:
See TracChangeset
for help on using the changeset viewer.