Index: /trunk/src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 2395)
+++ /trunk/src/org/openstreetmap/josm/actions/UploadAction.java	(revision 2396)
@@ -229,7 +229,7 @@
         String lbl = "";
         switch(primitiveType) {
-            case NODE: lbl =  tr("Synchronize node {0} only", id); break;
-            case WAY: lbl =  tr("Synchronize way {0} only", id); break;
-            case RELATION: lbl =  tr("Synchronize relation {0} only", id); break;
+        case NODE: lbl =  tr("Synchronize node {0} only", id); break;
+        case WAY: lbl =  tr("Synchronize way {0} only", id); break;
+        case RELATION: lbl =  tr("Synchronize relation {0} only", id); break;
         }
         ButtonSpec[] spec = new ButtonSpec[] {
@@ -275,7 +275,7 @@
         );
         switch(ret) {
-            case 0: synchronizePrimitive(primitiveType, id); break;
-            case 1: synchronizeDataSet(); break;
-            default: return;
+        case 0: synchronizePrimitive(primitiveType, id); break;
+        case 1: synchronizeDataSet(); break;
+        default: return;
         }
     }
@@ -635,5 +635,5 @@
                     try {
                         getProgressMonitor().subTask(tr("Uploading {0} objects ...", toUpload.size()));
-                        writer.uploadOsm(layer.data.version, toUpload, changeset, getProgressMonitor().createSubTaskMonitor(1, false));
+                        writer.uploadOsm(layer.data.getVersion(), toUpload, changeset, getProgressMonitor().createSubTaskMonitor(1, false));
                         processedPrimitives.addAll(writer.getProcessedPrimitives());
                         // if we get here we've successfully uploaded the data. Exit the loop.
Index: /trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2395)
+++ /trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2396)
@@ -52,14 +52,35 @@
      * The API version that created this data set, if any.
      */
