Changeset 18278 in josm for trunk/src/org
- Timestamp:
- 2021-10-17T06:14:05+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/street_level/IImageEntry.java
r18246 r18278 8 8 import java.time.Instant; 9 9 import java.util.List; 10 10 11 import javax.imageio.IIOParam; 11 12 … … 16 17 * An interface for image entries that will be shown in {@link org.openstreetmap.josm.gui.layer.geoimage.ImageDisplay} 17 18 * @author Taylor Smock 19 * @param <I> type of image 18 20 * @since 18246 19 21 */ … … 94 96 95 97 /** 98 * Delete the image 99 * @return {@code true} if deletion was successful 100 * @throws UnsupportedOperationException If the implementation does not support deletion. 101 * Use {@link #isDeleteSupported()}} to check for support. 102 * @since 18278 103 */ 104 default boolean delete() { 105 throw new UnsupportedOperationException("remove is not supported for " + this.getClass().getSimpleName()); 106 } 107 108 /** 109 * Check if image deletion is supported 110 * @return {@code true} if deletion is supported 111 * @since 18278 112 */ 113 default boolean isDeleteSupported() { 114 return false; 115 } 116 117 /** 96 118 * Returns a display name for this entry (shown in image viewer title bar) 97 119 * @return a display name for this entry -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r18246 r18278 26 26 import org.openstreetmap.josm.tools.ImageProvider; 27 27 import org.openstreetmap.josm.tools.Logging; 28 import org.openstreetmap.josm.tools.Utils; 28 29 29 30 /** … … 189 190 this.dataSet.removeImage(this, false); 190 191 return true; 192 } 193 194 @Override 195 public boolean isDeleteSupported() { 196 return true; 197 } 198 199 @Override 200 public boolean delete() { 201 return Utils.deleteFile(this.getFile()); 191 202 } 192 203 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r18263 r18278 359 359 .map(ImageEntry.class::cast).map(ImageEntry::getDataSet).distinct().collect(Collectors.toList()); 360 360 for (IImageEntry<?> delete : toDelete) { 361 if (delete.isRemoveSupported() && delete.remove()) { 361 // We have to be able to remove the image from the layer and the image from its storage location 362 // If either are false, then don't remove the image. 363 if (delete.isRemoveSupported() && delete.isDeleteSupported() && delete.remove() && delete.delete()) { 362 364 Logging.info("File {0} deleted.", delete.getFile()); 363 365 } else {
Note:
See TracChangeset
for help on using the changeset viewer.