Index: trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java	(revision 755)
@@ -88,5 +88,5 @@
 			Collection<OsmPrimitive> sel = Main.ds.getSelected();
 			SearchCompiler.Match matcher = SearchCompiler.compile(search, caseSensitive);
-			for (OsmPrimitive osm : Main.ds.allNonDeletedPhysicalPrimitives()) {
+			for (OsmPrimitive osm : Main.ds.allNonDeletedCompletePrimitives()) {
 				if (mode == SearchMode.replace) {
 					if (matcher.match(osm))
Index: trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
===================================================================
--- trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/command/DeleteCommand.java	(revision 755)
@@ -58,17 +58,24 @@
 		if (data.size() == 1) {
 			data.iterator().next().visit(v);
-			return new DefaultMutableTreeNode(new JLabel(tr("Delete")+" "+tr(v.className)+" "+v.name, v.icon, JLabel.HORIZONTAL));
+			return new DefaultMutableTreeNode(new JLabel(tr("Delete {1} {0}", v.name, tr(v.className)), v.icon, JLabel.HORIZONTAL));
 		}
 
 		String cname = null;
+		String cnamem = null;
 		for (OsmPrimitive osm : data) {
 			osm.visit(v);
 			if (cname == null)
+			{
 				cname = v.className;
+				cnamem = v.classNamePlural;
+			}
 			else if (!cname.equals(v.className))
+			{
 				cname = "object";
+				cnamem = trn("object", "objects", 2);
+			}
 		}
 		DefaultMutableTreeNode root = new DefaultMutableTreeNode(new JLabel(
-				tr("Delete")+" "+data.size()+" "+trn(cname, cname+"s", data.size()), ImageProvider.get("data", cname), JLabel.HORIZONTAL));
+				tr("Delete {0} {1}", data.size(), trn(cname, cnamem, data.size())), ImageProvider.get("data", cname), JLabel.HORIZONTAL));
 		for (OsmPrimitive osm : data) {
 			osm.visit(v);
Index: trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 755)
@@ -8,5 +8,7 @@
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -78,4 +80,12 @@
 		for (OsmPrimitive osm : allPrimitives())
 			if (!osm.deleted)
+				o.add(osm);
+		return o;
+	}
+
+	public Collection<OsmPrimitive> allNonDeletedCompletePrimitives() {
+		Collection<OsmPrimitive> o = new LinkedList<OsmPrimitive>();
+		for (OsmPrimitive osm : allPrimitives())
+			if (!osm.deleted && !osm.incomplete)
 				o.add(osm);
 		return o;
@@ -230,3 +240,35 @@
 		
 	}
+
+	// Search für Relation wieder erlauben.
+	public static OsmPrimitive[] sort(Collection<? extends OsmPrimitive> list) {
+		OsmPrimitive[] selArr = new OsmPrimitive[list.size()];
+		final HashMap<Object, String> h = new HashMap<Object, String>();
+		selArr = list.toArray(selArr);
+		Arrays.sort(selArr, new Comparator<OsmPrimitive>() {
+			public int compare(OsmPrimitive a, OsmPrimitive b)
+			{
+				if(a.getClass() == b.getClass())
+				{
+					String as = h.get(a);
+					if(as == null)
+					{
+						as = a.getName();
+						h.put(a, as);
+					}
+					String bs = h.get(b);
+					if(bs == null)
+					{
+						bs = b.getName();
+						h.put(b, bs);
+					}
+					int res = as.compareTo(bs);
+					if(res != 0)
+						return res;
+				}
+				return a.compareTo(b);
+			}
+		});
+		return selArr;
+	}
 }
Index: trunk/src/org/openstreetmap/josm/data/osm/Node.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/data/osm/Node.java	(revision 755)
@@ -1,4 +1,10 @@
 // License: GPL. Copyright 2007 by Immanuel Scholz and others
 package org.openstreetmap.josm.data.osm;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
 
 import org.openstreetmap.josm.Main;
