Changeset 12763 in josm


Ignore:
Timestamp:
2017-09-06T22:44:38+02:00 (2 weeks ago)
Author:
Don-vip
Message:

see #15229 - see #15182 - see #13036 - remove last GUI stuff from DeleteCommand

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DeleteAction.java

    r12761 r12763  
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2020import org.openstreetmap.josm.data.osm.Relation;
     21import org.openstreetmap.josm.data.osm.RelationToChildReference;
    2122import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    2223import org.openstreetmap.josm.gui.MainApplication;
    2324import org.openstreetmap.josm.gui.MapFrame;
     25import org.openstreetmap.josm.gui.dialogs.DeleteFromRelationConfirmationDialog;
    2426import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
    2527import org.openstreetmap.josm.tools.Shortcut;
     
    4547        public boolean confirmRelationDeletion(Collection<Relation> relations) {
    4648            return DeleteAction.confirmRelationDeletion(relations);
     49        }
     50
     51        @Override
     52        public boolean confirmDeletionFromRelation(Collection<RelationToChildReference> references) {
     53            DeleteFromRelationConfirmationDialog dialog = DeleteFromRelationConfirmationDialog.getInstance();
     54            dialog.getModel().populate(references);
     55            dialog.setVisible(true);
     56            return !dialog.isCanceled();
    4757        }
    4858    };
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r12760 r12763  
    3434import org.openstreetmap.josm.data.osm.Way;
    3535import org.openstreetmap.josm.data.osm.WaySegment;
    36 import org.openstreetmap.josm.gui.dialogs.DeleteFromRelationConfirmationDialog;
    3736import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3837import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    4241/**
    4342 * A command to delete a number of primitives from the dataset.
     43 * To be used correctly, this class requires an initial call to {@link #setDeletionCallback(DeletionCallback)} to
     44 * allow interactive confirmation actions.
    4445 * @since 23
    4546 */
     
    9495         */
    9596        boolean confirmRelationDeletion(Collection<Relation> relations);
     97
     98        /**
     99         * Confirm before removing a collection of primitives from their parent relations.
     100         * @param references the list of relation-to-child references
     101         * @return {@code true} if user confirms the deletion
     102         * @since 12763
     103         */
     104        boolean confirmDeletionFromRelation(Collection<RelationToChildReference> references);
    96105    }
    97106
     
    577586            Set<RelationToChildReference> references = RelationToChildReference.getRelationToChildReferences(primitivesToDelete);
    578587            references.removeIf(ref -> ref.getParent().isDeleted());
    579             if (!references.isEmpty()) {
    580                 DeleteFromRelationConfirmationDialog dialog = DeleteFromRelationConfirmationDialog.getInstance();
    581                 dialog.getModel().populate(references);
    582                 dialog.setVisible(true);
    583                 if (dialog.isCanceled())
    584                     return null;
     588            if (!references.isEmpty() && !callback.confirmDeletionFromRelation(references)) {
     589                return null;
    585590            }
    586591        }
Note: See TracChangeset for help on using the changeset viewer.