for (Layer l: selectedLayers) {
if (!(l instanceof ModifiableLayer)) {
continue;
}
ModifiableLayer odl = (ModifiableLayer)l;
if ((odl.requiresSaveToFile() || (odl.requiresUploadToServer() && !odl.isUploadDiscouraged())) && odl.isModified()) {
layersWithUnmodifiedChanges.add(odl);
}
}
if (exit) {
dialog.prepareForSavingAndUpdatingLayersBeforeExit();