Never ask for confirmations. It's never the right thing to do unless you're very short of resources, which we never are these days.
Instead, provide an undo of a layer delete. When they ask to delete a layer that has changes in it, simply delete it, and pop up a non-confirmation notice that says "This layer has changes and may be restored using File/Open Recent". The problem with a confirmation is that it *really* deletes the data, which may be the wrong thing. If you're ever at a confirmation point, clearly somebody might not be thinking correctly, and their answer to the confirmation might *also* be wrong. Undo, undo, undo! Never confirm! Holger Mappt writes: > Hi, > > See https://josm.openstreetmap.de/ticket/12075. > The idea is to ask for confirmation if a GeoImageLayer with modified > image properties is deleted. What is the best/right way to do that? > > The AbstractModifiableLayer seems to serve that purpose. GeoImageLayer > could extend AbstractModifiableLayer instead of Layer. But there is not > a single file associated with the layer but one file per modified image. > There is not really a "recommended action" for the SaveLayersDialog. > The AbstractModifiableLayer would need to be extended to have something > like isAbleToUploadToServer() and isAbleToSaveToFile() to disable the > according check-boxes of the SaveLayersDialog. The logic in > Main.saveUnsavedModifications() would need to be changed to consider the > layer if neither requiresSaveToFile() nor requiresUploadToServer() > returns true. Would it make sense to add something like > requiresSomeAction() to AbstractModifiableLayer and > Main.saveUnsavedModifications()? The "action" could be a string that is > displayed in the SaveLayersDialog. > > Thanks, > Holger > > _______________________________________________ > josm-dev mailing list > josm-dev@openstreetmap.org > https://lists.openstreetmap.org/listinfo/josm-dev _______________________________________________ josm-dev mailing list josm-dev@openstreetmap.org https://lists.openstreetmap.org/listinfo/josm-dev