-    public String version;
+    private String version;
+
+    /**
+     * Replies the API version this dataset was created from. May be null.
+     * 
+     * @return the API version this dataset was created from. May be null.
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets the API version this dataset was created from.
+     * 
+     * @param version the API version, i.e. "0.5" or "0.6"
+     */
+    public void setVersion(String version) {
+        this.version = version;
+    }
 
     /**
      * All nodes goes here, even when included in other data (ways etc). This enables the instant
      * conversion of the whole DataSet by iterating over this data structure.
-     * @deprecated Use getNodes() for read-only operations, addPrimitive() and removePrimitive() for modifications
-     */
-    @Deprecated
-    public QuadBuckets<Node> nodes = new QuadBuckets<Node>();
-
+     */
+    private QuadBuckets<Node> nodes = new QuadBuckets<Node>();
+
+    /**
+     * Replies an unmodifiable collection of nodes in this dataset
+     * 
+     * @return an unmodifiable collection of nodes in this dataset
+     */
     public Collection<Node> getNodes() {
         return Collections.unmodifiableCollection(nodes);
@@ -74,9 +95,12 @@
      *
      * The way nodes are stored only in the way list.
-     * @deprecated Use getWays() for read-only operations, addPrimitive() and removePrimitive() for modifications
-     */
-    @Deprecated
-    public QuadBuckets<Way> ways = new QuadBuckets<Way>();
-
+     */
+    private QuadBuckets<Way> ways = new QuadBuckets<Way>();
+
+    /**
+     * Replies an unmodifiable collection of ways in this dataset
+     * 
+     * @return an unmodifiable collection of ways in this dataset
+     */
     public Collection<Way> getWays() {
         return Collections.unmodifiableCollection(ways);
@@ -89,9 +113,12 @@
     /**
      * All relations/relationships
-     * @deprecated Use getRelations() for read-only operations, addPrimitive() and removePrimitive() for modifications
-     */
-    @Deprecated
-    public Collection<Relation> relations = new LinkedList<Relation>();
-
+     */
+    private Collection<Relation> relations = new LinkedList<Relation>();
+
+    /**
+     * Replies an unmodifiable collection of relations in this dataset
+     * 
+     * @return an unmodifiable collection of relations in this dataset
+     */
     public Collection<Relation> getRelations() {
         return Collections.unmodifiableCollection(relations);
@@ -703,3 +730,18 @@
         }
     }
+
+    /**
+     * Removes all primitives from the dataset and resets the currently selected primitives
+     * to the empty collection. Also notifies selection change listeners if necessary.
+     * 
+     */
+    public void clear() {
+        if (!selectedPrimitives.isEmpty()) {
+            selectedPrimitives.clear();
+            fireSelectionChanged();
+        }
+        nodes.clear();
+        ways.clear();
+        relations.clear();
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java	(revision 2395)
+++ /trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java	(revision 2396)
@@ -10,5 +10,4 @@
 import org.openstreetmap.josm.data.APIDataSet;
 import org.openstreetmap.josm.data.osm.Changeset;
-import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
@@ -121,5 +120,5 @@
                     ProgressMonitor m = monitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
                     if (isCancelled()) return;
-                    writer.uploadOsm(layer.data.version, toUpload, changeset, m);
+                    writer.uploadOsm(layer.data.getVersion(), toUpload, changeset, m);
                     processedPrimitives.addAll(writer.getProcessedPrimitives());
                     break;
Index: /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 2395)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java	(revision 2396)
@@ -256,6 +256,6 @@
         tool += trn("{0} way", "{0} ways", ways, ways);
 
-        if (data.version != null) {
-            tool += ", " + tr("version {0}", data.version);
+        if (data.getVersion() != null) {
+            tool += ", " + tr("version {0}", data.getVersion());
         }
         File f = getAssociatedFile();
@@ -292,9 +292,9 @@
 
         // copy the merged layer's API version, downgrade if required
-        if (data.version == null) {
-            data.version = from.version;
-        } else if ("0.5".equals(data.version) ^ "0.5".equals(from.version)) {
+        if (data.getVersion() == null) {
+            data.setVersion(from.getVersion());
+        } else if ("0.5".equals(data.getVersion()) ^ "0.5".equals(from.getVersion())) {
             System.err.println(tr("Warning: mixing 0.6 and 0.5 data results in version 0.5"));
-            data.version = "0.5";
+            data.setVersion("0.5");
         }
 
@@ -522,5 +522,5 @@
         p.add(new JLabel(wayText, ImageProvider.get("data", "way"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
         p.add(new JLabel(relationText, ImageProvider.get("data", "relation"), JLabel.HORIZONTAL), GBC.eop().insets(15,0,0,0));
-        p.add(new JLabel(tr("API version: {0}", (data.version != null) ? data.version : tr("unset"))));
+        p.add(new JLabel(tr("API version: {0}", (data.getVersion() != null) ? data.getVersion() : tr("unset"))));
 
         return p;
Index: /trunk/src/org/openstreetmap/josm/io/OsmExporter.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmExporter.java	(revision 2395)
+++ /trunk/src/org/openstreetmap/josm/io/OsmExporter.java	(revision 2396)
@@ -66,5 +66,5 @@
             Writer writer = new OutputStreamWriter(out, "UTF-8");
 
-            OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data.version);
+            OsmWriter w = new OsmWriter(new PrintWriter(writer), false, layer.data.getVersion());
             w.header();
             w.writeDataSources(layer.data);
Index: /trunk/src/org/openstreetmap/josm/io/OsmReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 2395)
+++ /trunk/src/org/openstreetmap/josm/io/OsmReader.java	(revision 2396)
@@ -184,5 +184,5 @@
                 // save generator attribute for later use when creating DataSource objects
                 generator = atts.getValue("generator");
-                ds.version = v;
+                ds.setVersion(v);
 
             } else if (qName.equals("bounds")) {
@@ -348,5 +348,5 @@
                     throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.id), version));
                 }
-                if (ds.version.equals("0.6")){
+                if (ds.getVersion().equals("0.6")){
                     if (current.version <= 0 && current.id > 0) {
                         throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.id), version));
@@ -355,5 +355,5 @@
                         current.version = 0;
                     }
-                } else if (ds.version.equals("0.5")) {
+                } else if (ds.getVersion().equals("0.5")) {
                     if (current.version <= 0 && current.id > 0) {
                         System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 1, "0.5"));
@@ -365,16 +365,16 @@
                 } else {
                     // should not happen. API version has been checked before
-                    throwException(tr("Unknown or unsupported API version. Got {0}.", ds.version));
+                    throwException(tr("Unknown or unsupported API version. Got {0}.", ds.getVersion()));
                 }
             } else {
                 // version expected for OSM primitives with an id assigned by the server (id > 0), since API 0.6
                 //
-                if (current.id > 0 && ds.version != null && ds.version.equals("0.6")) {
+                if (current.id > 0 && ds.getVersion() != null && ds.getVersion().equals("0.6")) {
                     throwException(tr("Missing attribute ''version'' on OSM primitive with ID {0}.", Long.toString(current.id)));
-                } else if (current.id > 0 && ds.version != null && ds.version.equals("0.5")) {
+                } else if (current.id > 0 && ds.getVersion() != null && ds.getVersion().equals("0.5")) {
                     // default version in 0.5 files for existing primitives
                     System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 1, "0.5"));
                     current.version= 1;
-                } else if (current.id <= 0 && ds.version != null && ds.version.equals("0.5")) {
+                } else if (current.id <= 0 && ds.getVersion() != null && ds.getVersion().equals("0.5")) {
                     // default version in 0.5 files for new primitives
                     System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.id, current.version, 0, "0.5"));
