- Timestamp:
- 2013-10-12T20:18:42+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java
r6296 r6319 15 15 import java.beans.PropertyChangeEvent; 16 16 import java.beans.PropertyChangeListener; 17 import java.util.ArrayList; 17 18 import java.util.Collections; 18 19 import java.util.EventObject; 20 import java.util.List; 21 import java.util.Map; 19 22 import java.util.concurrent.CopyOnWriteArrayList; 20 23 … … 35 38 36 39 import org.openstreetmap.josm.Main; 37 import org.openstreetmap.josm.actions.PasteTagsAction .TagPaster;40 import org.openstreetmap.josm.actions.PasteTagsAction; 38 41 import org.openstreetmap.josm.data.osm.OsmPrimitive; 42 import org.openstreetmap.josm.data.osm.PrimitiveData; 39 43 import org.openstreetmap.josm.data.osm.Relation; 44 import org.openstreetmap.josm.data.osm.Tag; 40 45 import org.openstreetmap.josm.gui.dialogs.relation.RunnableAction; 46 import static org.openstreetmap.josm.gui.help.HelpUtil.ht; 41 47 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionList; 42 48 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager; 43 49 import org.openstreetmap.josm.tools.ImageProvider; 50 import org.openstreetmap.josm.tools.TextTagParser; 51 import org.openstreetmap.josm.tools.Utils; 44 52 45 53 /** … … 324 332 Relation relation = new Relation(); 325 333 model.applyToPrimitive(relation); 326 TagPaster tagPaster = new TagPaster(Main.pasteBuffer.getDirectlyAdded(), Collections.<OsmPrimitive>singletonList(relation)); 327 model.updateTags(tagPaster.execute()); 328 } 329 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 330 358 protected void updateEnabledState() { 331 359 setEnabled(TagTable.this.isEnabled());
Note:
See TracChangeset
for help on using the changeset viewer.