Index: src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(revision 2287)
+++ src/org/openstreetmap/josm/actions/mapmode/SelectAction.java	(working copy)
@@ -349,6 +349,7 @@
      * cursor to movement.
      */
     @Override public void mousePressed(MouseEvent e) {
+        //Main.debug("mousePressed() 0" + " time: " + System.currentTimeMillis());
         if(!Main.map.mapView.isActiveLayerVisible())
             return;
         // request focus in order to enable the expected keyboard shortcuts
@@ -362,6 +363,7 @@
         boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
         boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK|InputEvent.ALT_GRAPH_MASK)) != 0;
         boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
+        //Main.debug("mousePressed() 1" + " time: " + System.currentTimeMillis());
 
         // We don't want to change to draw tool if the user tries to (de)select
         // stuff but accidentally clicks in an empty area when selection is empty
@@ -373,7 +375,9 @@
         didMove = false;
         initialMoveThresholdExceeded = false;
 
+        //Main.debug("mousePressed() 2" + " time: " + System.currentTimeMillis());
         Collection<OsmPrimitive> osmColl = getNearestCollectionVirtual(e.getPoint(), alt);
+        //Main.debug("mousePressed() 3" + " time: " + System.currentTimeMillis());
 
         if (ctrl && shift) {
             if (getCurrentDataSet().getSelected().isEmpty()) {
@@ -382,6 +386,7 @@
             mode = Mode.rotate;
             setCursor(ImageProvider.getCursor("rotate", null));
         } else if (!osmColl.isEmpty()) {
+            //Main.debug("mousePressed() 4" + " time: " + System.currentTimeMillis());
             // Don't replace the selection now if the user clicked on a
             // selected object (this would break moving of selected groups).
             // We'll do that later in mouseReleased if the user didn't try to
@@ -390,17 +395,20 @@
                     shift || getCurrentDataSet().getSelected().containsAll(osmColl),
                     ctrl, false, false);
             mode = Mode.move;
+            //Main.debug("mousePressed() 5" + " time: " + System.currentTimeMillis());
         } else {
             mode = Mode.select;
             oldCursor = Main.map.mapView.getCursor();
             selectionManager.register(Main.map.mapView);
             selectionManager.mousePressed(e);
         }
+        //Main.debug("mousePressed() 6" + " time: " + System.currentTimeMillis());
         if(mode != Mode.move || shift || ctrl)
         {
             virtualNode = null;
             virtualWays.clear();
         }
+        //Main.debug("mousePressed() 7 time: " + System.currentTimeMillis());
 
         updateStatusLine();
         // Mode.select redraws when selectPrims is called
@@ -411,12 +419,14 @@
         }
 
         mousePos = e.getPoint();
+        //Main.debug("mousePressed() e" + " time: " + System.currentTimeMillis());
     }
 
     /**
      * Restore the old mouse cursor.
      */
     @Override public void mouseReleased(MouseEvent e) {
+        //Main.debug("mouseReleasd() 0" + " time: " + System.currentTimeMillis());
         if(!Main.map.mapView.isActiveLayerVisible())
             return;
 
@@ -430,14 +440,18 @@
             }
         }
         restoreCursor();
+        //Main.debug("mouseReleasd() 1" + " time: " + System.currentTimeMillis());
 
         if (mode == Mode.move) {
+            //Main.debug("mouseReleasd() 1.1" + " time: " + System.currentTimeMillis());
             boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
             boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
             if (!didMove) {
+                //Main.debug("mouseReleasd() 1.2" + " time: " + System.currentTimeMillis());
                 selectPrims(
                         Main.map.mapView.getNearestCollection(e.getPoint()),
                         shift, ctrl, true, false);
+                //Main.debug("mouseReleasd() 1.3" + " time: " + System.currentTimeMillis());
 
                 // If the user double-clicked a node, change to draw mode
                 List<OsmPrimitive> sel = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected());
@@ -449,9 +463,12 @@
                             Main.map.selectDrawTool(true);
                         }
                     });
+                    //Main.debug("mouseReleasd() 1.4" + " time: " + System.currentTimeMillis());
                     return;
                 }