Index: /trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 2395)
+++ /trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java	(revision 2396)
@@ -45,5 +45,5 @@
     protected static DataSet buildTestDataSet() {
         DataSet ds = new DataSet();
-        ds.version = "0.6";
+        ds.setVersion("0.6");
 
         int numNodes = 1000;
@@ -215,5 +215,5 @@
         }
         logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
-        OsmWriter w = new OsmWriter(pw, false, testDataSet.version);
+        OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion());
         w.header();
         w.writeDataSources(testDataSet);
Index: /trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java
===================================================================
--- /trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 2395)
+++ /trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java	(revision 2396)
@@ -109,5 +109,5 @@
     protected static DataSet buildTestDataSet() {
         DataSet ds = new DataSet();
-        ds.version = "0.6";
+        ds.setVersion("0.6");
 
         populateTestDataSetWithNodes(ds);
@@ -221,5 +221,5 @@
         }
         logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
-        OsmWriter w = new OsmWriter(pw, false, testDataSet.version);
+        OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion());
         w.header();
         w.writeDataSources(testDataSet);
Index: /trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java
===================================================================
--- /trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java	(revision 2395)
+++ /trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeVisitorTest.java	(revision 2396)
@@ -79,5 +79,5 @@
     public void nodeSimple_IdenticalNoConflict() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(0,0));
         n.setOsmId(1,1);
@@ -87,5 +87,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(1,1);
@@ -114,5 +114,5 @@
     public void nodeSimple_locallyUnmodifiedNoConflict() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(0,0));
         n.setOsmId(1,1);
@@ -122,5 +122,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(1,2);
@@ -153,5 +153,5 @@
     public void nodeSimple_TagConflict() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(0,0));
         n.setOsmId(1,1);
@@ -162,5 +162,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(1,2);
@@ -189,5 +189,5 @@
     public void nodeSimple_DeleteConflict() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(1);
         n.setCoor(new LatLon(0,0));
@@ -198,5 +198,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(1,1);
@@ -223,5 +223,5 @@
     public void nodeSimple_VisibleConflict() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(0,0));
         n.setOsmId(1,1);
@@ -231,5 +231,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(1,2);
@@ -256,5 +256,5 @@
     public void nodeSimple_DeleteConflict_2() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(0,0));
         n.setOsmId(1,1);
@@ -263,5 +263,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(1,1);
@@ -286,5 +286,5 @@
     public void nodeSimple_DeleteConflict_3() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(1,1));
         n.setDeleted(true);
@@ -292,5 +292,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(1,1));
         their.addPrimitive(n1);
@@ -312,5 +312,5 @@
     public void nodeSimple_DeleteConflict_4() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(1,1));
         n.setDeleted(true);
@@ -318,5 +318,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(1,1));
         n1.setDeleted(true);
@@ -338,5 +338,5 @@
     public void nodeSimple_InvisibleNodeInTheirDataset() {
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node(new LatLon(0,0));
         n.setOsmId(1,1);
@@ -345,5 +345,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node(new LatLon(0,0));
         n1.setOsmId(2,1);
@@ -377,5 +377,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node();
         n.setCoor(new LatLon(0,0));
@@ -387,5 +387,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node();
         n1.setCoor(new LatLon(0,0));
@@ -418,5 +418,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
         Node n = new Node();
         n.setCoor(new LatLon(0,0));
@@ -426,5 +426,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
         Node n1 = new Node();
         n1.setCoor(new LatLon(0,0));
@@ -458,5 +458,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node();
@@ -480,5 +480,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -525,5 +525,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -542,5 +542,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -593,5 +593,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -613,5 +613,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -664,5 +664,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -681,5 +681,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Way theirWay = new Way();
@@ -710,5 +710,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -726,5 +726,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -763,5 +763,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -777,5 +777,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -815,5 +815,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -823,5 +823,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -871,5 +871,5 @@
 
         DataSet my = new DataSet();
-        my.version = "0.6";
+        my.setVersion("0.6");
 
         Node n1 = new Node(new LatLon(0,0));
@@ -879,5 +879,5 @@
 
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n3 = new Node(new LatLon(0,0));
@@ -922,5 +922,5 @@
     public void newIncompleteWay() {
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n1 = new Node(1);
@@ -936,5 +936,5 @@
 
         DataSet my = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         MergeVisitor visitor = new MergeVisitor(my,their);
@@ -969,5 +969,5 @@
     public void incompleteWayOntoCompleteWay() {
         DataSet their = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         // an incomplete node
@@ -986,5 +986,5 @@
 
         DataSet my = new DataSet();
-        their.version = "0.6";
+        their.setVersion("0.6");
 
         Node n4 = new Node(new LatLon(0,0));
