Ignore:
Timestamp:
2006-04-21T14:31:51+02:00 (18 years ago)
Author:
imi
Message:
  • added conflicts and resolve conflict dialog

This is one of those "changed everything" checkpoint.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r84 r86  
    22
    33import java.util.Collection;
    4 import java.util.HashMap;
    5 import java.util.Iterator;
    64import java.util.LinkedList;
    75import java.util.List;
    8 import java.util.Map;
    96
    107import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1613 * @author imi
    1714 */
    18 public class ChangeKeyValueCommand implements Command {
     15public class ChangePropertyCommand extends Command {
    1916
    2017        /**
     
    3330        private final String value;
    3431       
    35         /**
    36          * These are the old values of the objects to do a proper undo.
    37          */
    38         private List<Map<String, String>> oldProperties;
    39        
    40         /**
    41          * These are the old modified states of the data.
    42          */
    43         private List<Boolean> oldModified = new LinkedList<Boolean>();
    44 
    45         public ChangeKeyValueCommand(Collection<OsmPrimitive> objects, String key, String value) {
     32        public ChangePropertyCommand(Collection<OsmPrimitive> objects, String key, String value) {
    4633                this.objects = new LinkedList<OsmPrimitive>(objects);
    4734                this.key = key;
     
    4936        }
    5037       
    51         public void executeCommand() {
    52                 // save old
    53                 oldProperties = new LinkedList<Map<String, String>>();
    54                 for (OsmPrimitive osm : objects) {
    55                         oldProperties.add(osm.keys == null ? null : new HashMap<String, String>(osm.keys));
    56                         oldModified.add(osm.modifiedProperties);
    57                         osm.modifiedProperties = true;
    58                 }
    59 
     38        @Override public void executeCommand() {
     39                super.executeCommand(); // save old
    6040                if (value == null) {
    6141                        for (OsmPrimitive osm : objects)
     
    6747        }
    6848
    69         public void undoCommand() {
    70                 Iterator<Map<String, String>> it = oldProperties.iterator();
    71                 Iterator<Boolean> itMod = oldModified.iterator();
    72                 for (OsmPrimitive osm : objects) {
    73                         osm.keys = it.next();
    74                         osm.modifiedProperties = itMod.next();
    75                 }
    76         }
    77 
    78         public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
     49        @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
    7950                modified.addAll(objects);
    8051        }
Note: See TracChangeset for help on using the changeset viewer.