Index: trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 3123)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 3124)
@@ -18,4 +18,6 @@
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -49,4 +51,5 @@
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.Way;
@@ -64,4 +67,5 @@
 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode;
 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
+import org.openstreetmap.josm.gui.DefaultNameFormatter;
 import org.openstreetmap.josm.gui.MapView;
 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
@@ -517,4 +521,5 @@
             }
             this.selection.addAll(selection);
+            sort();
             fireContentsChanged(this, 0, getSize());
             remember(selection);
@@ -566,4 +571,11 @@
         }
 
+        /**
+         * Sorts the current elements in the selection
+         */
+        public void sort() {
+            Collections.sort(this.selection, new OsmPrimitiveComparator());
+        }
+
         /* ------------------------------------------------------------------------ */
         /* interface EditLayerChangeListener                                        */
@@ -764,3 +776,48 @@
         }
     }
+
+    static private class OsmPrimitiveComparator implements Comparator<OsmPrimitive> {
+        final private HashMap<Object, String> cache= new HashMap<Object, String>();
+        final private DefaultNameFormatter df  = DefaultNameFormatter.getInstance();
+
+        private String cachedName(OsmPrimitive p) {
+            String name = cache.get(p);
+            if (name == null) {
+                name = p.getDisplayName(df);
+                cache.put(p, name);
+            }
+            return name;
+        }
+
+        private int compareName(OsmPrimitive a, OsmPrimitive b) {
+            String an = cachedName(a);
+            String bn = cachedName(b);
+            // make sure display names starting with digits are the end of the
+            // list
+            if (Character.isDigit(an.charAt(0)) && Character.isDigit(bn.charAt(0)))
+                return an.compareTo(bn);
+            else if (Character.isDigit(an.charAt(0)) && !Character.isDigit(bn.charAt(0)))
+                return 1;
+            else if (!Character.isDigit(an.charAt(0)) && Character.isDigit(bn.charAt(0)))
+                return -1;
+            return an.compareTo(bn);
+        }
+
+        private int compareType(OsmPrimitive a, OsmPrimitive b) {
+            // show ways before relations, then nodes
+            //
+            if (a.getType().equals(b.getType())) return 0;
+            if (a.getType().equals(OsmPrimitiveType.WAY)) return -1;
+            if (a.getType().equals(OsmPrimitiveType.NODE)) return 1;
+            // a is a relation
+            if (b.getType().equals(OsmPrimitiveType.WAY)) return 1;
+            // b is a node
+            return -1;
+        }
+        public int compare(OsmPrimitive a, OsmPrimitive b) {
+            if (a.getType().equals(b.getType()))
+                return compareName(a, b);
+            return compareType(a, b);
+        }
+    }
 }
