Changeset 10737 in josm for trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java
- Timestamp:
- 2016-08-05T20:09:55+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/AbstractTagPaster.java
r10604 r10737 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.datatransfer.importers; 3 4 import static org.openstreetmap.josm.tools.I18n.trn; 3 5 4 6 import java.awt.datatransfer.DataFlavor; … … 6 8 import java.io.IOException; 7 9 import java.util.Collection; 10 import java.util.Collections; 11 import java.util.List; 8 12 import java.util.Map; 9 13 … … 12 16 import org.openstreetmap.josm.Main; 13 17 import org.openstreetmap.josm.command.ChangePropertyCommand; 18 import org.openstreetmap.josm.command.Command; 19 import org.openstreetmap.josm.command.SequenceCommand; 14 20 import org.openstreetmap.josm.data.coor.EastNorth; 15 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 23 import org.openstreetmap.josm.tools.I18n; 17 24 18 25 /** … … 42 49 throws UnsupportedFlavorException, IOException { 43 50 ChangePropertyCommand command = new ChangePropertyCommand(selection, getTags(support)); 44 Main.main.undoRedo.add(command);51 commitCommands(selection, Collections.singletonList(command)); 45 52 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 } 46 69 } 47 70
Note:
See TracChangeset
for help on using the changeset viewer.