@@ -67,4 +73,19 @@
 	public int compareTo(OsmPrimitive o) {
 	    return o instanceof Node ? Long.valueOf(id).compareTo(o.id) : 1;
-    }
+	}
+
+	public String getName() {
+		String name;
+		if (incomplete) {
+			name = tr("incomplete");
+		} else {
+			NumberFormat latLonFormat = new DecimalFormat("###0.0000000");
+
+			name = get("name");
+			if (name == null)
+				name = id == 0 ? "" : ""+id;
+			name += " ("+latLonFormat.format(coor.lat())+", "+latLonFormat.format(coor.lon())+")";
+		}
+		return name;
+	}
 }
Index: trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java	(revision 755)
@@ -217,4 +217,8 @@
 		checkTagged();
                 checkDirectionTagged();
+	}
+
+	public String getName() {
+		return null;
 	}
 
Index: trunk/src/org/openstreetmap/josm/data/osm/Relation.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/data/osm/Relation.java	(revision 755)
@@ -1,3 +1,6 @@
 package org.openstreetmap.josm.data.osm;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
 
 import java.util.ArrayList;
@@ -66,6 +69,26 @@
 	public int compareTo(OsmPrimitive o) {
 	    return o instanceof Relation ? Long.valueOf(id).compareTo(o.id) : -1;
-    }
-	
+	}
+
+	public String getName() {
+		String name;
+		if (incomplete) {
+			name = tr("incomplete");
+		} else {
+			name = get("type");
+			// FIXME add names of members
+			if (name == null)
+				name = tr("relation");
+			
+			name += " (";
+			String nameTag = get("name");
+			if (nameTag == null) nameTag = get("ref");
+			if (nameTag != null) name += "\"" + nameTag + "\", ";
+			int mbno = members.size();
+			name += trn("{0} member", "{0} members", mbno, mbno) + ")";
+		}
+		return name;
+	}
+
 	public boolean isIncomplete() {
 		for (RelationMember m : members)
Index: trunk/src/org/openstreetmap/josm/data/osm/Way.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/data/osm/Way.java	(revision 755)
@@ -1,4 +1,9 @@
 // License: GPL. Copyright 2007 by Immanuel Scholz and others
 package org.openstreetmap.josm.data.osm;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+import static org.openstreetmap.josm.tools.I18n.trn;
+
+import java.util.HashSet;
 
 import java.util.ArrayList;
@@ -87,6 +92,29 @@
 
 	public int compareTo(OsmPrimitive o) {
-	    return o instanceof Way ? Long.valueOf(id).compareTo(o.id) : -1;
-    }
+		if(o instanceof Relation)
+			return 1;
+		return o instanceof Way ? Long.valueOf(id).compareTo(o.id) : -1;
+	}
+
+	public String getName() {
+		String name;
+		if (incomplete) {
+			name = tr("incomplete");
+		} else {
+			name = get("name");
+			if (name == null) name = get("ref");
+			if (name == null) {
+				name = 
+					(get("highway") != null) ? tr("highway") :
+					(get("railway") != null) ? tr("railway") :
+					(get("waterway") != null) ? tr("waterway") :
+					(get("landuse") != null) ? tr("landuse") : "";
+			}
+
+			int nodesNo = new HashSet<Node>(nodes).size();
+			name += trn(" ({0} node)", " ({0} nodes)", nodesNo, nodesNo);
+		}
+		return name;
+	}
 
 	@Deprecated
Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java	(revision 755)
@@ -4,8 +4,4 @@
 import static org.openstreetmap.josm.tools.I18n.tr;
 import static org.openstreetmap.josm.tools.I18n.trn;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.HashSet;
 
 import javax.swing.Icon;
@@ -30,4 +26,5 @@
 	 */
 	public String className;
