Index: trunk/src/org/openstreetmap/josm/actions/InfoAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/actions/InfoAction.java	(revision 12672)
@@ -36,5 +36,5 @@
         DataSet set = getLayerManager().getEditDataSet();
         if (set != null) {
-            new InspectPrimitiveDialog(set.getAllSelected(), getLayerManager().getEditLayer()).showDialog();
+            new InspectPrimitiveDialog(set.getAllSelected(), set).showDialog();
         }
     }
Index: trunk/src/org/openstreetmap/josm/command/PurgeCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/PurgeCommand.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/command/PurgeCommand.java	(revision 12672)
@@ -122,10 +122,8 @@
                 } else {
                     getAffectedDataSet().removePrimitive(osm);
-                    if (getLayer() != null) {
-                        Conflict<?> conflict = getLayer().getConflicts().getConflictForMy(osm);
-                        if (conflict != null) {
-                            purgedConflicts.add(conflict);
-                            getLayer().getConflicts().remove(conflict);
-                        }
+                    Conflict<?> conflict = getAffectedDataSet().getConflicts().getConflictForMy(osm);
+                    if (conflict != null) {
+                        purgedConflicts.add(conflict);
+                        getAffectedDataSet().getConflicts().remove(conflict);
                     }
                 }
@@ -157,5 +155,5 @@
 
         for (Conflict<?> conflict : purgedConflicts) {
-            getLayer().getConflicts().add(conflict);
+            getAffectedDataSet().getConflicts().add(conflict);
         }
     }
Index: trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java	(revision 12672)
@@ -13,4 +13,5 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -38,4 +39,15 @@
     }
 
+    /**
+     * Constructs a new {@code ConflictAddCommand}.
+     * @param ds the data set. Must not be null.
+     * @param conflict the conflict to add
+     * @since 12672
+     */
+    public ConflictAddCommand(DataSet ds, Conflict<? extends OsmPrimitive> conflict) {
+        super(ds);
+        this.conflict = conflict;
+    }
+
     protected void warnBecauseOfDoubleConflict() {
         JOptionPane.showMessageDialog(
@@ -55,5 +67,5 @@
     public boolean executeCommand() {
         try {
-            getLayer().getConflicts().add(conflict);
+            getAffectedDataSet().getConflicts().add(conflict);
         } catch (IllegalStateException e) {
             Logging.error(e);
@@ -72,5 +84,5 @@
             return;
         }
-        getLayer().getConflicts().remove(conflict);
+        getAffectedDataSet().getConflicts().remove(conflict);
     }
 
Index: trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/command/conflict/ConflictResolveCommand.java	(revision 12672)
@@ -9,4 +9,5 @@
 import org.openstreetmap.josm.data.conflict.Conflict;
 import org.openstreetmap.josm.data.conflict.ConflictCollection;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -59,8 +60,8 @@
      */
     protected void reconstituteConflicts() {
-        OsmDataLayer editLayer = getLayer();
+        DataSet ds = getAffectedDataSet();
         for (Conflict<?> c : resolvedConflicts) {
-            if (!editLayer.getConflicts().hasConflictForMy(c.getMy())) {
-                editLayer.getConflicts().add(c);
+            if (!ds.getConflicts().hasConflictForMy(c.getMy())) {
+                ds.getConflicts().add(c);
             }
         }
Index: trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommand.java	(revision 12672)
@@ -55,5 +55,5 @@
             conflict.getMy().setModified(conflict.getTheir().isModified());
         }
-        getLayer().getConflicts().remove(conflict);
+        getAffectedDataSet().getConflicts().remove(conflict);
         rememberConflict(conflict);
         return true;
Index: trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommand.java	(revision 12672)
@@ -11,4 +11,5 @@
 
 import org.openstreetmap.josm.data.conflict.Conflict;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -81,5 +82,5 @@
 
         MainApplication.getLayerManager().setActiveLayer(layer);
-        OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();
+        DataSet editDs = MainApplication.getLayerManager().getEditDataSet();
 
         // restore the former state
@@ -89,6 +90,6 @@
         // restore a conflict if necessary
         //
-        if (!editLayer.getConflicts().hasConflictForMy(conflict.getMy())) {
-            editLayer.getConflicts().add(conflict);
+        if (!editDs.getConflicts().hasConflictForMy(conflict.getMy())) {
+            editDs.getConflicts().add(conflict);
         }
     }
Index: trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommand.java	(revision 12672)
@@ -64,5 +64,5 @@
             }
         }
-        getLayer().getConflicts().remove(conflict);
+        getAffectedDataSet().getConflicts().remove(conflict);
         rememberConflict(conflict);
         return true;
Index: trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 12672)
@@ -30,4 +30,5 @@
 import org.openstreetmap.josm.data.ProjectionBounds;
 import org.openstreetmap.josm.data.SelectionChangedListener;
+import org.openstreetmap.josm.data.conflict.ConflictCollection;
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -196,4 +197,6 @@
     private final Collection<DataSource> dataSources = new LinkedList<>();
 
