Index: trunk/src/org/openstreetmap/josm/command/ConflictAddCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/ConflictAddCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,74 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-
-import javax.swing.Icon;
-import javax.swing.JOptionPane;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.DefaultNameFormatter;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-public class ConflictAddCommand extends Command {
-    private Conflict<? extends OsmPrimitive> conflict;
-
-    public ConflictAddCommand(OsmDataLayer layer, Conflict<? extends OsmPrimitive> conflict) {
-        super(layer);
-        this.conflict  = conflict;
-    }
-
-    protected void warnBecauseOfDoubleConflict() {
-        JOptionPane.showMessageDialog(
-                Main.parent,
-                tr("<html>Layer ''{0}'' already has a conflict for object<br>"
-                        + "''{1}''.<br>"
-                        + "This conflict cannot be added.</html>",
-                        getLayer().getName(),
-                        conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
-                ),
-                tr("Double conflict"),
-                JOptionPane.ERROR_MESSAGE
-        );
-    }
-    @Override public boolean executeCommand() {
-        try {
-            getLayer().getConflicts().add(conflict);
-        } catch(IllegalStateException e) {
-            Main.error(e);
-            warnBecauseOfDoubleConflict();
-        }
-        return true;
-    }
-
-    @Override public void undoCommand() {
-        if (! Main.map.mapView.hasLayer(getLayer())) {
-            Main.warn(tr("Layer ''{0}'' does not exist any more. Cannot remove conflict for object ''{1}''.",
-                    getLayer().getName(),
-                    conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
-            ));
-            return;
-        }
-        getLayer().getConflicts().remove(conflict);
-    }
-
-    @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
-        // nothing to fill
-    }
-
-    @Override
-    public String getDescriptionText() {
-        return tr("Add conflict for ''{0}''",
-                conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance()));
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get(conflict.getMy().getDisplayType());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/ConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/ConflictResolveCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,80 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.conflict.ConflictCollection;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-
-/**
- * This is the common base class for {@link Command}s which manipulate {@link Conflict}s in
- * addition to {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s.
- *
- * A ConflictResolverCommand can remember a collection of conflicts it resolves. Upon undoing
- * it reconstitutes them.
- *
- */
-public abstract class ConflictResolveCommand extends Command {
-    /** the list of resolved conflicts */
-    private ConflictCollection resolvedConflicts;
-
-    /**
-     * Constructs a new {@code ConflictResolveCommand} in the context of the current edit layer, if any.
-     */
-    public ConflictResolveCommand() {
-        super();
-        resolvedConflicts = new ConflictCollection();
-    }
-
-    /**
-     * Constructs a new {@code ConflictResolveCommand} in the context of a given data layer.
-     * @param layer the data layer. Must not be null.
-     */
-    public ConflictResolveCommand(OsmDataLayer layer) {
-        super(layer);
-        resolvedConflicts = new ConflictCollection();
-    }
-
-    /**
-     * remembers a conflict in the internal list of remembered conflicts
-     *
-     * @param c the remembered conflict
-     */
-    protected void rememberConflict(Conflict<?> c) {
-        if (! resolvedConflicts.hasConflictForMy(c.getMy())) {
-            resolvedConflicts.add(c);
-        }
-    }
-
-    /**
-     * reconstitutes all remembered conflicts. Add the remembered conflicts to the
-     * set of conflicts of the {@link OsmDataLayer} this command was applied to.
-     *
-     */
-    protected void reconstituteConflicts() {
-        OsmDataLayer editLayer = getLayer();
-        for(Conflict<?> c : resolvedConflicts) {
-            if (!editLayer.getConflicts().hasConflictForMy(c.getMy())) {
-                editLayer.getConflicts().add(c);
-            }
-        }
-    }
-
-    @Override
-    public void undoCommand() {
-        super.undoCommand();
-
-        if (! Main.map.mapView.hasLayer(getLayer())) {
-            Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
-                    this.toString(),
-                    getLayer().toString()
-            ));
-            return;
-        }
-
-        Main.map.mapView.setActiveLayer(getLayer());
-        reconstituteConflicts();
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,78 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of a conflict between the coordinates of two {@link Node}s.
- *
- */
-public class CoordinateConflictResolveCommand extends ConflictResolveCommand {
-
-    /** the conflict to resolve */
-    private Conflict<? extends OsmPrimitive> conflict;
-
-    /** the merge decision */
-    private final MergeDecisionType decision;
-
-    /**
-     * constructor for coordinate conflict
-     *
-     * @param conflict the conflict data set
-     * @param decision the merge decision
-     */
-    public CoordinateConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, MergeDecisionType decision) {
-        this.conflict = conflict;
-        this.decision = decision;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        return tr("Resolve conflicts in coordinates in {0}", conflict.getMy().getId());
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        // remember the current state of modified primitives, i.e. of
-        // OSM primitive 'my'
-        //
-        super.executeCommand();
-
-        if (decision.equals(MergeDecisionType.KEEP_MINE)) {
-            // do nothing
-        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
-            Node my = (Node)conflict.getMy();
-            Node their = (Node)conflict.getTheir();
-            my.setCoor(their.getCoor());
-        } else
-            // should not happen
-            throw new IllegalStateException(tr("Cannot resolve undecided conflict."));
-
-        // remember the layer this command was applied to
-        //
-        rememberConflict(conflict);
-
-        return true;
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(conflict.getMy());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,90 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-import java.util.Set;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of a conflict between the deleted flag of two {@link OsmPrimitive}s.
- * @since 1654
- */
-public class DeletedStateConflictResolveCommand extends ConflictResolveCommand {
-
-    /** the conflict to resolve */
-    private Conflict<? extends OsmPrimitive> conflict;
-
-    /** the merge decision */
-    private final MergeDecisionType decision;
-
-    /**
-     * Constructs a new {@code DeletedStateConflictResolveCommand}.
-     *
-     * @param conflict the conflict data set
-     * @param decision the merge decision
-     */
-    public DeletedStateConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, MergeDecisionType decision) {
-        this.conflict = conflict;
-        this.decision = decision;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        return tr("Resolve conflicts in deleted state in {0}", conflict.getMy().getId());
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        // remember the current state of modified primitives, i.e. of OSM primitive 'my'
-        super.executeCommand();
-
-        if (decision.equals(MergeDecisionType.KEEP_MINE)) {
-            if (conflict.getMy().isDeleted() || conflict.isMyDeleted()) {
-                // because my was involved in a conflict it my still be referred
-                // to from a way or a relation. Fix this now.
-                deleteMy();
-            }
-        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
-            if (conflict.getTheir().isDeleted()) {
-                deleteMy();
-            } else {
-                conflict.getMy().setDeleted(false);
-            }
-        } else
-            // should not happen
-            throw new IllegalStateException(tr("Cannot resolve undecided conflict."));
-
-        rememberConflict(conflict);
-        return true;
-    }
-    
-    private void deleteMy() {
-        Set<OsmPrimitive> referrers = getLayer().data.unlinkReferencesToPrimitive(conflict.getMy());
-        for (OsmPrimitive p : referrers) {
-            if (!p.isNew() && !p.isDeleted()) {
-                p.setModified(true);
-            }
-        }
-        conflict.getMy().setDeleted(true);
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(conflict.getMy());
-        modified.addAll(conflict.getMy().getReferrers());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,66 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.marktr;
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of a conflict between the modified flag of two {@link OsmPrimitive}s.
- *
- *
- */
-public class ModifiedConflictResolveCommand extends ConflictResolveCommand {
-
-    /** the conflict to resolve */
-    private Conflict<? extends OsmPrimitive> conflict;
-
-    /**
-     * constructor
-     * @param conflict the conflict data set
-     */
-    public ModifiedConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict) {
-        this.conflict = conflict;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        String msg = "";
-        switch(OsmPrimitiveType.from(conflict.getMy())) {
-        case NODE: msg = marktr("Set the ''modified'' flag for node {0}"); break;
-        case WAY: msg = marktr("Set the ''modified'' flag for way {0}"); break;
-        case RELATION: msg = marktr("Set the ''modified'' flag for relation {0}"); break;
-        }
-        return tr(msg,conflict.getMy().getId());
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        super.executeCommand();
-        if (!conflict.getMy().isNew() && conflict.getMy().hasEqualSemanticAttributes(conflict.getTheir())) {
-            conflict.getMy().setModified(conflict.getTheir().isModified());
-        }
-        getLayer().getConflicts().remove(conflict);
-        rememberConflict(conflict);
-        return true;
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(conflict.getMy());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,97 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.Relation;
-import org.openstreetmap.josm.data.osm.RelationMember;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of conflicts in the member list of two {@link Relation}s.
- *
- */
-public class RelationMemberConflictResolverCommand extends ConflictResolveCommand {
-    /** my relation */
-    private final Relation my;
-    /** their relation */
-    private final Relation their;
-    /** the list of merged nodes. This becomes the list of news of my way after the
-     *  command is executed
-     */
-    private final List<RelationMember> mergedMembers;
-
-    /**
-     *
-     * @param my my relation
-     * @param their their relation
-     * @param mergedMembers the list of merged relation members
-     */
-    public RelationMemberConflictResolverCommand(Relation my, Relation their, List<RelationMember> mergedMembers) {
-        this.my = my;
-        this.their = their;
-        this.mergedMembers = mergedMembers;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        return tr("Resolve conflicts in member list of relation {0}", my.getId());
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        // remember the current state of 'my' way
-        //
-        super.executeCommand();
-
-        // replace the list of members of 'my' relation by the list of merged members
-        //
-        my.setMembers(mergedMembers);
-
-        return true;
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(my);
-    }
-
-    @Override
-    public void undoCommand() {
-        OsmDataLayer layer = getLayer();
-        if (! Main.map.mapView.hasLayer(layer)) {
-            Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
-                    this.toString(),
-                    layer.toString()
-            ));
-            return;
-        }
-
-        Main.map.mapView.setActiveLayer(layer);
-        OsmDataLayer editLayer = Main.main.getEditLayer();
-
-        // restore the former state
-        //
-        super.undoCommand();
-
-        // restore a conflict if necessary
-        //
-        if (!editLayer.getConflicts().hasConflictForMy(my)) {
-            editLayer.getConflicts().add(my,their);
-        }
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,99 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.trn;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
-import org.openstreetmap.josm.gui.conflict.pair.tags.TagMergeItem;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of a tag conflict in an {@link OsmPrimitive}.
- *
- */
-public class TagConflictResolveCommand extends ConflictResolveCommand {
-    /** the conflict to resolve */
-    private Conflict<? extends OsmPrimitive> conflict;
-
-    /** the list of merge decisions, represented as {@link TagMergeItem}s */
-    private final List<TagMergeItem> mergeItems;
-
-    /**
-     * replies the number of decided conflicts
-     *
-     * @return the number of decided conflicts
-     */
-    public int getNumDecidedConflicts() {
-        int n = 0;
-        for (TagMergeItem item: mergeItems) {
-            if (!item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) {
-                n++;
-            }
-        }
-        return n;
-    }
-
-    /**
-     * constructor
-     *
-     * @param conflict the conflict data set
-     * @param mergeItems the list of merge decisions, represented as {@link TagMergeItem}s
-     */
-    public TagConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, List<TagMergeItem> mergeItems) {
-        this.conflict = conflict;
-        this.mergeItems = mergeItems;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        switch (OsmPrimitiveType.from(conflict.getMy())) {
-            case NODE:
-                /* for correct i18n of plural forms - see #9110 */
-                return trn("Resolve {0} tag conflict in node {1}", "Resolve {0} tag conflicts in node {1}", getNumDecidedConflicts(), getNumDecidedConflicts(), conflict.getMy().getId());
-            case WAY:
-                /* for correct i18n of plural forms - see #9110 */
-                return trn("Resolve {0} tag conflict in way {1}", "Resolve {0} tag conflicts in way {1}", getNumDecidedConflicts(), getNumDecidedConflicts(), conflict.getMy().getId());
-            case RELATION:
-                /* for correct i18n of plural forms - see #9110 */
-                return trn("Resolve {0} tag conflict in relation {1}", "Resolve {0} tag conflicts in relation {1}", getNumDecidedConflicts(), getNumDecidedConflicts(), conflict.getMy().getId());
-        }
-        return "";
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        // remember the current state of modified primitives, i.e. of
-        // OSM primitive 'my'
-        //
-        super.executeCommand();
-
-        // apply the merge decisions to OSM primitive 'my'
-        //
-        for (TagMergeItem item: mergeItems) {
-            if (! item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) {
-                item.applyToMyPrimitive(conflict.getMy());
-            }
-        }
-        rememberConflict(conflict);
-        return true;
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(conflict.getMy());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,75 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.marktr;
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of a version conflict between two {@link OsmPrimitive}s.
- *
- *
- */
-public class VersionConflictResolveCommand extends ConflictResolveCommand {
-
-    /** the conflict to resolve */
-    private Conflict<? extends OsmPrimitive> conflict;
-
-    /**
-     * constructor
-     * @param conflict the conflict data set
-     */
-    public VersionConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict) {
-        this.conflict = conflict;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        String msg = "";
-        switch(OsmPrimitiveType.from(conflict.getMy())) {
-        case NODE: msg = marktr("Resolve version conflict for node {0}"); break;
-        case WAY: msg = marktr("Resolve version conflict for way {0}"); break;
-        case RELATION: msg = marktr("Resolve version conflict for relation {0}"); break;
-        }
-        return tr(msg, conflict.getMy().getId());
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        super.executeCommand();
-        if (!conflict.getMy().isNew()) {
-            long myVersion = conflict.getMy().getVersion();
-            long theirVersion = conflict.getTheir().getVersion();
-            conflict.getMy().setOsmId(
-                    conflict.getMy().getId(),
-                    (int)Math.max(myVersion, theirVersion)
-            );
-            // update visiblity state
-            if (theirVersion >= myVersion) {
-                conflict.getMy().setVisible(conflict.getTheir().isVisible());
-            }
-        }
-        getLayer().getConflicts().remove(conflict);
-        rememberConflict(conflict);
-        return true;
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(conflict.getMy());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java	(revision 6886)
+++ 	(revision )
@@ -1,74 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.command;
-
-import static org.openstreetmap.josm.tools.I18n.tr;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.conflict.Conflict;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Represents the resolution of conflicts in the node list of two {@link Way}s.
- *
- */
-public class WayNodesConflictResolverCommand extends ConflictResolveCommand {
-    /** the conflict to resolve */
-    private Conflict<Way> conflict;
-
-    /** the list of merged nodes. This becomes the list of news of my way after the
-     *  command is executed
-     */
-    private final List<Node> mergedNodeList;
-
-    /**
-     * @param conflict the conflict data set
-     * @param mergedNodeList the list of merged nodes
-     */
-    @SuppressWarnings("unchecked")
-    public WayNodesConflictResolverCommand(Conflict<? extends OsmPrimitive> conflict, List<Node> mergedNodeList) {
-        this.conflict = (Conflict<Way>) conflict;
-        this.mergedNodeList = mergedNodeList;
-    }
-
-    @Override
-    public String getDescriptionText() {
-        return tr("Resolve conflicts in node list of way {0}", conflict.getMy().getId());
-    }
-
-    @Override
-    public Icon getDescriptionIcon() {
-        return ImageProvider.get("data", "object");
-    }
-
-    @Override
-    public boolean executeCommand() {
-        // remember the current state of 'my' way
-        //
-        super.executeCommand();
-
-        // replace the list of nodes of 'my' way by the list of merged nodes
-        //
-        for (Node n:mergedNodeList) {
-            if (! getLayer().data.getNodes().contains(n)) {
-                Main.warn(tr("Main dataset does not include node {0}", n.toString()));
-            }
-        }
-        conflict.getMy().setNodes(mergedNodeList);
-        rememberConflict(conflict);
-        return true;
-    }
-
-    @Override
-    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
-            Collection<OsmPrimitive> added) {
-        modified.add(conflict.getMy());
-    }
-}
Index: trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java	(revision 6887)
@@ -0,0 +1,88 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+
+import javax.swing.Icon;
+import javax.swing.JOptionPane;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Command used to add a new conflict.
+ * @since 1857
+ */
+public class ConflictAddCommand extends Command {
+    private Conflict<? extends OsmPrimitive> conflict;
+
+    /**
+     * Constructs a new {@code ConflictAddCommand}.
+     * @param layer the data layer. Must not be null.
+     * @param conflict the conflict to add
+     */
+    public ConflictAddCommand(OsmDataLayer layer, Conflict<? extends OsmPrimitive> conflict) {
+        super(layer);
+        this.conflict  = conflict;
+    }
+
+    protected void warnBecauseOfDoubleConflict() {
+        JOptionPane.showMessageDialog(
+                Main.parent,
+                tr("<html>Layer ''{0}'' already has a conflict for object<br>"
+                        + "''{1}''.<br>"
+                        + "This conflict cannot be added.</html>",
+                        getLayer().getName(),
+                        conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
+                ),
+                tr("Double conflict"),
+                JOptionPane.ERROR_MESSAGE
+        );
+    }
+
+    @Override
+    public boolean executeCommand() {
+        try {
+            getLayer().getConflicts().add(conflict);
+        } catch(IllegalStateException e) {
+            Main.error(e);
+            warnBecauseOfDoubleConflict();
+        }
+        return true;
+    }
+
+    @Override
+    public void undoCommand() {
+        if (! Main.map.mapView.hasLayer(getLayer())) {
+            Main.warn(tr("Layer ''{0}'' does not exist any more. Cannot remove conflict for object ''{1}''.",
+                    getLayer().getName(),
+                    conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance())
+            ));
+            return;
+        }
+        getLayer().getConflicts().remove(conflict);
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) {
+        // nothing to fill
+    }
+
+    @Override
+    public String getDescriptionText() {
+        return tr("Add conflict for ''{0}''",
+                conflict.getMy().getDisplayName(DefaultNameFormatter.getInstance()));
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get(conflict.getMy().getDisplayType());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java	(revision 6887)
@@ -0,0 +1,81 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.command.Command;
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.conflict.ConflictCollection;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+/**
+ * This is the common base class for {@link Command}s which manipulate {@link Conflict}s in
+ * addition to {@link org.openstreetmap.josm.data.osm.OsmPrimitive}s.
+ *
+ * A ConflictResolverCommand can remember a collection of conflicts it resolves. Upon undoing
+ * it reconstitutes them.
+ *
+ */
+public abstract class ConflictResolveCommand extends Command {
+    /** the list of resolved conflicts */
+    private ConflictCollection resolvedConflicts;
+
+    /**
+     * Constructs a new {@code ConflictResolveCommand} in the context of the current edit layer, if any.
+     */
+    public ConflictResolveCommand() {
+        super();
+        resolvedConflicts = new ConflictCollection();
+    }
+
+    /**
+     * Constructs a new {@code ConflictResolveCommand} in the context of a given data layer.
+     * @param layer the data layer. Must not be null.
+     */
+    public ConflictResolveCommand(OsmDataLayer layer) {
+        super(layer);
+        resolvedConflicts = new ConflictCollection();
+    }
+
+    /**
+     * remembers a conflict in the internal list of remembered conflicts
+     *
+     * @param c the remembered conflict
+     */
+    protected void rememberConflict(Conflict<?> c) {
+        if (! resolvedConflicts.hasConflictForMy(c.getMy())) {
+            resolvedConflicts.add(c);
+        }
+    }
+
+    /**
+     * reconstitutes all remembered conflicts. Add the remembered conflicts to the
+     * set of conflicts of the {@link OsmDataLayer} this command was applied to.
+     *
+     */
+    protected void reconstituteConflicts() {
+        OsmDataLayer editLayer = getLayer();
+        for(Conflict<?> c : resolvedConflicts) {
+            if (!editLayer.getConflicts().hasConflictForMy(c.getMy())) {
+                editLayer.getConflicts().add(c);
+            }
+        }
+    }
+
+    @Override
+    public void undoCommand() {
+        super.undoCommand();
+
+        if (! Main.map.mapView.hasLayer(getLayer())) {
+            Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
+                    this.toString(),
+                    getLayer().toString()
+            ));
+            return;
+        }
+
+        Main.map.mapView.setActiveLayer(getLayer());
+        reconstituteConflicts();
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommand.java	(revision 6887)
@@ -0,0 +1,78 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of a conflict between the coordinates of two {@link Node}s.
+ *
+ */
+public class CoordinateConflictResolveCommand extends ConflictResolveCommand {
+
+    /** the conflict to resolve */
+    private Conflict<? extends OsmPrimitive> conflict;
+
+    /** the merge decision */
+    private final MergeDecisionType decision;
+
+    /**
+     * constructor for coordinate conflict
+     *
+     * @param conflict the conflict data set
+     * @param decision the merge decision
+     */
+    public CoordinateConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, MergeDecisionType decision) {
+        this.conflict = conflict;
+        this.decision = decision;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        return tr("Resolve conflicts in coordinates in {0}", conflict.getMy().getId());
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        // remember the current state of modified primitives, i.e. of
+        // OSM primitive 'my'
+        //
+        super.executeCommand();
+
+        if (decision.equals(MergeDecisionType.KEEP_MINE)) {
+            // do nothing
+        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
+            Node my = (Node)conflict.getMy();
+            Node their = (Node)conflict.getTheir();
+            my.setCoor(their.getCoor());
+        } else
+            // should not happen
+            throw new IllegalStateException(tr("Cannot resolve undecided conflict."));
+
+        // remember the layer this command was applied to
+        //
+        rememberConflict(conflict);
+
+        return true;
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(conflict.getMy());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommand.java	(revision 6887)
@@ -0,0 +1,90 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+import java.util.Set;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of a conflict between the deleted flag of two {@link OsmPrimitive}s.
+ * @since 1654
+ */
+public class DeletedStateConflictResolveCommand extends ConflictResolveCommand {
+
+    /** the conflict to resolve */
+    private Conflict<? extends OsmPrimitive> conflict;
+
+    /** the merge decision */
+    private final MergeDecisionType decision;
+
+    /**
+     * Constructs a new {@code DeletedStateConflictResolveCommand}.
+     *
+     * @param conflict the conflict data set
+     * @param decision the merge decision
+     */
+    public DeletedStateConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, MergeDecisionType decision) {
+        this.conflict = conflict;
+        this.decision = decision;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        return tr("Resolve conflicts in deleted state in {0}", conflict.getMy().getId());
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        // remember the current state of modified primitives, i.e. of OSM primitive 'my'
+        super.executeCommand();
+
+        if (decision.equals(MergeDecisionType.KEEP_MINE)) {
+            if (conflict.getMy().isDeleted() || conflict.isMyDeleted()) {
+                // because my was involved in a conflict it my still be referred
+                // to from a way or a relation. Fix this now.
+                deleteMy();
+            }
+        } else if (decision.equals(MergeDecisionType.KEEP_THEIR)) {
+            if (conflict.getTheir().isDeleted()) {
+                deleteMy();
+            } else {
+                conflict.getMy().setDeleted(false);
+            }
+        } else
+            // should not happen
+            throw new IllegalStateException(tr("Cannot resolve undecided conflict."));
+
+        rememberConflict(conflict);
+        return true;
+    }
+    
+    private void deleteMy() {
+        Set<OsmPrimitive> referrers = getLayer().data.unlinkReferencesToPrimitive(conflict.getMy());
+        for (OsmPrimitive p : referrers) {
+            if (!p.isNew() && !p.isDeleted()) {
+                p.setModified(true);
+            }
+        }
+        conflict.getMy().setDeleted(true);
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(conflict.getMy());
+        modified.addAll(conflict.getMy().getReferrers());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java	(revision 6887)
@@ -0,0 +1,66 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.marktr;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of a conflict between the modified flag of two {@link OsmPrimitive}s.
+ *
+ *
+ */
+public class ModifiedConflictResolveCommand extends ConflictResolveCommand {
+
+    /** the conflict to resolve */
+    private Conflict<? extends OsmPrimitive> conflict;
+
+    /**
+     * constructor
+     * @param conflict the conflict data set
+     */
+    public ModifiedConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict) {
+        this.conflict = conflict;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        String msg = "";
+        switch(OsmPrimitiveType.from(conflict.getMy())) {
+        case NODE: msg = marktr("Set the ''modified'' flag for node {0}"); break;
+        case WAY: msg = marktr("Set the ''modified'' flag for way {0}"); break;
+        case RELATION: msg = marktr("Set the ''modified'' flag for relation {0}"); break;
+        }
+        return tr(msg,conflict.getMy().getId());
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        super.executeCommand();
+        if (!conflict.getMy().isNew() && conflict.getMy().hasEqualSemanticAttributes(conflict.getTheir())) {
+            conflict.getMy().setModified(conflict.getTheir().isModified());
+        }
+        getLayer().getConflicts().remove(conflict);
+        rememberConflict(conflict);
+        return true;
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(conflict.getMy());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java	(revision 6887)
@@ -0,0 +1,97 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.RelationMember;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of conflicts in the member list of two {@link Relation}s.
+ *
+ */
+public class RelationMemberConflictResolverCommand extends ConflictResolveCommand {
+    /** my relation */
+    private final Relation my;
+    /** their relation */
+    private final Relation their;
+    /** the list of merged nodes. This becomes the list of news of my way after the
+     *  command is executed
+     */
+    private final List<RelationMember> mergedMembers;
+
+    /**
+     *
+     * @param my my relation
+     * @param their their relation
+     * @param mergedMembers the list of merged relation members
+     */
+    public RelationMemberConflictResolverCommand(Relation my, Relation their, List<RelationMember> mergedMembers) {
+        this.my = my;
+        this.their = their;
+        this.mergedMembers = mergedMembers;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        return tr("Resolve conflicts in member list of relation {0}", my.getId());
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        // remember the current state of 'my' way
+        //
+        super.executeCommand();
+
+        // replace the list of members of 'my' relation by the list of merged members
+        //
+        my.setMembers(mergedMembers);
+
+        return true;
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(my);
+    }
+
+    @Override
+    public void undoCommand() {
+        OsmDataLayer layer = getLayer();
+        if (! Main.map.mapView.hasLayer(layer)) {
+            Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
+                    this.toString(),
+                    layer.toString()
+            ));
+            return;
+        }
+
+        Main.map.mapView.setActiveLayer(layer);
+        OsmDataLayer editLayer = Main.main.getEditLayer();
+
+        // restore the former state
+        //
+        super.undoCommand();
+
+        // restore a conflict if necessary
+        //
+        if (!editLayer.getConflicts().hasConflictForMy(my)) {
+            editLayer.getConflicts().add(my,their);
+        }
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/TagConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/TagConflictResolveCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/TagConflictResolveCommand.java	(revision 6887)
@@ -0,0 +1,99 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.trn;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
+import org.openstreetmap.josm.gui.conflict.pair.tags.TagMergeItem;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of a tag conflict in an {@link OsmPrimitive}.
+ *
+ */
+public class TagConflictResolveCommand extends ConflictResolveCommand {
+    /** the conflict to resolve */
+    private Conflict<? extends OsmPrimitive> conflict;
+
+    /** the list of merge decisions, represented as {@link TagMergeItem}s */
+    private final List<TagMergeItem> mergeItems;
+
+    /**
+     * replies the number of decided conflicts
+     *
+     * @return the number of decided conflicts
+     */
+    public int getNumDecidedConflicts() {
+        int n = 0;
+        for (TagMergeItem item: mergeItems) {
+            if (!item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) {
+                n++;
+            }
+        }
+        return n;
+    }
+
+    /**
+     * constructor
+     *
+     * @param conflict the conflict data set
+     * @param mergeItems the list of merge decisions, represented as {@link TagMergeItem}s
+     */
+    public TagConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict, List<TagMergeItem> mergeItems) {
+        this.conflict = conflict;
+        this.mergeItems = mergeItems;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        switch (OsmPrimitiveType.from(conflict.getMy())) {
+            case NODE:
+                /* for correct i18n of plural forms - see #9110 */
+                return trn("Resolve {0} tag conflict in node {1}", "Resolve {0} tag conflicts in node {1}", getNumDecidedConflicts(), getNumDecidedConflicts(), conflict.getMy().getId());
+            case WAY:
+                /* for correct i18n of plural forms - see #9110 */
+                return trn("Resolve {0} tag conflict in way {1}", "Resolve {0} tag conflicts in way {1}", getNumDecidedConflicts(), getNumDecidedConflicts(), conflict.getMy().getId());
+            case RELATION:
+                /* for correct i18n of plural forms - see #9110 */
+                return trn("Resolve {0} tag conflict in relation {1}", "Resolve {0} tag conflicts in relation {1}", getNumDecidedConflicts(), getNumDecidedConflicts(), conflict.getMy().getId());
+        }
+        return "";
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        // remember the current state of modified primitives, i.e. of
+        // OSM primitive 'my'
+        //
+        super.executeCommand();
+
+        // apply the merge decisions to OSM primitive 'my'
+        //
+        for (TagMergeItem item: mergeItems) {
+            if (! item.getMergeDecision().equals(MergeDecisionType.UNDECIDED)) {
+                item.applyToMyPrimitive(conflict.getMy());
+            }
+        }
+        rememberConflict(conflict);
+        return true;
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(conflict.getMy());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java	(revision 6887)
@@ -0,0 +1,75 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.marktr;
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of a version conflict between two {@link OsmPrimitive}s.
+ *
+ *
+ */
+public class VersionConflictResolveCommand extends ConflictResolveCommand {
+
+    /** the conflict to resolve */
+    private Conflict<? extends OsmPrimitive> conflict;
+
+    /**
+     * constructor
+     * @param conflict the conflict data set
+     */
+    public VersionConflictResolveCommand(Conflict<? extends OsmPrimitive> conflict) {
+        this.conflict = conflict;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        String msg = "";
+        switch(OsmPrimitiveType.from(conflict.getMy())) {
+        case NODE: msg = marktr("Resolve version conflict for node {0}"); break;
+        case WAY: msg = marktr("Resolve version conflict for way {0}"); break;
+        case RELATION: msg = marktr("Resolve version conflict for relation {0}"); break;
+        }
+        return tr(msg, conflict.getMy().getId());
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        super.executeCommand();
+        if (!conflict.getMy().isNew()) {
+            long myVersion = conflict.getMy().getVersion();
+            long theirVersion = conflict.getTheir().getVersion();
+            conflict.getMy().setOsmId(
+                    conflict.getMy().getId(),
+                    (int)Math.max(myVersion, theirVersion)
+            );
+            // update visiblity state
+            if (theirVersion >= myVersion) {
+                conflict.getMy().setVisible(conflict.getTheir().isVisible());
+            }
+        }
+        getLayer().getConflicts().remove(conflict);
+        rememberConflict(conflict);
+        return true;
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(conflict.getMy());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommand.java	(revision 6887)
@@ -0,0 +1,74 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.command.conflict;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Represents the resolution of conflicts in the node list of two {@link Way}s.
+ *
+ */
+public class WayNodesConflictResolverCommand extends ConflictResolveCommand {
+    /** the conflict to resolve */
+    private Conflict<Way> conflict;
+
+    /** the list of merged nodes. This becomes the list of news of my way after the
+     *  command is executed
+     */
+    private final List<Node> mergedNodeList;
+
+    /**
+     * @param conflict the conflict data set
+     * @param mergedNodeList the list of merged nodes
+     */
+    @SuppressWarnings("unchecked")
+    public WayNodesConflictResolverCommand(Conflict<? extends OsmPrimitive> conflict, List<Node> mergedNodeList) {
+        this.conflict = (Conflict<Way>) conflict;
+        this.mergedNodeList = mergedNodeList;
+    }
+
+    @Override
+    public String getDescriptionText() {
+        return tr("Resolve conflicts in node list of way {0}", conflict.getMy().getId());
+    }
+
+    @Override
+    public Icon getDescriptionIcon() {
+        return ImageProvider.get("data", "object");
+    }
+
+    @Override
+    public boolean executeCommand() {
+        // remember the current state of 'my' way
+        //
+        super.executeCommand();
+
+        // replace the list of nodes of 'my' way by the list of merged nodes
+        //
+        for (Node n:mergedNodeList) {
+            if (! getLayer().data.getNodes().contains(n)) {
+                Main.warn(tr("Main dataset does not include node {0}", n.toString()));
+            }
+        }
+        conflict.getMy().setNodes(mergedNodeList);
+        rememberConflict(conflict);
+        return true;
+    }
+
+    @Override
+    public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted,
+            Collection<OsmPrimitive> added) {
+        modified.add(conflict.getMy());
+    }
+}
Index: trunk/src/org/openstreetmap/josm/command/conflict/package-info.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/package-info.java	(revision 6887)
+++ trunk/src/org/openstreetmap/josm/command/conflict/package-info.java	(revision 6887)
@@ -0,0 +1,6 @@
+// License: GPL. For details, see LICENSE file.
+
+/**
+ * Provides commands for handling conflicts.
+ */
+package org.openstreetmap.josm.command.conflict;
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java	(revision 6886)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/ConflictResolver.java	(revision 6887)
@@ -16,7 +16,7 @@
 
 import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.ModifiedConflictResolveCommand;
 import org.openstreetmap.josm.command.SequenceCommand;
-import org.openstreetmap.josm.command.VersionConflictResolveCommand;
+import org.openstreetmap.josm.command.conflict.ModifiedConflictResolveCommand;
+import org.openstreetmap.josm.command.conflict.VersionConflictResolveCommand;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.osm.Node;
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModel.java	(revision 6886)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModel.java	(revision 6887)
@@ -9,5 +9,5 @@
 import javax.swing.table.DefaultTableModel;
 
-import org.openstreetmap.josm.command.WayNodesConflictResolverCommand;
+import org.openstreetmap.josm.command.conflict.WayNodesConflictResolverCommand;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.osm.Node;
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java	(revision 6886)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModel.java	(revision 6887)
@@ -12,6 +12,6 @@
 
 import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.CoordinateConflictResolveCommand;
-import org.openstreetmap.josm.command.DeletedStateConflictResolveCommand;
+import org.openstreetmap.josm.command.conflict.CoordinateConflictResolveCommand;
+import org.openstreetmap.josm.command.conflict.DeletedStateConflictResolveCommand;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.coor.LatLon;
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java	(revision 6886)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberListMergeModel.java	(revision 6887)
@@ -9,5 +9,5 @@
 import javax.swing.table.DefaultTableModel;
 
-import org.openstreetmap.josm.command.RelationMemberConflictResolverCommand;
+import org.openstreetmap.josm.command.conflict.RelationMemberConflictResolverCommand;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.PrimitiveId;
Index: trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeModel.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeModel.java	(revision 6886)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeModel.java	(revision 6887)
@@ -11,5 +11,5 @@
 import javax.swing.table.DefaultTableModel;
 
-import org.openstreetmap.josm.command.TagConflictResolveCommand;
+import org.openstreetmap.josm.command.conflict.TagConflictResolveCommand;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 6886)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java	(revision 6887)
@@ -60,5 +60,5 @@
 import org.openstreetmap.josm.command.ChangeCommand;
 import org.openstreetmap.josm.command.Command;
-import org.openstreetmap.josm.command.ConflictAddCommand;
+import org.openstreetmap.josm.command.conflict.ConflictAddCommand;
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.osm.DataSet;
