Changeset 18706 in josm for trunk/src


Ignore:
Timestamp:
2023-04-20T22:13:25+02:00 (15 months ago)
Author:
taylor.smock
Message:

Fix #22817: Don't delete layer with changes and a non-normal upload policy (patch by gaben, modified)

Patch modifications are as follows:

  • A non-regression test
  • Account for UploadPolicy.BLOCKED causing requiresUploadToServer to return false.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r18466 r18706  
    8282    }
    8383
    84     private enum UserAction {
     84    /**
     85     * The action a user decided to take with respect to an operation
     86     */
     87    enum UserAction {
    8588        /** save/upload layers was successful, proceed with operation */
    8689        PROCEED,
     
    113116        if (!GraphicsEnvironment.isHeadless()) {
    114117            SaveLayersDialog dialog = new SaveLayersDialog(MainApplication.getMainFrame());
    115             List<AbstractModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>();
     118            List<AbstractModifiableLayer> layersWithUnsavedChanges = new ArrayList<>();
    116119            for (Layer l: selectedLayers) {
    117120                if (!(l instanceof AbstractModifiableLayer)) {
     
    122125                        ((!odl.isSavable() && !odl.isUploadable()) ||
    123126                                odl.requiresSaveToFile() ||
    124                                 (odl.requiresUploadToServer() && !odl.isUploadDiscouraged()))) {
    125                     layersWithUnmodifiedChanges.add(odl);
     127                                odl.requiresUploadToServer())) {
     128                    layersWithUnsavedChanges.add(odl);
    126129                }
    127130            }
    128131            dialog.prepareForSavingAndUpdatingLayers(reason);
    129             if (!layersWithUnmodifiedChanges.isEmpty()) {
    130                 dialog.getModel().populate(layersWithUnmodifiedChanges);
     132            if (!layersWithUnsavedChanges.isEmpty()) {
     133                dialog.getModel().populate(layersWithUnsavedChanges);
    131134                dialog.setVisible(true);
    132135                switch(dialog.getUserAction()) {
Note: See TracChangeset for help on using the changeset viewer.