+    private final ConflictCollection conflicts = new ConflictCollection();
+
     /**
      * Constructs a new {@code DataSet}.
@@ -1347,4 +1350,14 @@
     }
 
+    /**
+     * Replies the set of conflicts currently managed in this layer.
+     *
+     * @return the set of conflicts currently managed in this layer
+     * @since 12672
+     */
+    public ConflictCollection getConflicts() {
+        return conflicts;
+    }
+
     /* --------------------------------------------------------------------------------- */
     /* interface ProjectionChangeListner                                                 */
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java	(revision 12672)
@@ -218,7 +218,7 @@
      */
     public void refreshView() {
-        OsmDataLayer editLayer = MainApplication.getLayerManager().getEditLayer();
+        DataSet editDs = MainApplication.getLayerManager().getEditDataSet();
         synchronized (this) {
-            conflicts = editLayer == null ? new ConflictCollection() : editLayer.getConflicts();
+            conflicts = editDs == null ? new ConflictCollection() : editDs.getConflicts();
         }
         GuiHelper.runInEDT(() -> {
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDataText.java	(revision 12672)
@@ -11,4 +11,5 @@
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.osm.BBox;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -16,5 +17,4 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.tools.Geometry;
 import org.openstreetmap.josm.tools.date.DateUtils;
@@ -29,8 +29,8 @@
 
     private final StringBuilder s = new StringBuilder();
-    private final OsmDataLayer layer;
-
-    InspectPrimitiveDataText(OsmDataLayer layer) {
-        this.layer = layer;
+    private final DataSet ds;
+
+    InspectPrimitiveDataText(DataSet ds) {
+        this.ds = ds;
     }
 
@@ -226,5 +226,5 @@
 
     void addConflicts(OsmPrimitive o) {
-        Conflict<?> c = layer.getConflicts().getConflictForMy(o);
+        Conflict<?> c = ds.getConflicts().getConflictForMy(o);
         if (c != null) {
             add(tr("In conflict with: "));
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java	(revision 12672)
@@ -22,4 +22,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -28,5 +29,4 @@
 import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.gui.NavigatableComponent;
-import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.mappaint.Cascade;
 import org.openstreetmap.josm.gui.mappaint.ElemStyles;
@@ -53,5 +53,4 @@
 
     protected transient List<OsmPrimitive> primitives;
-    protected transient OsmDataLayer layer;
     private boolean mappaintTabLoaded;
     private boolean editcountTabLoaded;
@@ -60,10 +59,10 @@
      * Constructs a new {@code InspectPrimitiveDialog}.
      * @param primitives collection of primitives
-     * @param layer data layer
+     * @param data data set
+     * @since 12672 (signature)
      */
-    public InspectPrimitiveDialog(final Collection<OsmPrimitive> primitives, OsmDataLayer layer) {
+    public InspectPrimitiveDialog(final Collection<OsmPrimitive> primitives, DataSet data) {
         super(Main.parent, tr("Advanced object info"), tr("Close"));
         this.primitives = new ArrayList<>(primitives);
-        this.layer = layer;
         setRememberWindowGeometry(getClass().getName() + ".geometry",
                 WindowGeometry.centerInWindow(Main.parent, new Dimension(750, 550)));
@@ -72,5 +71,5 @@
         final JTabbedPane tabs = new JTabbedPane();
 
-        tabs.addTab(tr("data"), genericMonospacePanel(new JPanel(), buildDataText(layer, this.primitives)));
+        tabs.addTab(tr("data"), genericMonospacePanel(new JPanel(), buildDataText(data, this.primitives)));
 
         final JPanel pMapPaint = new JPanel();
@@ -106,6 +105,6 @@
     }
 
-    protected static String buildDataText(OsmDataLayer layer, List<OsmPrimitive> primitives) {
-        InspectPrimitiveDataText dt = new InspectPrimitiveDataText(layer);
+    protected static String buildDataText(DataSet data, List<OsmPrimitive> primitives) {
+        InspectPrimitiveDataText dt = new InspectPrimitiveDataText(data);
         primitives.stream()
                 .sorted(OsmPrimitiveComparator.orderingWaysRelationsNodes().thenComparing(OsmPrimitiveComparator.comparingNames()))
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java	(revision 12672)
@@ -136,8 +136,9 @@
                 return;
             }
-            DataSetMerger visitor = new DataSetMerger(MainApplication.getLayerManager().getEditLayer().data, ds);
+            DataSet editData = MainApplication.getLayerManager().getEditDataSet();
+            DataSetMerger visitor = new DataSetMerger(editData, ds);
             visitor.merge();
             if (!visitor.getConflicts().isEmpty()) {
-                MainApplication.getLayerManager().getEditLayer().getConflicts().add(visitor.getConflicts());
+                editData.getConflicts().add(visitor.getConflicts());
             }
             final RelationTreeModel model = (RelationTreeModel) getModel();
Index: trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 12671)
+++ trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 12672)
@@ -351,9 +351,4 @@
 
     /**
-     * the collection of conflicts detected in this layer
-     */
-    private final ConflictCollection conflicts;
-
-    /**
      * a texture for non-downloaded area
      */
@@ -407,5 +402,4 @@
         this.data = data;
         this.setAssociatedFile(associatedFile);
-        conflicts = new ConflictCollection();
         data.addDataSetListener(new DataSetListenerAdapter(this));
         data.addDataSetListener(MultipolygonCache.getInstance());
@@ -567,7 +561,7 @@
         int numNewConflicts = 0;
         for (Conflict<?> c : visitor.getConflicts()) {
-            if (!conflicts.hasConflict(c)) {
+            if (!data.getConflicts().hasConflict(c)) {
                 numNewConflicts++;
-                conflicts.add(c);
+                data.getConflicts().add(c);
             }
         }
@@ -924,5 +918,5 @@
      */
     public ConflictCollection getConflicts() {
-        return conflicts;
+        return data.getConflicts();
     }
 
