source: josm/src/org/openstreetmap/josm/command/ChangeCommand.java@ 113

Last change on this file since 113 was 113, checked in by imi, 18 years ago

fixed i18n messages (cleanup)

File size: 1.1 KB
Line 
1package org.openstreetmap.josm.command;
2
3import static org.openstreetmap.josm.tools.I18n.tr;
4
5import java.util.Collection;
6
7import javax.swing.JLabel;
8import javax.swing.tree.DefaultMutableTreeNode;
9import javax.swing.tree.MutableTreeNode;
10
11import org.openstreetmap.josm.data.osm.OsmPrimitive;
12import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
13
14public class ChangeCommand extends Command {
15
16 private final OsmPrimitive osm;
17 private final OsmPrimitive newOsm;
18
19 public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) {
20 this.osm = osm;
21 this.newOsm = newOsm;
22 }
23
24 @Override public void executeCommand() {
25 super.executeCommand();
26 osm.cloneFrom(newOsm);
27 osm.modified = true;
28 }
29
30 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
31 modified.add(osm);
32 }
33
34 @Override public MutableTreeNode description() {
35 NameVisitor v = new NameVisitor();
36 osm.visit(v);
37 return new DefaultMutableTreeNode(new JLabel(tr("Change")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
38 }
39}
Note: See TracBrowser for help on using the repository browser.