Index: applications/editors/josm/plugins/validator/build.xml
===================================================================
--- applications/editors/josm/plugins/validator/build.xml	(revision 16628)
+++ applications/editors/josm/plugins/validator/build.xml	(revision 16629)
@@ -26,5 +26,5 @@
                 <attribute name="Plugin-Description" value="An OSM data validator. It checks for problems in data, and provides fixes for the common ones. Spellcheck integrated for tag names."/>
                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/Validator"/>
-                <attribute name="Plugin-Mainversion" value="1755"/>
+                <attribute name="Plugin-Mainversion" value="1815"/>
                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
             </manifest>
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/GridLayer.java	(revision 16629)
@@ -1,5 +1,8 @@
 package org.openstreetmap.josm.plugins.validator;
 
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Point;
 import java.awt.geom.Point2D;
 
@@ -11,7 +14,10 @@
 import org.openstreetmap.josm.actions.RenameLayerAction;
 import org.openstreetmap.josm.data.coor.EastNorth;
-import org.openstreetmap.josm.data.osm.*;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
-import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
@@ -65,5 +71,5 @@
         g.setColor(Color.RED.darker().darker());
         HighlightCellVisitor visitor = new HighlightCellVisitor(g, mv, gridWidth);
-        for(OsmPrimitive p : Main.ds.getSelected() )
+        for(OsmPrimitive p : Main.main.getCurrentDataSet().getSelected() )
             p.visit(visitor);
 
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateAction.java	(revision 16629)
@@ -37,5 +37,5 @@
      */
     public ValidateAction(OSMValidatorPlugin plugin) {
-        super(tr("Validation"), "validator", tr("Performs the data validation"), 
+        super(tr("Validation"), "validator", tr("Performs the data validation"),
         Shortcut.registerShortcut("tools:validate", tr("Tool: {0}", tr("Validation")), KeyEvent.VK_V, Shortcut.GROUP_EDIT, Shortcut.SHIFT_DEFAULT), true);
         this.plugin = plugin;
@@ -68,7 +68,7 @@
         Collection<OsmPrimitive> selection;
         if (getSelectedItems) {
-            selection = Main.ds.getSelected();
+            selection = Main.main.getCurrentDataSet().getSelected();
             if (selection.isEmpty()) {
-                selection = Main.ds.allNonDeletedPrimitives();
+                selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
                 lastSelection = null;
             } else {
@@ -79,5 +79,5 @@
         } else {
             if (lastSelection == null)
-                selection = Main.ds.allNonDeletedPrimitives();
+                selection = Main.main.getCurrentDataSet().allNonDeletedPrimitives();
             else
                 selection = lastSelection;
@@ -109,5 +109,5 @@
         plugin.validationDialog.tree.setErrors(errors);
         plugin.validationDialog.setVisible(true);
-        DataSet.fireSelectionChanged(Main.ds.getSelected());
+        DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
     }
 }
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidateUploadHook.java	(revision 16629)
@@ -120,5 +120,5 @@
             plugin.validationDialog.tree.setErrors(errors);
             plugin.validationDialog.setVisible(true);
-            DataSet.fireSelectionChanged(Main.ds.getSelected());
+            DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
         }
         return res == JOptionPane.YES_OPTION;
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/ValidatorDialog.java	(revision 16629)
@@ -42,5 +42,5 @@
  * respects clicks into the selection list. Ctrl-click will remove entries from
  * the list while single click will make the clicked entry the only selection.
- * 
+ *
  * @author frsantos
  */
@@ -127,5 +127,5 @@
     /**
      * Fix selected errors
-     * 
+     *
      * @param e
      */
@@ -163,10 +163,10 @@
         Main.map.repaint();
         tree.resetErrors();
-        DataSet.fireSelectionChanged(Main.ds.getSelected());
+        DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
     }
 
     /**
      * Set selected errors to ignore state
-     * 
+     *
      * @param e
      */
@@ -295,5 +295,5 @@
         }
 
-        Main.ds.setSelected(sel);
+        Main.main.getCurrentDataSet().setSelected(sel);
     }
 
@@ -313,5 +313,5 @@
      * Checks for fixes in selected element and, if needed, adds to the sel
      * parameter all selected elements
-     * 
+     *
      * @param sel
      *            The collection where to add all selected elements