+                //Main.debug("mouseReleasd() 1.5" + " time: " + System.currentTimeMillis());
             } else {
+        //Main.debug("mouseReleasd() 2" + " time: " + System.currentTimeMillis());
                 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
                 Collection<OsmPrimitive> s = new TreeSet<OsmPrimitive>();
                 int max = Main.pref.getInteger("warn.move.maxelements", 20);
@@ -484,6 +501,7 @@
                         }
                         break;
                     }
+        //Main.debug("mouseReleasd() 3" + " time: " + System.currentTimeMillis());
                 }
                 if (ctrl) {
                     Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection);
@@ -499,7 +517,9 @@
                         }
                     }
                 }
+                //Main.debug("mouseReleasd() 4" + " time: " + System.currentTimeMillis());
                 DataSet.fireSelectionChanged(selection);
+                //Main.debug("mouseReleasd() 5" + " time: " + System.currentTimeMillis());
             }
         }
 
@@ -507,6 +527,7 @@
         //updateStatusLine();
         mode = null;
         updateStatusLine();
+        //Main.debug("mouseReleasd() end" + " time: " + System.currentTimeMillis());
     }
 
     public void selectionEnded(Rectangle r, boolean alt, boolean shift, boolean ctrl) {
@@ -518,12 +539,16 @@
         if ((shift && ctrl) || (ctrl && !released))
             return; // not allowed together
 
+        //Main.debug("selectPrims() 0 time: " + System.currentTimeMillis());
         Collection<OsmPrimitive> curSel;
         if (!ctrl && !shift) {
+            //Main.debug("selectPrims() 1 time: " + System.currentTimeMillis());
             curSel = new LinkedList<OsmPrimitive>(); // new selection will replace the old.
         } else {
+            //Main.debug("selectPrims() 2 time: " + System.currentTimeMillis());
             curSel = getCurrentDataSet().getSelected();
         }
+        //Main.debug("selectPrims() 3 time: " + System.currentTimeMillis());
 
         for (OsmPrimitive osm : selectionList)
         {
@@ -538,8 +563,11 @@
                 curSel.add(osm);
             }
         }
+        //Main.debug("selectPrims() 4 time: " + System.currentTimeMillis());
         getCurrentDataSet().setSelected(curSel);
+        //Main.debug("selectPrims() 5 time: " + System.currentTimeMillis());
         Main.map.mapView.repaint();
+        //Main.debug("selectPrims() 6 time: " + System.currentTimeMillis());
     }
 
     @Override public String getModeHelpText() {
Index: src/org/openstreetmap/josm/actions/CombineWayAction.java
===================================================================
--- src/org/openstreetmap/josm/actions/CombineWayAction.java	(revision 2287)
+++ src/org/openstreetmap/josm/actions/CombineWayAction.java	(working copy)
@@ -210,6 +210,8 @@
         for (OsmPrimitive osm : selection)
             if (osm instanceof Way) {
                 numWays++;
+                if (numWays >= 2)
+                    break;
             }
         setEnabled(numWays >= 2);
     }