+	public String classNamePlural;
 	/**
 	 * The name of this item.
@@ -39,9 +36,4 @@
 	public Icon icon;
 	
-	/** 
-	 * For formatting lat/lon
-	 */
-	public static NumberFormat latLonFormat = new DecimalFormat("###0.0000000");
-	
 	/**
 	 * If the node has a name-key or id-key, this is displayed. If not, (lat,lon)
@@ -49,17 +41,9 @@
 	 */
 	public void visit(Node n) {
-		if (n.incomplete) {
-			name = tr("incomplete");
-		} else {
-			name = n.get("name");
-			if (name == null) {
-				name = n.id == 0 ? "" : ""+n.id;
-			}
-			name += " ("+latLonFormat.format(n.coor.lat())+", "+latLonFormat.format(n.coor.lon())+")";
-		}
+		name = n.getName();
 		addId(n);
 		icon = ImageProvider.get("data", "node");
-		trn("node", "nodes", 0); // no marktrn available
 		className = "node";
+		classNamePlural = trn("node", "nodes", 2);
 	}
 
@@ -69,23 +53,9 @@
 	 */
 	public void visit(Way w) {
-		if (w.incomplete) {
-			name = tr("incomplete");
-		} else {
-			name = w.get("name");
-			if (name == null) name = w.get("ref");
-			if (name == null) {
-				name = 
-					(w.get("highway") != null) ? "highway" :
-					(w.get("railway") != null) ? "railway" :
-					(w.get("waterway") != null) ? "waterway" : "";
-			}
-
-			int nodesNo = new HashSet<Node>(w.nodes).size();
-			name += trn(" ({0} node)", " ({0} nodes)", nodesNo, nodesNo);
-		}
+		name = w.getName();
 		addId(w);
 		icon = ImageProvider.get("data", "way");
-		trn("way", "ways", 0); // no marktrn available
 		className = "way";
+		classNamePlural = trn("way", "ways", 2);
 	}
 	
@@ -93,23 +63,9 @@
 	 */
 	public void visit(Relation e) {
-		if (e.incomplete) {
-			name = tr("incomplete");
-		} else {
-			name = e.get("type");
-			// FIXME add names of members
-			if (name == null)
-				name = "relation";
-			
-			name += " (";
-			String nameTag = e.get("name");
-			if (nameTag == null) nameTag = e.get("ref");
-			if (nameTag != null) name += "\"" + nameTag + "\", ";
-			int mbno = e.members.size();
-			name += trn("{0} member", "{0} members", mbno, mbno) + ")";
-		}
+		name = e.getName();
 		addId(e);
 		icon = ImageProvider.get("data", "relation");
-		trn("relation", "relations", 0); // no marktrn available
 		className = "relation";
+		classNamePlural = trn("relation", "relations", 2);
 	}
 	
@@ -121,5 +77,5 @@
 	private void addId(OsmPrimitive osm) {
 	    if (Main.pref.getBoolean("osm-primitives.showid"))
-			name += " (id: "+osm.id+")";
+			name += tr(" (id: {0}))", osm.id);
     }
 }
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java	(revision 755)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.command.DeleteCommand;
+import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
@@ -112,5 +113,5 @@
 		list.setSize(Main.ds.relations.size());
 		int i = 0;
-		for (Relation e : Main.ds.relations) {
+		for (OsmPrimitive e : Main.ds.sort(Main.ds.relations)) {
 			if (!e.deleted && !e.incomplete)
 				list.setElementAt(e, i++);
Index: trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 754)
+++ trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 755)
@@ -96,11 +96,7 @@
 	 */
 	public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) {
-		if (list == null)
+		if (list == null || !isVisible())
 			return; // selection changed may be received in base class constructor before init
-		if (!isVisible())
-			return;
-		OsmPrimitive[] selArr = new OsmPrimitive[newSelection.size()];
-		selArr = newSelection.toArray(selArr);
-		Arrays.sort(selArr);
+		OsmPrimitive selArr[] = Main.ds.sort(newSelection);
 		list.setSize(selArr.length);
 		int i = 0;