@@ -381,5 +381,5 @@
 
             if (isDblClick) {
-                Main.ds.setSelected(sel);
+                Main.main.getCurrentDataSet().setSelected(sel);
             }
         }
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/ChangePropertyKeyCommand.java	(revision 16629)
@@ -14,10 +14,10 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
+import org.openstreetmap.josm.plugins.validator.util.NameVisitor;
 import org.openstreetmap.josm.tools.ImageProvider;
 
 /**
  * Command that replaces the key of several objects
- * 
+ *
  */
 public class ChangePropertyKeyCommand extends Command {
@@ -34,8 +34,8 @@
      */
     private final String newKey;
-    
+
     /**
      * Constructor
-     * 
+     *
      * @param objects all objects subject to change replacement
      * @param key The key to replace
@@ -47,9 +47,9 @@
         this.newKey = newKey;
     }
-    
+
     @Override public boolean executeCommand() {
         if (!super.executeCommand()) return false; // save old
         for (OsmPrimitive osm : objects) {
-            if(osm.keys != null) 
+            if(osm.keys != null)
             {
                 osm.modified = true;
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/DuplicateNode.java	(revision 16629)
@@ -3,10 +3,13 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.openstreetmap.josm.actions.MergeNodesAction;
-import org.openstreetmap.josm.command.*;
+import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.osm.*;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.plugins.validator.Severity;
 import org.openstreetmap.josm.plugins.validator.Test;
@@ -90,5 +93,5 @@
             target = nodes.iterator().next();
 
-        MergeNodesAction.mergeNodes(nodes, target);
+        new  MergeNodesAction().mergeNodes(nodes, target);
 
         return null; // undoRedo handling done in mergeNodes
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UnconnectedWays.java	(revision 16629)
@@ -6,13 +6,13 @@
 import java.awt.geom.Line2D;
 import java.util.Arrays;
-import java.util.Map;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmUtils;
 import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.plugins.validator.PreferenceEditor;
 import org.openstreetmap.josm.plugins.validator.Severity;
@@ -62,5 +62,5 @@
     public void endTest()
     {
-        Area a = Main.ds.getDataSourceArea();
+        Area a = Main.main.getCurrentDataSet().getDataSourceArea();
         Map<Node, Way> map = new HashMap<Node, Way>();
         for(Node en : endnodes_highway)
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedNode.java	(revision 16629)
@@ -3,5 +3,7 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 
-import java.util.*;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.openstreetmap.josm.Main;
@@ -9,6 +11,6 @@
 import org.openstreetmap.josm.command.DeleteCommand;
 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.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.plugins.validator.Severity;
 import org.openstreetmap.josm.plugins.validator.Test;
@@ -54,5 +56,5 @@
                 }
             }
-            for (Way w : Main.ds.ways) {
+            for (Way w : Main.main.getCurrentDataSet().ways) {
                 visit(w);
             }
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/tests/UntaggedWay.java	(revision 16629)
@@ -115,5 +115,5 @@
     {
         multipolygonways = new LinkedList<Way>();
-        for (final Relation r : Main.ds.relations)
+        for (final Relation r : Main.main.getCurrentDataSet().relations)
         {
             if(!r.deleted && !r.incomplete && r.keys != null
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java	(revision 16628)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/MultipleNameVisitor.java	(revision 16629)
@@ -10,5 +10,4 @@
 
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
 import org.openstreetmap.josm.tools.ImageProvider;
 
Index: applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/NameVisitor.java
===================================================================
--- applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/NameVisitor.java	(revision 16629)
+++ applications/editors/josm/plugins/validator/src/org/openstreetmap/josm/plugins/validator/util/NameVisitor.java	(revision 16629)
@@ -0,0 +1,83 @@
+// License: GPL. Copyright 2007 by Immanuel Scholz and others
+package org.openstreetmap.josm.plugins.validator.util;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
+
+import javax.swing.Icon;
+import javax.swing.JLabel;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Relation;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Able to create a name and an icon for each data element.
+ *
+ * @author imi
+ */
+//TODO This class used to be in JOSM but it was removed. MultipleNameVisitor depends on it so I copied it here, but MultipleNameVisitor should be refactored instead of using this class
+public class NameVisitor extends AbstractVisitor {
+
+    /**
+     * The name of the item class
+     */
+    public String className;
+    public String classNamePlural;
+    /**
+     * The name of this item.
+     */
+    public String name;
+    /**
+     * The icon of this item.
+     */
+    public Icon icon;
+
+    /**
+     * If the node has a name-key or id-key, this is displayed. If not, (lat,lon)
+     * is displayed.
+     */
+    public void visit(Node n) {
+        name = n.getName();
+        addId(n);
+        icon = ImageProvider.get("data", "node");
+        className = "node";
+        classNamePlural = trn("node", "nodes", 2);
+    }
+
+    /**
+     * If the way has a name-key or id-key, this is displayed. If not, (x nodes)
+     * is displayed with x being the number of nodes in the way.
+     */
+    public void visit(Way w) {
+        name = w.getName();
+        addId(w);
+        icon = ImageProvider.get("data", "way");
+        className = "way";
+        classNamePlural = trn("way", "ways", 2);
+    }
+
+    /**
+     */
+    public void visit(Relation e) {
+        name = e.getName();
+        addId(e);
+        icon = ImageProvider.get("data", "relation");
+        className = "relation";
+        classNamePlural = trn("relation", "relations", 2);
+    }
+
+    public JLabel toLabel() {
+        return new JLabel(name, icon, JLabel.HORIZONTAL);
+    }
+
+
+    private void addId(OsmPrimitive osm) {
+        if (Main.pref.getBoolean("osm-primitives.showid"))
+            name += tr(" [id: {0}]", osm.id);
+    }
+}
