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

Last change on this file since 94 was 94, checked in by imi, 18 years ago
  • changed Add Way mode, so that ways can be modified
  • added Command Stack dialog (list the undo buffer)
  • fixed Exception in download gps data
File size: 1.1 KB
Line 
1package org.openstreetmap.josm.command;
2
3import java.util.Collection;
4
5import javax.swing.JLabel;
6import javax.swing.tree.DefaultMutableTreeNode;
7import javax.swing.tree.MutableTreeNode;
8
9import org.openstreetmap.josm.data.osm.OsmPrimitive;
10import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
11
12public class ChangeCommand extends Command {
13
14 private final OsmPrimitive osm;
15 private final OsmPrimitive newOsm;
16
17 public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) {
18 this.osm = osm;
19 this.newOsm = newOsm;
20 }
21
22 @Override public void executeCommand() {
23 super.executeCommand();
24 osm.cloneFrom(newOsm);
25 osm.modified = true;
26 }
27
28 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
29 modified.add(osm);
30 }
31
32 @Override public MutableTreeNode description() {
33 NameVisitor v = new NameVisitor();
34 osm.visit(v);
35 return new DefaultMutableTreeNode(new JLabel("Change "+v.className+" "+v.name, v.icon, JLabel.HORIZONTAL));
36 }
37}
Note: See TracBrowser for help on using the repository browser.