Index: src/org/openstreetmap/josm/gui/SelectionManager.java
===================================================================
--- src/org/openstreetmap/josm/gui/SelectionManager.java	(revision 2287)
+++ src/org/openstreetmap/josm/gui/SelectionManager.java	(working copy)
@@ -17,6 +17,8 @@
 
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.QuadBuckets;
 import org.openstreetmap.josm.data.osm.Way;
 
 /**
@@ -272,6 +274,7 @@
      */
     public Collection<OsmPrimitive> getObjectsInRectangle(Rectangle r, boolean alt) {
         Collection<OsmPrimitive> selection = new LinkedList<OsmPrimitive>();
+        DataSet ds = nc.getCurrentDataSet();
 
         // whether user only clicked, not dragged.
         boolean clicked = r.width <= 2 && r.height <= 2;
@@ -284,14 +287,15 @@
             }
         } else {
             // nodes
-            for (Node n : nc.getCurrentDataSet().nodes) {
+            for (Node n : ds.nodes) {
                 if (n.isUsable() && r.contains(nc.getPoint(n))) {
                     selection.add(n);
                 }
             }
 
             // ways
-            for (Way w : nc.getCurrentDataSet().ways) {
+            QuadBuckets<Way> qbw = ds.ways;
+            for (Way w : qbw) {
                 if (!w.isUsable() || w.getNodesCount() == 0){
                     continue;
                 }
Index: src/org/openstreetmap/josm/gui/NavigatableComponent.java
===================================================================
--- src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 2287)
+++ src/org/openstreetmap/josm/gui/NavigatableComponent.java	(working copy)
@@ -305,7 +305,9 @@
         DataSet ds = getCurrentDataSet();
         if(ds == null)
             return null;
-        for (Node n : ds.nodes) {
+        LatLon p1 = getLatLon(p.x+snapDistance, p.y+snapDistance);
+        LatLon p2 = getLatLon(p.x-snapDistance, p.y-snapDistance);
+        for (Node n : ds.nodes.search(p1, p2)) {
             if (!n.isUsable()) {
                 continue;
             }
@@ -322,6 +324,7 @@
                 minPrimitive = n;
             }
         }
+        //Main.debug("getNearestNode() done");
         return minPrimitive;
     }
 
@@ -336,7 +339,9 @@
         DataSet ds = getCurrentDataSet();
         if(ds == null)
             return null;
-        for (Way w : ds.ways) {
+        LatLon p1 = getLatLon(p.x+snapDistance, p.y+snapDistance);
+        LatLon p2 = getLatLon(p.x-snapDistance, p.y-snapDistance);
+        for (Way w : ds.ways.search(p1, p2)) {
             if (!w.isUsable()) {
                 continue;
             }
@@ -379,6 +384,7 @@
         for (List<WaySegment> wss : nearest.values()) {
             nearestList.addAll(wss);
         }
+        //Main.debug("getNearestWaySegments() done");
         return nearestList;
     }
 
Index: src/org/openstreetmap/josm/data/UndoRedoHandler.java
===================================================================
--- src/org/openstreetmap/josm/data/UndoRedoHandler.java	(revision 2287)
+++ src/org/openstreetmap/josm/data/UndoRedoHandler.java	(working copy)
@@ -8,6 +8,7 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
@@ -41,13 +42,22 @@
         redoCommands.clear();
     }
 
-    public void afterAdd() {
+    public void sendNotifications(Command c)
+    {
         if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
             OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
             data.fireDataChange();
         }
+        LinkedList<OsmPrimitive> modified = new LinkedList<OsmPrimitive>();
+        LinkedList<OsmPrimitive> deleted = new LinkedList<OsmPrimitive>();
+        LinkedList<OsmPrimitive> added = new LinkedList<OsmPrimitive>();
+        c.fillModifiedData(modified, deleted, added);
+        Main.main.getCurrentDataSet().notifyPrimitiveChange(modified);
         fireCommandsChanged();
+    }
 
+    public void afterAdd(Command c) {
+        sendNotifications(c);
         // the command may have changed the selection so tell the listeners about the current situation
         DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
     }
@@ -57,7 +67,7 @@
      */
     public void add(final Command c) {
         addNoRedraw(c);
-        afterAdd();
+        afterAdd(c);
     }
 
     /**
@@ -69,11 +79,7 @@
         final Command c = commands.removeLast();
         c.undoCommand();
         redoCommands.push(c);
-        if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
-            OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
-            data.fireDataChange();
-        }
-        fireCommandsChanged();
+        sendNotifications(c);
         Main.main.getCurrentDataSet().setSelected();
     }
 
@@ -87,11 +93,7 @@
         final Command c = redoCommands.pop();
         c.executeCommand();
         commands.add(c);
-        if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
-            OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
-            data.fireDataChange();
-        }
-        fireCommandsChanged();
+        sendNotifications(c);
     }
 
     public void fireCommandsChanged() {
Index: src/org/openstreetmap/josm/data/osm/QuadBuckets.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 2287)
+++ src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(working copy)
@@ -212,6 +212,29 @@
             return ret;
         }
     }
+    /*
+     * This is a quick hack.  The problem is that we need the
+     * way's bounding box a *bunch* of times when it gets
+     * inserted.  It gets expensive if we have to recreate
+     * them each time.
+     *
+     * An alternative would be to calculate it at .add() time
+     * and passing it down the call chain.
+     */
+    HashMap<Way,BBox> way_bbox_cache = new HashMap<Way, BBox>();
+    BBox way_bbox(Way w)
+    {
+        if (way_bbox_cache.size() > 100)
+            way_bbox_cache.clear();
+        BBox b = way_bbox_cache.get(w);
+        if (b == null) {
+            b = new BBox(w);
+            way_bbox_cache.put(w, b);
+        }
+        return b;
+        //return new BBox(w);
+    }
+
     class QBLevel
     {
         int level;
@@ -364,28 +387,6 @@
                 return;
             }
         }
-        /*
-         * This is a quick hack.  The problem is that we need the
-         * way's bounding box a *bunch* of times when it gets
-         * inserted.  It gets expensive if we have to recreate
-         * them each time.
-         *
-         * An alternative would be to calculate it at .add() time
-         * and passing it down the call chain.
-         */
-        HashMap<Way,BBox> way_bbox_cache = new HashMap<Way, BBox>();
-        BBox way_bbox(Way w)
-        {
-            if (way_bbox_cache.size() > 100)
-                way_bbox_cache.clear();
-            BBox b = way_bbox_cache.get(w);
-            if (b == null) {
-                b = new BBox(w);
-                way_bbox_cache.put(w, b);
-            }
-            return b;
-            //return new BBox(w);
-        }
 
         boolean matches(T o, BBox search_bbox)
         {
@@ -559,11 +560,11 @@
         }
         QBLevel find_exact(T n)
         {
-            if (isLeaf())
-                return find_exact_leaf(n);
+            if (hasContent())
+                return find_exact_content(n);
             return find_exact_branch(n);
         }
-        QBLevel find_exact_leaf(T n)
+        QBLevel find_exact_content(T n)
         {
             QBLevel ret = null;
             if (content != null && content.contains(n))
@@ -883,12 +884,38 @@
         check_type(o);
         return this.remove(convert(o));
     }
+    public boolean remove_slow(T removeme)
+    {
+        boolean ret = false;
+        Iterator<T> i = this.iterator();
+        while (i.hasNext()) {
+            T o = i.next();
+            if (o != removeme)
+                continue;
+            i.remove();
+            ret = true;
+            break;
+        }
+        out("qb slow remove result: " + ret);
+        return ret;
+    }
     public boolean remove(T n)
     {
+        /*
+         * We first try a locational search
+         */
         QBLevel bucket = root.find_exact(n);
+        if (n instanceof Way)
+            way_bbox_cache.remove(n);
+        /*
+         * That may fail because the object was
+         * moved or changed in some way, so we
+         * resort to an iterative search:
+         */
         if (bucket == null)
-            return false;
+            return remove_slow(n);
         boolean ret = bucket.remove_content(n);
+        out("qb remove result: " + ret);
         return ret;
     }
     public boolean contains(Object o)
@@ -1078,7 +1105,8 @@
             // search spot can not cover the current
             // search
             while (!search_cache.bbox().bounds(search_bbox)) {
-                out("bbox: " + search_bbox);
+                if (debug)
+                    out("bbox: " + search_bbox);
                 if (debug) {
                     out("search_cache: " + search_cache + " level: " + search_cache.level);
                     out("search_cache.bbox(): " + search_cache.bbox());
Index: src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 2287)
+++ src/org/openstreetmap/josm/data/osm/DataSet.java	(working copy)
@@ -6,8 +6,10 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.LinkedHashSet;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -16,6 +18,7 @@
 
 import org.openstreetmap.josm.data.SelectionChangedListener;
 import org.openstreetmap.josm.data.osm.QuadBuckets;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 
 /**
  * DataSet is the data behind the application. It can consists of only a few points up to the whole
@@ -142,11 +145,16 @@
         } else if (primitive instanceof Relation) {
             relations.remove(primitive);
         }
+        selectedPrimitives.remove(primitive);
     }
 
     public Collection<OsmPrimitive> getSelectedNodesAndWays() {
-        Collection<OsmPrimitive> sel = getSelected(nodes);
-        sel.addAll(getSelected(ways));
+        Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>();
+        for (OsmPrimitive osm : selectedPrimitives) {
+            if (osm instanceof Way ||
+                osm instanceof Node)
+                sel.add(osm);
+        }
         return sel;
     }
 
@@ -156,10 +164,11 @@
      * @return List of all selected objects.
      */
     public Collection<OsmPrimitive> getSelected() {
-        Collection<OsmPrimitive> sel = getSelected(nodes);
-        sel.addAll(getSelected(ways));
-        sel.addAll(getSelected(relations));
-        return sel;
+        // It would be nice to have this be a copy-on-write list
+        // or an Collections.unmodifiableList().  It would be
+        // much faster for large selections.  May users just
+        // call this, and only check the .size().
+        return new ArrayList<OsmPrimitive>(selectedPrimitives);
     }
 
     /**
@@ -215,17 +224,15 @@
         }
     }
 
-    public boolean addSelected(OsmPrimitive osm) {
-        osm.setSelected(true);
-        return true;
-    }
+    LinkedHashSet<OsmPrimitive> selectedPrimitives = new LinkedHashSet<OsmPrimitive>();
 
     public boolean toggleSelected(OsmPrimitive osm) {
-        osm.setSelected(!osm.isSelected());
+        if (!selectedPrimitives.remove(osm))
+            selectedPrimitives.add(osm);
         return true;
     }
     public boolean isSelected(OsmPrimitive osm) {
-        return osm.isSelected();
+        return selectedPrimitives.contains(osm);
     }
 
     public void setDisabled(OsmPrimitive... osm) {
@@ -250,12 +257,7 @@
      * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise
      */
     public void setSelected(Collection<? extends OsmPrimitive> selection, boolean fireSelectionChangeEvent) {
-        clearSelection(nodes);
-        clearSelection(ways);
-        clearSelection(relations);
-        for (OsmPrimitive osm : selection) {
-            osm.setSelected(true);
-        }
+        selectedPrimitives = new LinkedHashSet<OsmPrimitive>(selection);
         if (fireSelectionChangeEvent) {
             fireSelectionChanged(selection);
         }
@@ -289,9 +291,7 @@
      * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise
      */
     public void addSelected(Collection<? extends OsmPrimitive> selection, boolean fireSelectionChangeEvent) {
-        for (OsmPrimitive osm : selection) {
-            osm.setSelected(true);
-        }
+        selectedPrimitives.addAll(selection);
         if (fireSelectionChangeEvent) {
             fireSelectionChanged(selection);
         }
@@ -303,14 +303,9 @@
             setSelected();
             return;
         }
-        clearSelection(nodes);
-        clearSelection(ways);
-        clearSelection(relations);
-        for (OsmPrimitive o : osm)
-            if (o != null) {
-                o.setSelected(true);
-            }
-        fireSelectionChanged(Arrays.asList(osm));
+        List<OsmPrimitive> list = Arrays.asList(osm);
+        setSelected(list);
+        fireSelectionChanged(list);
     }
 
     /**
@@ -346,9 +341,7 @@
     private void clearSelection(Collection<? extends OsmPrimitive> list) {
         if (list == null)
             return;
-        for (OsmPrimitive osm : list) {
-            osm.setSelected(false);
-        }
+        selectedPrimitives.removeAll(list);
     }
 
     /**
@@ -356,13 +349,13 @@
      * @param list The collection from which the selected items are returned.
      */
     private Collection<OsmPrimitive> getSelected(Collection<? extends OsmPrimitive> list) {
-        Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>();
         if (list == null)
-            return sel;
-        for (OsmPrimitive osm : list)
-            if (osm.isSelected() && !osm.isDeleted()) {
-                sel.add(osm);
-            }
+            return new LinkedList<OsmPrimitive>();
+        // getSelected() is called with large lists, so
+        // creating the return list from the selection
+        // should be faster most of the time.
+        Collection<OsmPrimitive> sel = new LinkedHashSet<OsmPrimitive>(selectedPrimitives);
+        sel.retainAll(list);
         return sel;
     }
 
@@ -603,4 +596,62 @@
         }
         return ret;
     }
