Changeset 27856 in osm for applications/viewer/jmapviewer/src/org
- Timestamp:
- 2012-02-18T14:23:10+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/OsmFileCacheTileLoader.java
r26909 r27856 477 477 } 478 478 479 public static interface TileClearController { 480 481 void initClearDir(File dir); 482 483 void initClearFiles(File[] files); 484 485 boolean cancel(); 486 487 void fileDeleted(File file); 488 489 void clearFinished(); 490 } 491 479 492 public void clearCache(TileSource source) { 493 clearCache(source, null); 494 } 495 496 public void clearCache(TileSource source, TileClearController controller) { 480 497 File dir = getSourceCacheDir(source); 481 if (dir.isDirectory()) { 482 for (File file : dir.listFiles()) { 483 file.delete(); 484 } 485 } 486 dir.delete(); 498 if (dir != null) { 499 if (controller != null) controller.initClearDir(dir); 500 if (dir.isDirectory()) { 501 File[] files = dir.listFiles(); 502 if (controller != null) controller.initClearFiles(files); 503 for (File file : files) { 504 if (controller != null && controller.cancel()) return; 505 file.delete(); 506 if (controller != null) controller.fileDeleted(file); 507 } 508 } 509 dir.delete(); 510 } 511 if (controller != null) controller.clearFinished(); 487 512 } 488 513 }
Note:
See TracChangeset
for help on using the changeset viewer.