Ignore:
Timestamp:
2016-08-05T20:09:55+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #12900 - Conflicts in pasted tags cannot be resolved, cannot be resolved to "none" (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java

    r10604 r10737  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.datatransfer.importers;
     3
     4import static org.openstreetmap.josm.tools.I18n.trn;
    35
    46import java.awt.datatransfer.DataFlavor;
     
    68import java.io.IOException;
    79import java.util.Collection;
     10import java.util.Collections;
     11import java.util.List;
    812import java.util.Map;
    913
     
    1216import org.openstreetmap.josm.Main;
    1317import org.openstreetmap.josm.command.ChangePropertyCommand;
     18import org.openstreetmap.josm.command.Command;
     19import org.openstreetmap.josm.command.SequenceCommand;
    1420import org.openstreetmap.josm.data.coor.EastNorth;
    1521import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1622import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     23import org.openstreetmap.josm.tools.I18n;
    1724
    1825/**
     
    4249            throws UnsupportedFlavorException, IOException {
    4350        ChangePropertyCommand command = new ChangePropertyCommand(selection, getTags(support));
    44         Main.main.undoRedo.add(command);
     51        commitCommands(selection, Collections.singletonList(command));
    4552        return true;
     53    }
     54
     55    /**
     56     * Create and execute SequenceCommand with descriptive title
     57     * @param selection selected primitives
     58     * @param commands the commands to perform in a sequential command
     59     * @since 10737
     60     */
     61    protected static void commitCommands(Collection<? extends OsmPrimitive> selection, List<Command> commands) {
     62        if (!commands.isEmpty()) {
     63            String title1 = trn("Pasting {0} tag", "Pasting {0} tags", commands.size(), commands.size());
     64            String title2 = trn("to {0} object", "to {0} objects", selection.size(), selection.size());
     65            @I18n.QuirkyPluralString
     66            final String title = title1 + ' ' + title2;
     67            Main.main.undoRedo.add(new SequenceCommand(title, commands));
     68        }
    4669    }
    4770
Note: See TracChangeset for help on using the changeset viewer.