+
+    List<Way> waysUsingNode(Node n)
+    {
+        List<Way> possible_ways = ways.search(n.getCoor(), 0.0);
+        List<Way> result = new ArrayList<Way>();
+        for (Way w : possible_ways) {
+            if (!w.containsNode(n))
+                continue;
+            result.add(w);
+        }
+        return result;
+    }
+
+    void reIndex(Way w)
+    {
+        ways.remove(w);
+        ways.add(w);
+    }
+
+    void reIndex(Node n)
+    {
+        nodes.remove(n);
+        nodes.add(n);
+    }
+
+    void reIndexPrimitives(Collection<OsmPrimitive> modified)
+    {
+        for (OsmPrimitive o : modified) {
+            if (o instanceof Way)
+                reIndex((Way)o);
+            if (o instanceof Node)
+                reIndex((Node)o);
+        }
+    }
+
+    /*
+     * When nodes and ways get modified, their spatial properites may
+     * change.  This means that their locations in the spatially-indexed
+     * QuadBuckets structures may change.  When this happens, delete
+     * and reinsert them.
+     */
+    public void notifyPrimitiveChange(Collection<OsmPrimitive> modified)
+    {
+        /*
+         * Make sure to reindex all the ways first.  This will
+         * make sure that waysUsingNode() can find the ways
+         * if they got changed.
+         */
+        reIndexPrimitives(modified);
+        HashSet<OsmPrimitive> waysTouchedByNodes = new HashSet<OsmPrimitive>();
+        for (OsmPrimitive o : modified) {
+            if (!(o instanceof Node))
+                continue;
+            Node n = (Node)o;
+            modified.addAll(waysUsingNode(n));
+        }
+        reIndexPrimitives(waysTouchedByNodes);
+    }
 }
