Ignore:
Timestamp:
2009-07-08T21:50:32+02:00 (11 years ago)
Author:
Gubaer
Message:

new: replaced global conflict list by conflict list per layer, similar to datasets

Location:
trunk/src/org/openstreetmap/josm/command
Files:
1 added
18 edited

Legend:

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

    r1169 r1750  
    1010import javax.swing.tree.MutableTreeNode;
    1111
    12 import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.data.osm.DataSet;
    1412import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1513import org.openstreetmap.josm.data.osm.visitor.AddVisitor;
    1614import org.openstreetmap.josm.data.osm.visitor.DeleteVisitor;
    1715import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
    18 import org.openstreetmap.josm.gui.layer.Layer;
    19 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2016
    2117/**
     
    2319 * way.
    2420 *
    25  * See {@link ChangeCommand ChangeCommand} for comments on relation back references.
     21 * See {@see ChangeCommand} for comments on relation back references.
    2622 *
    2723 * @author imi
     
    3430    private final OsmPrimitive osm;
    3531
    36     private DataSet ds;
    37 
    3832    /**
    3933     * Create the command and specify the element to add.
    4034     */
    4135    public AddCommand(OsmPrimitive osm) {
     36        super();
    4237        this.osm = osm;
    43         this.ds = Main.main.editLayer().data;
    4438    }
    4539
    4640    @Override public boolean executeCommand() {
    47         osm.visit(new AddVisitor(ds));
     41        osm.visit(new AddVisitor(getLayer().data));
    4842        return true;
    4943    }
    5044
    5145    @Override public void undoCommand() {
    52         osm.visit(new DeleteVisitor(ds));
     46        osm.visit(new DeleteVisitor(getLayer().data));
    5347    }
    5448
     
    5751    }
    5852
    59     // faster implementation
    60     @Override public boolean invalidBecauselayerRemoved(Layer oldLayer) {
    61         return oldLayer instanceof OsmDataLayer && ((OsmDataLayer)oldLayer).data == ds;
    62     }
    63 
    6453    @Override public MutableTreeNode description() {
    6554        NameVisitor v = new NameVisitor();
    6655        osm.visit(v);
    67         return new DefaultMutableTreeNode(new JLabel(tr("Add")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
     56        return new DefaultMutableTreeNode(
     57                new JLabel(tr("Add {0} {1}", tr(v.className), v.name), v.icon, JLabel.HORIZONTAL));
    6858    }
    6959}
  • trunk/src/org/openstreetmap/josm/command/ChangeCommand.java

    r1169 r1750  
    2525
    2626    public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) {
     27        super();
    2728        this.osm = osm;
    2829        this.newOsm = newOsm;
     
    4344        NameVisitor v = new NameVisitor();
    4445        osm.visit(v);
    45         return new DefaultMutableTreeNode(new JLabel(tr("Change")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
     46        return new DefaultMutableTreeNode(new JLabel(tr("Change {0} {1}", tr(v.className), v.name), v.icon, JLabel.HORIZONTAL));
    4647    }
    4748}
  • trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java

    r1347 r1750  
    4040
    4141    public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, String key, String value) {
     42        super();
    4243        this.objects = new LinkedList<OsmPrimitive>();
    4344        this.key = key;
     
    4546        if (value == null) {
    4647            for (OsmPrimitive osm : objects) {
    47                 if(osm.get(key) != null)
     48                if(osm.get(key) != null) {
    4849                    this.objects.add(osm);
     50                }
    4951            }
    5052        } else {
     
    6466        String val = object.get(key);
    6567        if ((value == null && val != null)
    66         || (value != null && (val == null || !value.equals(val))))
     68                || (value != null && (val == null || !value.equals(val)))) {
    6769            this.objects.add(object);
     70        }
    6871    }
    6972
     
    9598            text = value == null
    9699            ? tr("Remove \"{0}\" for {1} ''{2}''", key, tr(v.className), v.name)
    97             : tr("Set {0}={1} for {2} ''{3}''",key,value, tr(v.className), v.name);
     100                    : tr("Set {0}={1} for {2} ''{3}''",key,value, tr(v.className), v.name);
    98101        }
    99102        else
     
    101104            text = value == null
    102105            ? tr("Remove \"{0}\" for {1} {2}", key, objects.size(), trn("object","objects",objects.size()))
    103             : tr("Set {0}={1} for {2} {3}",key,value, objects.size(), trn("object","objects",objects.size()));
     106                    : tr("Set {0}={1} for {2} {3}",key,value, objects.size(), trn("object","objects",objects.size()));
    104107        }
    105108        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(text, ImageProvider.get("data", "key"), JLabel.HORIZONTAL));
  • trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java

    r1617 r1750  
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1414import org.openstreetmap.josm.data.osm.Relation;
    15 import org.openstreetmap.josm.data.osm.RelationMember;
    16 
    1715import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
    1816
     
    3634
    3735    public ChangeRelationMemberRoleCommand(Relation relation, int position, String newRole) {
     36        super();
    3837        this.relation = relation;
    3938        this.position = position;
     
    6766        NameVisitor v = new NameVisitor();
    6867        relation.visit(v);
    69         return new DefaultMutableTreeNode(new JLabel(tr("ChangeRelationMemberRole")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
     68        return new DefaultMutableTreeNode(new JLabel(tr("ChangeRelationMemberRole {0} {1}", tr(v.className), v.name), v.icon, JLabel.HORIZONTAL));
    7069    }
    7170}
  • trunk/src/org/openstreetmap/josm/command/Command.java

    r1523 r1750  
    1111
    1212import org.openstreetmap.josm.Main;
    13 import org.openstreetmap.josm.data.osm.DataSet;
    1413import org.openstreetmap.josm.data.osm.Node;
    1514import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2524 * one atomic action on a specific dataset, such as move or delete.
    2625 *
    27  * Remember that the command must be executable and undoable, even if the
    28  * Main.ds has changed, so the command must save the dataset it operates on
    29  * if necessary.
    30  *
     26 * The command remembers the {@see OsmDataLayer} it is operating on.
     27 *
    3128 * @author imi
    3229 */
    3330abstract public class Command {
    3431
    35    private static final class CloneVisitor extends AbstractVisitor {
    36       public Map<OsmPrimitive, OsmPrimitive> orig = new HashMap<OsmPrimitive, OsmPrimitive>();
     32    private static final class CloneVisitor extends AbstractVisitor {
     33        public Map<OsmPrimitive, OsmPrimitive> orig = new HashMap<OsmPrimitive, OsmPrimitive>();
    3734
    38       public void visit(Node n) {
    39          orig.put(n, new Node(n));
    40       }
    41       public void visit(Way w) {
    42          orig.put(w, new Way(w));
    43       }
    44       public void visit(Relation e) {
    45          orig.put(e, new Relation(e));
    46       }
    47    }
     35        public void visit(Node n) {
     36            orig.put(n, new Node(n));
     37        }
     38        public void visit(Way w) {
     39            orig.put(w, new Way(w));
     40        }
     41        public void visit(Relation e) {
     42            orig.put(e, new Relation(e));
     43        }
     44    }
    4845
    49    private CloneVisitor orig;
     46    /** the map of OsmPrimitives in the original state to OsmPrimitives in cloned state */
     47    private Map<OsmPrimitive, OsmPrimitive> cloneMap = new HashMap<OsmPrimitive, OsmPrimitive>();
    5048
    51    protected DataSet ds;
     49    /** the layer which this command is applied to */
     50    private OsmDataLayer layer;
    5251
    53    public Command() {
    54       this.ds = Main.main.editLayer().data;
    55    }
    56    /**
    57     * Executes the command on the dataset. This implementation will remember all
    58     * primitives returned by fillModifiedData for restoring them on undo.
    59     */
    60    public boolean did_execute = false;
    61    public boolean executeCommand() {
    62       did_execute = true;
    63       orig = new CloneVisitor();
    64       Collection<OsmPrimitive> all = new HashSet<OsmPrimitive>();
    65       fillModifiedData(all, all, all);
    66       for (OsmPrimitive osm : all)
    67          osm.visit(orig);
    68       return true;
    69    }
     52    public Command() {
     53        this.layer = Main.main.map.mapView.getEditLayer();
     54    }
     55    /**
     56     * Executes the command on the dataset. This implementation will remember all
     57     * primitives returned by fillModifiedData for restoring them on undo.
     58     */
     59    public boolean executeCommand() {
     60        CloneVisitor visitor = new CloneVisitor();
     61        Collection<OsmPrimitive> all = new HashSet<OsmPrimitive>();
     62        fillModifiedData(all, all, all);
     63        for (OsmPrimitive osm : all) {
     64            osm.visit(visitor);
     65        }
     66        cloneMap = visitor.orig;
     67        return true;
     68    }
    7069
    71    /**
    72     * Undoes the command.
    73     * It can be assumed that all objects are in the same state they were before.
    74     * It can also be assumed that executeCommand was called exactly once before.
    75     *
    76     * This implementation undoes all objects stored by a former call to executeCommand.
    77     */
    78    public void undoCommand() {
    79       for (Entry<OsmPrimitive, OsmPrimitive> e : orig.orig.entrySet())
    80          e.getKey().cloneFrom(e.getValue());
    81    }
     70    /**
     71     * Undoes the command.
     72     * It can be assumed that all objects are in the same state they were before.
     73     * It can also be assumed that executeCommand was called exactly once before.
     74     *
     75     * This implementation undoes all objects stored by a former call to executeCommand.
     76     */
     77    public void undoCommand() {
     78        for (Entry<OsmPrimitive, OsmPrimitive> e : cloneMap.entrySet()) {
     79            e.getKey().cloneFrom(e.getValue());
     80        }
     81    }
    8282
    83    /**
    84     * Called when a layer has been removed to have the command remove itself from
    85     * any buffer if it is not longer applicable to the dataset (e.g. it was part of
    86     * the removed layer)
    87     */
    88    public boolean invalidBecauselayerRemoved(Layer oldLayer) {
    89       if (!(oldLayer instanceof OsmDataLayer))
    90          return false;
    91       HashSet<OsmPrimitive> modified = new HashSet<OsmPrimitive>();
    92       fillModifiedData(modified, modified, modified);
    93       if (modified.isEmpty())
    94          return false;
    95 
    96       HashSet<OsmPrimitive> all = new HashSet<OsmPrimitive>(((OsmDataLayer)oldLayer).data.allPrimitives());
    97       for (OsmPrimitive osm : all)
    98          if (all.contains(osm))
    99                  return true;
    100 
    101       return false;
    102    }
     83    /**
     84     * Called when a layer has been removed to have the command remove itself from
     85     * any buffer if it is not longer applicable to the dataset (e.g. it was part of
     86     * the removed layer)
     87     *
     88     * @param oldLayer the old layer
     89     * @return true if this command
     90     */
     91    public boolean invalidBecauselayerRemoved(Layer oldLayer) {
     92        if (!(oldLayer instanceof OsmDataLayer))
     93            return false;
     94        return layer == oldLayer;
     95    }
    10396
    10497    /**
     
    107100     */
    108101    public OsmPrimitive getOrig(OsmPrimitive osm) {
    109         OsmPrimitive o = orig.orig.get(osm);
     102        OsmPrimitive o = cloneMap.get(osm);
    110103        if (o != null)
    111              return o;
     104            return o;
    112105        Main.debug("unable to find osm with id: " + osm.id + " hashCode: " + osm.hashCode());
    113         for (OsmPrimitive t : orig.orig.keySet()) {
    114              OsmPrimitive to = orig.orig.get(t);
    115              Main.debug("now: " + t.id + " hashCode: " + t.hashCode());
    116              Main.debug("orig: " + to.id + " hashCode: " + to.hashCode());
     106        for (OsmPrimitive t : cloneMap.keySet()) {
     107            OsmPrimitive to = cloneMap.get(t);
     108            Main.debug("now: " + t.id + " hashCode: " + t.hashCode());
     109            Main.debug("orig: " + to.id + " hashCode: " + to.hashCode());
    117110        }
    118111        return o;
    119112    }
    120113
    121    /**
    122     * Fill in the changed data this command operates on.
    123     * Add to the lists, don't clear them.
    124     *
    125     * @param modified The modified primitives
    126     * @param deleted The deleted primitives
    127     * @param added The added primitives
    128     */
    129    abstract public void fillModifiedData(Collection<OsmPrimitive> modified,
    130          Collection<OsmPrimitive> deleted,
    131          Collection<OsmPrimitive> added);
     114    /**
     115     * Replies the layer this command is (or was) applied to.
     116     *
     117     * @return
     118     */
     119    protected  OsmDataLayer getLayer() {
     120        return layer;
     121    }
    132122
    133    abstract public MutableTreeNode description();
     123    /**
     124     * Fill in the changed data this command operates on.
     125     * Add to the lists, don't clear them.
     126     *
     127     * @param modified The modified primitives
     128     * @param deleted The deleted primitives
     129     * @param added The added primitives
     130     */
     131    abstract public void fillModifiedData(Collection<OsmPrimitive> modified,
     132            Collection<OsmPrimitive> deleted,
     133            Collection<OsmPrimitive> added);
     134
     135    abstract public MutableTreeNode description();
     136
     137
     138
    134139}
  • trunk/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java

    r1670 r1750  
    1010import javax.swing.tree.MutableTreeNode;
    1111
    12 import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.data.conflict.Conflict;
    1313import org.openstreetmap.josm.data.osm.Node;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
    15 import org.openstreetmap.josm.data.osm.Relation;
    16 import org.openstreetmap.josm.data.osm.Way;
    1715import org.openstreetmap.josm.gui.conflict.MergeDecisionType;
    1816import org.openstreetmap.josm.tools.ImageProvider;
     
    2220 *
    2321 */
    24 public class CoordinateConflictResolveCommand extends Command {
     22public class CoordinateConflictResolveCommand extends ConflictResolveCommand {
    2523
    26     /** my node (in the local dataset). merge decisions are applied to this
    27      *  node
    28      */
    29     private final Node my;
    30     /** their node (in the server dataset) */
    31     private final Node their;
     24    /** the conflict to resolve */
     25    private Conflict<Node> conflict;
    3226
    3327    /** the merge decision */
     
    4236     */
    4337    public CoordinateConflictResolveCommand(Node my, Node their, MergeDecisionType decision) {
    44         this.my = my;
    45         this.their = their;
     38        this.conflict = new Conflict<Node>(my,their);
    4639        this.decision = decision;
    4740    }
     
    5245        return new DefaultMutableTreeNode(
    5346                new JLabel(
    54                         tr("Resolve conflicts in coordinates in {0}",my.id),
     47                        tr("Resolve conflicts in coordinates in {0}",conflict.getMy().id),
    5548                        ImageProvider.get("data", "object"),
    5649                        JLabel.HORIZONTAL
     
    6962            // do nothing
    7063        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
     64            Node my = conflict.getMy();
     65            Node their = conflict.getTheir();
    7166            my.setCoor(their.getCoor());
    7267        } else
    7368            // should not happen
    7469            throw new IllegalStateException(tr("cannot resolve undecided conflict"));
     70
     71        // remember the layer this command was applied to
     72        //
     73        rememberConflict(conflict);
    7574
    7675        return true;
     
    8079    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
    8180            Collection<OsmPrimitive> added) {
    82         modified.add(my);
    83     }
    84 
    85     @Override
    86     public void undoCommand() {
    87         // restore former state of modified primitives
    88         //
    89         super.undoCommand();
    90 
    91         // restore a conflict if necessary
    92         //
    93         if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    94             Main.map.conflictDialog.addConflict(my, their);
    95         }
     81        modified.add(conflict.getMy());
    9682    }
    9783}
  • trunk/src/org/openstreetmap/josm/command/DeleteCommand.java

    r1656 r1750  
    4242
    4343    /**
    44      * The primitive that get deleted.
    45      */
    46     private final Collection<? extends OsmPrimitive> data;
     44     * The primitives that get deleted.
     45     */
     46    private final Collection<? extends OsmPrimitive> toDelete;
    4747
    4848    /**
     
    5050     */
    5151    public DeleteCommand(Collection<? extends OsmPrimitive> data) {
    52         this.data = data;
     52        super();
     53        this.toDelete = data;
    5354    }
    5455
     
    5859     */
    5960    public DeleteCommand(OsmPrimitive data) {
    60         this.data = Collections.singleton(data);
     61        this.toDelete = Collections.singleton(data);
    6162    }
    6263
    6364    @Override public boolean executeCommand() {
    6465        super.executeCommand();
    65         for (OsmPrimitive osm : data) {
     66        for (OsmPrimitive osm : toDelete) {
    6667            osm.delete(true);
    6768        }
     
    7172    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
    7273            Collection<OsmPrimitive> added) {
    73         deleted.addAll(data);
     74        deleted.addAll(toDelete);
    7475    }
    7576
     
    7778        NameVisitor v = new NameVisitor();
    7879
    79         if (data.size() == 1) {
    80             data.iterator().next().visit(v);
     80        if (toDelete.size() == 1) {
     81            toDelete.iterator().next().visit(v);
    8182            return new DefaultMutableTreeNode(new JLabel(tr("Delete {1} {0}", v.name, tr(v.className)), v.icon,
    8283                    JLabel.HORIZONTAL));
     
    8586        String cname = null;
    8687        String cnamem = null;
    87         for (OsmPrimitive osm : data) {
     88        for (OsmPrimitive osm : toDelete) {
    8889            osm.visit(v);
    8990            if (cname == null) {
     
    9596            }
    9697        }
    97         DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(tr("Delete {0} {1}", data.size(), trn(
    98                 cname, cnamem, data.size())), ImageProvider.get("data", cname), JLabel.HORIZONTAL));
    99         for (OsmPrimitive osm : data) {
     98        DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(tr("Delete {0} {1}", toDelete.size(), trn(
     99                cname, cnamem, toDelete.size())), ImageProvider.get("data", cname), JLabel.HORIZONTAL));
     100        for (OsmPrimitive osm : toDelete) {
    100101            osm.visit(v);
    101102            root.add(new DefaultMutableTreeNode(v.toLabel()));
     
    276277            Relation rel = new Relation(cur);
    277278            for (OsmPrimitive osm : relationsToBeChanged.get(cur)) {
    278                 for (RelationMember rm : rel.members) {
    279                     if (rm.member == osm) {
    280                         RelationMember mem = new RelationMember();
    281                         mem.role = rm.role;
    282                         mem.member = rm.member;
    283                         rel.members.remove(mem);
    284                         break;
    285                     }
    286                 }
     279                rel.removeMembersFor(osm);
    287280            }
    288281            cmds.add(new ChangeCommand(cur, rel));
  • trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java

    r1690 r1750  
    1010import javax.swing.tree.MutableTreeNode;
    1111
    12 import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.data.conflict.Conflict;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1414import org.openstreetmap.josm.gui.conflict.MergeDecisionType;
     15import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1516import org.openstreetmap.josm.tools.ImageProvider;
    1617
     
    1920 *
    2021 */
    21 public class DeletedStateConflictResolveCommand extends Command {
     22public class DeletedStateConflictResolveCommand extends ConflictResolveCommand {
    2223
    23     /** my primitive (in the local dataset). merge decisions are applied to this
    24      *  node
    25      */
    26     private final OsmPrimitive my;
    27     /** their primitive (in the server dataset) */
    28     private final OsmPrimitive their;
     24    /** the conflict to resolve */
     25    private Conflict<OsmPrimitive> conflict;
    2926
    3027    /** the merge decision */
    3128    private final MergeDecisionType decision;
    32 
    33 
    3429
    3530    /**
     
    4136     */
    4237    public DeletedStateConflictResolveCommand(OsmPrimitive my, OsmPrimitive their, MergeDecisionType decision) {
    43         this.my = my;
    44         this.their = their;
     38        this.conflict = new Conflict<OsmPrimitive>(my, their);
    4539        this.decision = decision;
    4640    }
     
    5145        return new DefaultMutableTreeNode(
    5246                new JLabel(
    53                         tr("Resolve conflicts in deleted state in {0}",my.id),
     47                        tr("Resolve conflicts in deleted state in {0}",conflict.getMy().id),
    5448                        ImageProvider.get("data", "object"),
    5549                        JLabel.HORIZONTAL
     
    6559        super.executeCommand();
    6660
     61        OsmDataLayer layer = getLayer();
     62
    6763        if (decision.equals(MergeDecisionType.KEEP_MINE)) {
    68             if (my.deleted) {
     64            if (conflict.getMy().deleted) {
    6965                // because my was involved in a conflict it my still be referred
    7066                // to from a way or a relation. Fix this now.
    7167                //
    72                 Main.main.editLayer().data.unlinkReferencesToPrimitive(my);
     68                layer.data.unlinkReferencesToPrimitive(conflict.getMy());
    7369            }
    7470        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
    75             if (their.deleted) {
    76                 Main.main.editLayer().data.unlinkReferencesToPrimitive(my);
    77                 my.delete(true);
     71            if (conflict.getTheir().deleted) {
     72                layer.data.unlinkReferencesToPrimitive(conflict.getMy());
     73                conflict.getMy().delete(true);
    7874            } else {
    79                 my.deleted = their.deleted;
     75                conflict.getMy().deleted = conflict.getTheir().deleted;
    8076            }
    8177        } else
     
    8379            throw new IllegalStateException(tr("cannot resolve undecided conflict"));
    8480
     81        rememberConflict(conflict);
    8582        return true;
    8683    }
     
    8986    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
    9087            Collection<OsmPrimitive> added) {
    91         modified.add(my);
    92     }
    93 
    94     @Override
    95     public void undoCommand() {
    96         // restore former state of modified primitives
    97         //
    98         super.undoCommand();
    99 
    100         // restore a conflict if necessary
    101         //
    102         if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    103             Main.map.conflictDialog.addConflict(my, their);
    104         }
     88        modified.add(conflict.getMy());
    10589    }
    10690}
  • trunk/src/org/openstreetmap/josm/command/MoveCommand.java

    r1728 r1750  
    1515import javax.swing.tree.MutableTreeNode;
    1616
    17 import org.openstreetmap.josm.data.coor.EastNorth;
    1817import org.openstreetmap.josm.data.coor.LatLon;
    1918import org.openstreetmap.josm.data.osm.Node;
     
    3231     * The objects that should be moved.
    3332     */
    34     public Collection<Node> objects = new LinkedList<Node>();
     33    private Collection<Node> nodes = new LinkedList<Node>();
    3534    /**
    3635     * x difference movement. Coordinates are in northern/eastern
     
    6463     */
    6564    public MoveCommand(Collection<OsmPrimitive> objects, double x, double y) {
     65        super();
    6666        this.x = x;
    6767        this.y = y;
    68         this.objects = AllNodesVisitor.getAllNodes(objects);
    69         for (Node n : this.objects) {
     68        this.nodes = AllNodesVisitor.getAllNodes(objects);
     69        for (Node n : this.nodes) {
    7070            OldState os = new OldState();
    7171            os.latlon = new LatLon(n.getCoor());
     
    8484     */
    8585    public void moveAgain(double x, double y) {
    86         for (Node n : objects) {
     86        for (Node n : nodes) {
    8787            n.setEastNorth(n.getEastNorth().add(x, y));
    8888        }
     
    9292
    9393    @Override public boolean executeCommand() {
    94         for (Node n : objects) {
     94        for (Node n : nodes) {
    9595            n.setEastNorth(n.getEastNorth().add(x, y));
    9696            n.modified = true;
     
    101101    @Override public void undoCommand() {
    102102        Iterator<OldState> it = oldState.iterator();
    103         for (Node n : objects) {
     103        for (Node n : nodes) {
    104104            OldState os = it.next();
    105105            n.setCoor(os.latlon);
     
    109109
    110110    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
    111         for (OsmPrimitive osm : objects)
     111        for (OsmPrimitive osm : nodes) {
    112112            modified.add(osm);
     113        }
    113114    }
    114115
    115116    @Override public MutableTreeNode description() {
    116         return new DefaultMutableTreeNode(new JLabel(tr("Move")+" "+objects.size()+" "+trn("node","nodes",objects.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL));
     117        return new DefaultMutableTreeNode(new JLabel(tr("Move")+" "+nodes.size()+" "+trn("node","nodes",nodes.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL));
     118    }
     119
     120    public Collection<Node> getMovedNodes() {
     121        return nodes;
    117122    }
    118123}
  • trunk/src/org/openstreetmap/josm/command/PurgePrimitivesCommand.java

    r1690 r1750  
    66import java.util.ArrayList;
    77import java.util.Collection;
    8 import java.util.HashMap;
    98import java.util.List;
    10 import java.util.Map;
     9import java.util.logging.Logger;
    1110
    1211import javax.swing.JLabel;
     
    1514
    1615import org.openstreetmap.josm.Main;
     16import org.openstreetmap.josm.data.conflict.ConflictCollection;
    1717import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.data.osm.Node;
     
    2121import org.openstreetmap.josm.data.osm.RelationMember;
    2222import org.openstreetmap.josm.data.osm.Way;
     23import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2324import org.openstreetmap.josm.tools.ImageProvider;
    2425
     
    3435 *
    3536 */
    36 public class PurgePrimitivesCommand extends Command{
    37 
     37public class PurgePrimitivesCommand extends ConflictResolveCommand{
     38
     39    static private final Logger logger = Logger.getLogger(PurgePrimitivesCommand.class.getName());
    3840
    3941    /**
     
    144146    private ArrayList<OsmParentChildPair> pairs;
    145147
    146     private Map<OsmPrimitive, OsmPrimitive> resolvedConflicts;
    147148
    148149    /**
     
    154155        purgedPrimitives = new ArrayList<OsmPrimitive>();
    155156        pairs = new ArrayList<OsmParentChildPair>();
    156         resolvedConflicts = new HashMap<OsmPrimitive, OsmPrimitive>();
    157157    }
    158158
     
    219219            purge(toPurge, Main.ds, hive);
    220220            if (toPurge instanceof Node) {
    221                 Main.ds.nodes.remove(toPurge);
     221                getLayer().data.nodes.remove(toPurge);
    222222            } else if (primitive instanceof Way) {
    223                 Main.ds.ways.remove(toPurge);
     223                getLayer().data.ways.remove(toPurge);
    224224            } else if (primitive instanceof Relation) {
    225                 Main.ds.relations.remove(toPurge);
     225                getLayer().data.relations.remove(toPurge);
    226226            }
    227227            purgedPrimitives.add(toPurge);
    228             if (Main.map.conflictDialog.conflicts.containsKey(toPurge)) {
    229                 resolvedConflicts.put(toPurge, Main.map.conflictDialog.conflicts.get(toPurge));
    230                 Main.map.conflictDialog.removeConflictForPrimitive(toPurge);
     228            ConflictCollection conflicts = getLayer().getConflicts();
     229            if (conflicts.hasConflictForMy(toPurge)) {
     230                rememberConflict(conflicts.getConflictForMy(toPurge));
     231                conflicts.remove(toPurge);
    231232            }
    232233        }
     
    246247    @Override
    247248    public void undoCommand() {
     249        if (! Main.map.mapView.hasLayer(getLayer())) {
     250            logger.warning(tr("Can't undo command ''{0}'' because layer ''{1}'' is not present anymore",
     251                    this.toString(),
     252                    getLayer().toString()
     253            ));
     254            return;
     255        }
     256        Main.map.mapView.setActiveLayer(getLayer());
    248257
    249258        // restore purged primitives
    250259        //
    251260        for (OsmPrimitive purged : purgedPrimitives) {
    252             Main.ds.addPrimitive(purged);
    253         }
    254 
    255         // restore conflicts
    256         //
    257         for (OsmPrimitive primitive : resolvedConflicts.keySet()) {
    258             Main.map.conflictDialog.addConflict(primitive, resolvedConflicts.get(primitive));
    259         }
    260 
     261            getLayer().data.addPrimitive(purged);
     262        }
     263        reconstituteConflicts();
    261264        // will restore the former references to the purged nodes
    262265        //
  • trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java

    r1676 r1750  
    66import java.util.Collection;
    77import java.util.List;
     8import java.util.logging.Logger;
    89
    910import javax.swing.JLabel;
     
    1516import org.openstreetmap.josm.data.osm.Relation;
    1617import org.openstreetmap.josm.data.osm.RelationMember;
     18import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1719import org.openstreetmap.josm.tools.ImageProvider;
    1820
     
    2325 */
    2426public class RelationMemberConflictResolverCommand extends Command {
     27    private static final Logger logger = Logger.getLogger(RelationMemberConflictResolverCommand.class.getName());
    2528
    2629    /** my relation */
     
    3235     */
    3336    private final List<RelationMember> mergedMembers;
     37
     38    /** the layer this conflict is resolved in */
     39    private OsmDataLayer layer;
    3440
    3541    /**
     
    7177            my.members.add(n);
    7278        }
     79
     80        // remember the layer
     81        layer = Main.main.map.mapView.getEditLayer();
    7382        return true;
    7483    }
     
    8291    @Override
    8392    public void undoCommand() {
     93        if (! Main.map.mapView.hasLayer(layer)) {
     94            logger.warning(tr("Can't undo command ''{0}'' because layer ''{1}'' is not present anymore",
     95                    this.toString(),
     96                    layer.toString()
     97            ));
     98            return;
     99        }
     100
     101        Main.map.mapView.setActiveLayer(layer);
     102        OsmDataLayer editLayer = Main.map.mapView.getEditLayer();
     103
    84104        // restore the former state
    85105        //
     
    88108        // restore a conflict if necessary
    89109        //
    90         if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    91             Main.map.conflictDialog.conflicts.put(my,their);
     110        if (!editLayer.getConflicts().hasConflictForMy(my)) {
     111            editLayer.getConflicts().add(my,their);
    92112        }
    93113    }
  • trunk/src/org/openstreetmap/josm/command/RemoveRelationMemberCommand.java

    r630 r1750  
    6464        NameVisitor v = new NameVisitor();
    6565        relation.visit(v);
    66         return new DefaultMutableTreeNode(new JLabel(tr("RemoveRelationMember")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
     66        return new DefaultMutableTreeNode(new JLabel(tr("RemoveRelationMember {0} {1}", tr(v.className), v.name), v.icon, JLabel.HORIZONTAL));
    6767    }
    6868}
  • trunk/src/org/openstreetmap/josm/command/RotateCommand.java

    r1728 r1750  
    3030     * The objects to rotate.
    3131     */
    32     public Collection<Node> objects = new LinkedList<Node>();
     32    private Collection<Node> nodes = new LinkedList<Node>();
    3333
    3434    /**
     
    7070    public RotateCommand(Collection<OsmPrimitive> objects, EastNorth start, EastNorth end) {
    7171
    72         this.objects = AllNodesVisitor.getAllNodes(objects);
     72        this.nodes = AllNodesVisitor.getAllNodes(objects);
    7373        pivot = new EastNorth(0,0);
    7474
    75         for (Node n : this.objects) {
     75        for (Node n : this.nodes) {
    7676            OldState os = new OldState();
    7777            os.latlon = new LatLon(n.getCoor());
     
    8181            pivot = pivot.add(os.eastNorth.east(), os.eastNorth.north());
    8282        }
    83         pivot = new EastNorth(pivot.east()/this.objects.size(), pivot.north()/this.objects.size());
     83        pivot = new EastNorth(pivot.east()/this.nodes.size(), pivot.north()/this.nodes.size());
    8484
    8585        rotationAngle = Math.PI/2;
     
    105105     */
    106106    private void rotateNodes(boolean setModified) {
    107         for (Node n : objects) {
     107        for (Node n : nodes) {
    108108            double cosPhi = Math.cos(rotationAngle);
    109109            double sinPhi = Math.sin(rotationAngle);
     
    114114            double ny = -cosPhi * x + sinPhi * y + pivot.north();
    115115            n.setEastNorth(new EastNorth(nx, ny));
    116             if (setModified)
     116            if (setModified) {
    117117                n.modified = true;
     118            }
    118119        }
    119120    }
     
    125126
    126127    @Override public void undoCommand() {
    127         for (Node n : objects) {
     128        for (Node n : nodes) {
    128129            OldState os = oldState.get(n);
    129130            n.setCoor(os.latlon);
     
    133134
    134135    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
    135         for (OsmPrimitive osm : objects)
     136        for (OsmPrimitive osm : nodes) {
    136137            modified.add(osm);
     138        }
    137139    }
    138140
    139141    @Override public MutableTreeNode description() {
    140         return new DefaultMutableTreeNode(new JLabel(tr("Rotate")+" "+objects.size()+" "+trn("node","nodes",objects.size()), ImageProvider.get("data", "node"), JLabel.HORIZONTAL));
     142        return new DefaultMutableTreeNode(new JLabel(tr("Rotate {0} {1}",nodes.size(),trn("node","nodes",nodes.size())), ImageProvider.get("data", "node"), JLabel.HORIZONTAL));
     143    }
     144
     145    public Collection<Node> getRotatedNodes() {
     146        return nodes;
    141147    }
    142148}
  • trunk/src/org/openstreetmap/josm/command/SequenceCommand.java

    r1169 r1750  
    3333     */
    3434    public SequenceCommand(String name, Collection<Command> sequenz) {
     35        super();
    3536        this.name = name;
    3637        this.sequence = new Command[sequenz.size()];
     
    4546    }
    4647
    47     public int executed_commands = 0;
    4848    @Override public boolean executeCommand() {
    4949        for (int i=0; i < sequence.length; i++) {
    5050            Command c = sequence[i];
    5151            boolean result = c.executeCommand();
    52             if (!result)
     52            if (!result) {
    5353                Main.debug("SequenceCommand, executing command[" + i + "] " +  c + " result: " + result);
     54            }
    5455            if (!result && !continueOnError) {
    5556                this.undoCommands(i-1);
     
    7273        if (!sequence_complete)
    7374            return;
    74         for (int i = start; i >= 0; --i)
     75        for (int i = start; i >= 0; --i) {
    7576            sequence[i].undoCommand();
     77        }
    7678    }
    7779
     
    8183
    8284    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
    83         for (Command c : sequence)
     85        for (Command c : sequence) {
    8486            c.fillModifiedData(modified, deleted, added);
     87        }
    8588    }
    8689
    8790    @Override public MutableTreeNode description() {
    8891        DefaultMutableTreeNode root = new DefaultMutableTreeNode(tr("Sequence")+": "+name);
    89         for (Command c : sequence)
     92        for (Command c : sequence) {
    9093            root.add(c.description());
     94        }
    9195        return root;
    9296    }
  • trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java

    r1670 r1750  
    66import java.util.Collection;
    77import java.util.List;
     8import java.util.logging.Logger;
    89
    910import javax.swing.JLabel;
     
    1112import javax.swing.tree.MutableTreeNode;
    1213
    13 import org.openstreetmap.josm.Main;
    14 import org.openstreetmap.josm.data.osm.Node;
     14import org.openstreetmap.josm.data.conflict.Conflict;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1616import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    17 import org.openstreetmap.josm.data.osm.Relation;
    18 import org.openstreetmap.josm.data.osm.Way;
    1917import org.openstreetmap.josm.gui.conflict.MergeDecisionType;
    2018import org.openstreetmap.josm.gui.conflict.tags.TagMergeItem;
     
    2523 *
    2624 */
    27 public class TagConflictResolveCommand extends Command {
     25public class TagConflictResolveCommand extends ConflictResolveCommand {
     26    private static final Logger logger = Logger.getLogger(TagConflictResolveCommand.class.getName());
    2827
    29     /** my primitive (in the local dataset). merge decisions are applied to this
    30      *  primitive
    31      */
    32     private final OsmPrimitive my;
    33     /** their primitive (in the server dataset) */
    34     private final OsmPrimitive their;
     28
     29    /** the conflict to resolve */
     30    private Conflict<OsmPrimitive> conflict;
    3531
    3632    /** the list of merge decisions, represented as {@see TagMergeItem}s */
    3733    private final List<TagMergeItem> mergeItems;
     34
    3835
    3936    /**
     
    6057     */
    6158    public TagConflictResolveCommand(OsmPrimitive my, OsmPrimitive their, List<TagMergeItem> mergeItems) {
    62         this.my = my;
    63         this.their = their;
     59        this.conflict = new Conflict<OsmPrimitive>(my,their);
    6460        this.mergeItems = mergeItems;
    6561    }
     
    7066        return new DefaultMutableTreeNode(
    7167                new JLabel(
    72                         tr("Resolve {0} tag conflicts in {1} {2}",getNumDecidedConflicts(), OsmPrimitiveType.from(my).getLocalizedDisplayNameSingular(), my.id),
     68                        tr("Resolve {0} tag conflicts in {1} {2}",getNumDecidedConflicts(), OsmPrimitiveType.from(conflict.getMy()).getLocalizedDisplayNameSingular(), conflict.getMy().id),
    7369                        ImageProvider.get("data", "object"),
    7470                        JLabel.HORIZONTAL
     
    8884        for (TagMergeItem item: mergeItems) {
    8985            if (! item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) {
    90                 item.applyToMyPrimitive(my);
     86                item.applyToMyPrimitive(conflict.getMy());
    9187            }
    9288        }
     89        rememberConflict(conflict);
    9390        return true;
    9491    }
     
    9794    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
    9895            Collection<OsmPrimitive> added) {
    99         modified.add(my);
    100     }
    101 
    102     @Override
    103     public void undoCommand() {
    104         // restore former state of modified primitives
    105         //
    106         super.undoCommand();
    107 
    108         // restore a conflict if necessary
    109         //
    110         if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    111             Main.map.conflictDialog.addConflict(my, their);
    112         }
     96        modified.add(conflict.getMy());
    11397    }
    11498}
  • trunk/src/org/openstreetmap/josm/command/UndeletePrimitivesCommand.java

    r1690 r1750  
    66import java.util.ArrayList;
    77import java.util.Collection;
    8 import java.util.HashMap;
    9 import java.util.Map;
     8import java.util.logging.Logger;
    109
    1110import javax.swing.JLabel;
     
    1514import org.openstreetmap.josm.Main;
    1615import org.openstreetmap.josm.data.osm.OsmPrimitive;
     16import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1717import org.openstreetmap.josm.tools.ImageProvider;
    1818
    1919/**
    20  * Represents a command for undeleting a node which was deleted on the server.
     20 * Represents a command for undeleting an {@see OsmPrimitive} which was deleted on the server.
    2121 * The command remembers the former node id and sets the node id to 0. This turns
    2222 * the node into a new node which can be uploaded to the server.
    2323 *
    2424 */
    25 public class UndeletePrimitivesCommand extends Command {
     25public class UndeletePrimitivesCommand extends ConflictResolveCommand {
     26    static private final Logger logger = Logger.getLogger(UndeletePrimitivesCommand.class.getName());
    2627
    2728    /** the node to undelete */
    2829    private ArrayList<OsmPrimitive> toUndelete;
    29     private Map<OsmPrimitive,OsmPrimitive> resolvedConflicts;
    3030
    3131    protected UndeletePrimitivesCommand() {
    3232        toUndelete = new ArrayList<OsmPrimitive>();
    33         resolvedConflicts = new HashMap<OsmPrimitive, OsmPrimitive>();
    3433    }
    3534    /**
     
    7776    public boolean executeCommand() {
    7877        super.executeCommand();
     78
    7979        for(OsmPrimitive primitive: toUndelete) {
    80             if (Main.map.conflictDialog.conflicts.containsKey(primitive)) {
    81                 resolvedConflicts.put(primitive, Main.map.conflictDialog.conflicts.get(primitive));
    82                 Main.map.conflictDialog.removeConflictForPrimitive(primitive);
     80            if(getLayer().getConflicts().hasConflictForMy(primitive)) {
     81                rememberConflict(getLayer().getConflicts().getConflictForMy(primitive));
     82                getLayer().getConflicts().remove(primitive);
    8383            }
    8484            primitive.id = 0;
     
    9292        modified.addAll(toUndelete);
    9393    }
    94     @Override
    95     public void undoCommand() {
    96         super.undoCommand();
    97 
    98         for (OsmPrimitive my: resolvedConflicts.keySet()) {
    99             if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    100                 Main.map.conflictDialog.addConflict(my, resolvedConflicts.get(my));
    101             }
    102         }
    103     }
    10494}
  • trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java

    r1690 r1750  
    1010import javax.swing.tree.MutableTreeNode;
    1111
    12 import org.openstreetmap.josm.Main;
     12import org.openstreetmap.josm.data.conflict.Conflict;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    2020 *
    2121 */
    22 public class VersionConflictResolveCommand extends Command {
     22public class VersionConflictResolveCommand extends ConflictResolveCommand {
    2323
    24     private final OsmPrimitive my;
    25     private final OsmPrimitive their;
     24    /** the conflict to resolve */
     25    private Conflict<OsmPrimitive> conflict;
    2626
    2727    /**
     
    3131     */
    3232    public VersionConflictResolveCommand(OsmPrimitive my, OsmPrimitive their) {
    33         this.my = my;
    34         this.their = their;
     33        conflict = new Conflict<OsmPrimitive>(my, their);
    3534    }
    3635
     
    3938        return new DefaultMutableTreeNode(
    4039                new JLabel(
    41                         tr("Resolve version conflicts for {0} {1}",OsmPrimitiveType.from(my).getLocalizedDisplayNameSingular(), my.id),
     40                        tr("Resolve version conflicts for {0} {1}",OsmPrimitiveType.from(conflict.getMy()).getLocalizedDisplayNameSingular(),conflict.getMy().id),
    4241                        ImageProvider.get("data", "object"),
    4342                        JLabel.HORIZONTAL
     
    4948    public boolean executeCommand() {
    5049        super.executeCommand();
    51         my.version = Math.max(my.version, their.version);
    52         Main.map.conflictDialog.removeConflictForPrimitive(my);
     50        conflict.getMy().version = Math.max(conflict.getMy().version, conflict.getTheir().version);
     51        getLayer().getConflicts().remove(conflict);
     52        rememberConflict(conflict);
    5353        return true;
    5454    }
     
    5757    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
    5858            Collection<OsmPrimitive> added) {
    59         modified.add(my);
    60     }
    61 
    62     @Override
    63     public void undoCommand() {
    64         super.undoCommand();
    65 
    66         // restore a conflict if necessary
    67         //
    68         if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    69             Main.map.conflictDialog.addConflict(my, their);
    70         }
     59        modified.add(conflict.getMy());
    7160    }
    7261}
  • trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java

    r1654 r1750  
    66import java.util.Collection;
    77import java.util.List;
     8import java.util.logging.Logger;
    89
    910import javax.swing.JLabel;
     
    1112import javax.swing.tree.MutableTreeNode;
    1213
    13 import org.openstreetmap.josm.Main;
     14import org.openstreetmap.josm.data.conflict.Conflict;
    1415import org.openstreetmap.josm.data.osm.Node;
    1516import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2223 *
    2324 */
    24 public class WayNodesConflictResolverCommand extends Command {
     25public class WayNodesConflictResolverCommand extends ConflictResolveCommand {
    2526
    26     /** my way */
    27     private final Way my;
    28     /** their way */
    29     private final Way their;
     27    static private final Logger logger = Logger.getLogger(WayNodesConflictResolverCommand.class.getName());
     28
     29    /** the conflict to resolve */
     30    private Conflict<Way> conflict;
     31
    3032    /** the list of merged nodes. This becomes the list of news of my way after the
    3133     *  command is executed
    3234     */
    3335    private final List<Node> mergedNodeList;
     36
    3437
    3538    /**
     
    4043     */
    4144    public WayNodesConflictResolverCommand(Way my, Way their, List<Node> mergedNodeList) {
    42         this.my = my;
    43         this.their = their;
     45        conflict = new Conflict<Way>(my,their);
    4446        this.mergedNodeList = mergedNodeList;
    4547    }
     
    5052        return new DefaultMutableTreeNode(
    5153                new JLabel(
    52                         tr("Resolve conflicts in node list of of way {0}", my.id),
     54                        tr("Resolve conflicts in node list of of way {0}", conflict.getMy().id),
    5355                        ImageProvider.get("data", "object"),
    5456                        JLabel.HORIZONTAL
     
    6668        // nodes
    6769        //
    68         my.nodes.clear();
     70        conflict.getMy().nodes.clear();
    6971        for (int i=0; i<mergedNodeList.size();i++) {
    7072            Node n = mergedNodeList.get(i);
    71             my.nodes.add(n);
    72             if (! Main.ds.nodes.contains(n)) {
    73                 System.out.println("Main.ds doesn't include node " + n.toString());
     73            conflict.getMy().nodes.add(n);
     74            if (! getLayer().data.nodes.contains(n)) {
     75                logger.warning(tr("Main.ds doesn't include node {0}", n.toString()));
    7476            }
    7577        }
     78        rememberConflict(conflict);
    7679        return true;
    7780    }
     
    8083    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
    8184            Collection<OsmPrimitive> added) {
    82         modified.add(my);
    83     }
    84 
    85     @Override
    86     public void undoCommand() {
    87         // restore the former state
    88         //
    89         super.undoCommand();
    90 
    91         // restore a conflict if necessary
    92         //
    93         if (!Main.map.conflictDialog.conflicts.containsKey(my)) {
    94             Main.map.conflictDialog.addConflict(my, their);
    95         }
     85        modified.add(conflict.getMy());
    9686    }
    9787}
Note: See TracChangeset for help on using the changeset viewer.