Changeset 22044 in osm for applications
- Timestamp:
- 2010-06-27T22:45:49+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java
r20828 r22044 5 5 import static org.openstreetmap.josm.tools.I18n.trn; 6 6 7 import java.util.ArrayList; 7 8 import java.util.Collection; 9 import java.util.Collections; 8 10 import java.util.LinkedList; 9 11 import java.util.List; … … 11 13 import javax.swing.JLabel; 12 14 import javax.swing.tree.DefaultMutableTreeNode; 13 import javax.swing.tree.MutableTreeNode;14 15 15 16 import org.openstreetmap.josm.command.Command; 17 import org.openstreetmap.josm.command.PseudoCommand; 16 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 19 import org.openstreetmap.josm.plugins.validator.util.NameVisitor; … … 67 69 } 68 70 69 @Override public MutableTreeNode description() {71 @Override public JLabel getDescription() { 70 72 String text = tr( "Replace \"{0}\" by \"{1}\" for", key, newKey); 71 73 if (objects.size() == 1) { … … 75 77 } else 76 78 text += " "+objects.size()+" "+trn("object","objects",objects.size()); 77 DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL)); 79 return new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL); 80 } 81 82 @Override public Collection<PseudoCommand> getChildren() { 78 83 if (objects.size() == 1) 79 return root; 80 NameVisitor v = new NameVisitor(); 81 for (OsmPrimitive osm : objects) { 84 return null; 85 List<PseudoCommand> children = new ArrayList<PseudoCommand>(); 86 87 final NameVisitor v = new NameVisitor(); 88 for (final OsmPrimitive osm : objects) { 82 89 osm.visit(v); 83 root.add(new DefaultMutableTreeNode(v.toLabel())); 90 children.add(new PseudoCommand() { 91 @Override public JLabel getDescription() { 92 return v.toLabel(); 93 } 94 @Override public Collection<? extends OsmPrimitive> getParticipatingPrimitives() { 95 return Collections.singleton(osm); 96 } 97 }); 84 98 } 85 return root;99 return children; 86 100 } 87 101 }
Note:
See TracChangeset
for help on using the changeset viewer.