Changeset 22044 in osm


Ignore:
Timestamp:
2010-06-27T22:45:49+02:00 (14 years ago)
Author:
bastik
Message:

update to josm latest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java

    r20828 r22044  
    55import static org.openstreetmap.josm.tools.I18n.trn;
    66
     7import java.util.ArrayList;
    78import java.util.Collection;
     9import java.util.Collections;
    810import java.util.LinkedList;
    911import java.util.List;
     
    1113import javax.swing.JLabel;
    1214import javax.swing.tree.DefaultMutableTreeNode;
    13 import javax.swing.tree.MutableTreeNode;
    1415
    1516import org.openstreetmap.josm.command.Command;
     17import org.openstreetmap.josm.command.PseudoCommand;
    1618import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1719import org.openstreetmap.josm.plugins.validator.util.NameVisitor;
     
    6769    }
    6870
    69     @Override public MutableTreeNode description() {
     71    @Override public JLabel getDescription() {
    7072        String text = tr( "Replace \"{0}\" by \"{1}\" for", key, newKey);
    7173        if (objects.size() == 1) {
     
    7577        } else
    7678            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() {
    7883        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) {
    8289            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            });
    8498        }
    85         return root;
     99        return children;
    86100    }
    87101}
Note: See TracChangeset for help on using the changeset viewer.