Index: src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 2287)
+++ src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(working copy)
@@ -42,9 +42,8 @@
     private static final int FLAG_DISABLED = 1 << 2;
     private static final int FLAG_DELETED  = 1 << 3;
     private static final int FLAG_FILTERED = 1 << 4;
-    private static final int FLAG_SELECTED = 1 << 5;
-    private static final int FLAG_HAS_DIRECTIONS = 1 << 6;
-    private static final int FLAG_TAGGED = 1 << 7;
+    private static final int FLAG_HAS_DIRECTIONS = 1 << 5;
+    private static final int FLAG_TAGGED = 1 << 6;
 
     /**
      * Replies the sub-collection of {@see OsmPrimitive}s of type <code>type</code> present in
@@ -184,7 +183,7 @@
     /**
      * Sets whether this primitive is disabled or not.
      *
-     * @param selected  true, if this primitive is disabled; false, otherwise
+     * @param disabled true, if this primitive is disabled; false, otherwise
      */
     public void setDisabled(boolean disabled) {
         if (disabled) {
@@ -206,7 +205,7 @@
     /**
      * Sets whether this primitive is filtered out or not.
      *
-     * @param selected  true, if this primitive is filtered out; false, otherwise
+     * @param filtered true, if this primitive is filtered out; false, otherwise
      */
     public void setFiltered(boolean filtered) {
         if (filtered) {
@@ -225,29 +224,6 @@
     }
 
     /**
-     * Sets whether this primitive is selected or not.
-     *
-     * @param selected  true, if this primitive is selected; false, otherwise
-     * @since 1899
-     */
-    @Deprecated public void setSelected(boolean selected) {
-        if (selected) {
-            flags |= FLAG_SELECTED;
-        } else {
-            flags &= ~FLAG_SELECTED;
-        }
-    }
-    /**
-     * Replies true, if this primitive is selected.
-     *
-     * @return true, if this primitive is selected
-     * @since 1899
-     */
-    @Deprecated public boolean isSelected() {
-        return (flags & FLAG_SELECTED) != 0;
-    }
-
-    /**
      * Marks this primitive as being modified.
      *
      * @param modified true, if this primitive is to be modified
@@ -470,7 +446,7 @@
     /**
      * Sets whether this primitive is deleted or not.
      *
-     * Also marks this primitive as modified if deleted is true and sets selected to false.
+     * Also marks this primitive as modified if deleted is true.
      *
      * @param deleted  true, if this primitive is deleted; false, otherwise
      */
@@ -481,7 +457,6 @@
             flags &= ~FLAG_DELETED;
         }
         setModified(deleted);
-        setSelected(false);
     }
 
     /**
