Changes in / [6319:6318] in josm
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
/trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r6319 r6318 15 15 import java.beans.PropertyChangeEvent; 16 16 import java.beans.PropertyChangeListener; 17 import java.util.ArrayList;18 17 import java.util.Collections; 19 18 import java.util.EventObject; 20 import java.util.List;21 import java.util.Map;22 19 import java.util.concurrent.CopyOnWriteArrayList; 23 20 … … 38 35 39 36 import org.openstreetmap.josm.Main; 40 import org.openstreetmap.josm.actions.PasteTagsAction; 37 import org.openstreetmap.josm.actions.PasteTagsAction.TagPaster; 41 38 import org.openstreetmap.josm.data.osm.OsmPrimitive; 42 import org.openstreetmap.josm.data.osm.PrimitiveData;43 39 import org.openstreetmap.josm.data.osm.Relation; 44 import org.openstreetmap.josm.data.osm.Tag;45 40 import org.openstreetmap.josm.gui.dialogs.relation.RunnableAction; 46 import static org.openstreetmap.josm.gui.help.HelpUtil.ht;47 41 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 48 42 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 49 43 import org.openstreetmap.josm.tools.ImageProvider; 50 import org.openstreetmap.josm.tools.TextTagParser;51 import org.openstreetmap.josm.tools.Utils;52 44 53 45 /** … … 332 324 Relation relation = new Relation(); 333 325 model.applyToPrimitive(relation); 334 335 String buf = Utils.getClipboardContent(); 336 if (buf == null || buf.isEmpty() || buf.matches("(\\d+,)*\\d+")) { 337 List<PrimitiveData> directlyAdded = Main.pasteBuffer.getDirectlyAdded(); 338 if (directlyAdded==null || directlyAdded.isEmpty()) return; 339 PasteTagsAction.TagPaster tagPaster = new PasteTagsAction.TagPaster(directlyAdded, Collections.<OsmPrimitive>singletonList(relation)); 340 model.updateTags(tagPaster.execute()); 341 } else { 342 // Paste tags from arbitrary text 343 Map<String, String> tags = TextTagParser.readTagsFromText(buf); 344 if (tags==null || tags.isEmpty()) { 345 TextTagParser.showBadBufferMessage(ht("/Action/PasteTags")); 346 } else if (TextTagParser.validateTags(tags)) { 347 List<Tag> newTags = new ArrayList<Tag>(); 348 for (Map.Entry<String, String> entry: tags.entrySet()) { 349 String k = entry.getKey(); 350 String v = entry.getValue(); 351 newTags.add(new Tag(k,v)); 352 } 353 model.updateTags(newTags); 354 } 355 } 356 } 357 326 TagPaster tagPaster = new TagPaster(Main.pasteBuffer.getDirectlyAdded(), Collections.<OsmPrimitive>singletonList(relation)); 327 model.updateTags(tagPaster.execute()); 328 } 329 358 330 protected void updateEnabledState() { 359 331 setEnabled(TagTable.this.isEnabled());
Note:
See TracChangeset
for help on using the changeset viewer.
