Index: /src/org/openstreetmap/josm/Main.java
===================================================================
--- /src/org/openstreetmap/josm/Main.java	(revision 91)
+++ /src/org/openstreetmap/josm/Main.java	(revision 92)
@@ -1,3 +1,3 @@
-// Licence: GPL
+//Licence: GPL
 package org.openstreetmap.josm;
 
@@ -11,5 +11,4 @@
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.StringTokenizer;
@@ -39,4 +38,5 @@
 import org.openstreetmap.josm.actions.UndoAction;
 import org.openstreetmap.josm.actions.UploadAction;
+import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.Preferences;
 import org.openstreetmap.josm.data.osm.DataSet;
@@ -45,4 +45,5 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.ShowModifiers;
+import org.openstreetmap.josm.gui.dialogs.SelectionListDialog;
 import org.openstreetmap.josm.gui.layer.Layer;
 import org.openstreetmap.josm.gui.layer.OsmDataLayer;
@@ -68,6 +69,6 @@
 	 */
 	public static Executor worker = Executors.newSingleThreadExecutor();
-	
-	
+
+
 	public static Projection proj;
 
@@ -81,5 +82,5 @@
 	 */
 	public static DataSet ds = new DataSet();
-	
+
 	/**
 	 * The main panel.
@@ -96,6 +97,6 @@
 	private OpenAction openAction;
 	private DownloadAction downloadAction;
-    //private Action wmsServerAction;
-	
+	//private Action wmsServerAction;
+
 	/**
 	 * Construct an main frame, ready sized and operating. Does not 
@@ -110,9 +111,9 @@
 		setSize(1000,740); // some strange default size
 		setVisible(true);
-		
+
 		downloadAction = new DownloadAction();
 		Action uploadAction = new UploadAction();
 		//wmsServerAction = new WmsServerAction();
-        openAction = new OpenAction();
+		openAction = new OpenAction();
 		Action saveAction = new SaveAction();
 		Action gpxExportAction = new GpxExportAction(null);
@@ -136,13 +137,13 @@
 		mainMenu.add(fileMenu);
 
-		
+
 		JMenu layerMenu = new JMenu("Layer");
 		layerMenu.setMnemonic('L');
 		layerMenu.add(downloadAction);
 		layerMenu.add(uploadAction);
-        layerMenu.addSeparator();
-        //layerMenu.add(new JCheckBoxMenuItem(wmsServerAction));
+		layerMenu.addSeparator();
+		//layerMenu.add(new JCheckBoxMenuItem(wmsServerAction));
 		mainMenu.add(layerMenu);
-		
+
 		JMenu editMenu = new JMenu("Edit");
 		editMenu.setMnemonic('E');
@@ -152,5 +153,5 @@
 		editMenu.add(preferencesAction);
 		mainMenu.add(editMenu);
-		
+
 		mainMenu.add(new JSeparator());
 		JMenu helpMenu = new JMenu("Help");
@@ -174,7 +175,7 @@
 		toolBar.addSeparator();
 		toolBar.add(preferencesAction);
-		
+
 		getContentPane().add(toolBar, BorderLayout.NORTH);
-	
+
 		addWindowListener(new WindowAdapter(){
 			@Override public void windowClosing(WindowEvent arg0) {
@@ -214,17 +215,30 @@
 		LinkedList<String> arguments = new LinkedList<String>(Arrays.asList(args));
 
-		if (arguments.contains("--help")) {
+		if (arguments.contains("--help") || arguments.contains("-?") || arguments.contains("-h")) {
 			System.out.println("Java OpenStreetMap Editor");
 			System.out.println();
 			System.out.println("usage:");
-			System.out.println("\tjava -jar josm.jar <options> file file file...");
+			System.out.println("\tjava -jar josm.jar <option> <option> <option>...");
 			System.out.println();
 			System.out.println("options:");
-			System.out.println("\t--help                                  Show this help");
-			System.out.println("\t--geometry=widthxheight(+|-)x(+|-)y     Standard unix geometry argument");
-			System.out.println("\t--download=minlat,minlon,maxlat,maxlon  Download the bounding box");
-			System.out.println("\t--no-fullscreen                         Don't launch in fullscreen mode");
-			System.out.println("\t--reset-preferences                     Reset the preferences to default");
-			System.out.println("file(.osm|.xml|.gpx|.txt|.csv)            Open the specific file");
+			System.out.println("\t--help|-?|-h                              Show this help");
+			System.out.println("\t--geometry=widthxheight(+|-)x(+|-)y       Standard unix geometry argument");
+			System.out.println("\t--download=minlat,minlon,maxlat,maxlon    Download the bounding box");
+			System.out.println("\t--downloadgps=minlat,minlon,maxlat,maxlon Download the bounding box");
+			System.out.println("\t--selection=<searchstring>                Select with the given search");
+			System.out.println("\t--no-fullscreen                           Don't launch in fullscreen mode");
+			System.out.println("\t--reset-preferences                       Reset the preferences to default");
+			System.out.println("\tURL|filename(.osm|.xml|.gpx|.txt|.csv)    Open file / Download url");
+			System.out.println();
+			System.out.println("examples:");
+			System.out.println("\tjava -jar josm.jar track1.gpx track2.gpx london.osm");
+			System.out.println("\tjava -jar josm.jar http://www.openstreetmap.org/index.html?lat=43.2&lon=11.1&zoom=13");
+			System.out.println("\tjava -jar josm.jar london.osm --selection=http://www.ostertag.name/osm/OSM_errors_node-duplicate.xml");
+			System.out.println("\tjava -jar josm.jar osm://43.2,11.1,43.4,11.4");
+			System.out.println();
+			System.out.println("Parameters are read in the order they are specified, so make sure you load");
+			System.out.println("some data before --selection");
+			System.out.println();
+			System.out.println("Instead of --download=<bbox> you may specify osm://<bbox>");
 			System.exit(0);
 		}
@@ -260,5 +274,5 @@
 			proj = new Epsg4326();
 		}
-		
+
 		try {
 			UIManager.setLookAndFeel(pref.get("laf"));
@@ -266,5 +280,5 @@
 			e.printStackTrace();
 		}
-		
+
 		new Main();
 		main.setVisible(true);
@@ -279,12 +293,11 @@
 		}
 
-		for (Iterator<String> it = arguments.iterator(); it.hasNext();) {
-			String s = it.next();
-			if (s.startsWith("--download=")) {
-				downloadFromParamString(false, s.substring(11));
-				it.remove();
+		boolean showModifiers = false;
+
+		for (String s : arguments) {
+			if (s.startsWith("--download=") || s.startsWith("osm:")) {
+				downloadFromParamString(false, s);
 			} else if (s.startsWith("--downloadgps=")) {
-				downloadFromParamString(true, s.substring(14));
-				it.remove();
+				downloadFromParamString(true, s);
 			} else if (s.startsWith("--geometry=")) {
 				Matcher m = Pattern.compile("(\\d+)x(\\d+)(([+-])(\\d+)([+-])(\\d+))?").matcher(s.substring(11));
@@ -305,9 +318,20 @@
 				} else
 					System.out.println("Ignoring malformed geometry: "+s.substring(11));
-				it.remove();
+			} else if (s.equals("--show-modifiers")) {
+				showModifiers = true;
+			} else if (s.startsWith("--selection=")) {
+				SelectionListDialog.search(s.substring(12), SelectionListDialog.SearchMode.add);
+			} else if (s.startsWith("http:") || s.startsWith("ftp:") || s.startsWith("https:")) {
+				Bounds b = DownloadAction.osmurl2bounds(s);
+				if (b == null)
+					System.out.println("Ignoring malformed url: "+s);
+				else
+					Main.main.downloadAction.download(false, b.min.lat(), b.min.lon(), b.max.lat(), b.max.lon());
+			} else {
+				main.openAction.openFile(new File(s));
 			}
 		}
 
-		if (arguments.remove("--show-modifiers")) {
+		if (showModifiers) {
 			Point p = main.getLocationOnScreen();
 			Dimension s = main.getSize();
@@ -315,14 +339,14 @@
 			main.setVisible(true);
 		}
-
-		for (String s : arguments)
-			main.openAction.openFile(new File(s));
 	}
 
 
 	private static void downloadFromParamString(boolean rawGps, String s) {
+		s = s.replaceAll("^(osm:/?/?)|(--download(gps)?=)", "");
+		System.out.println(s);
+		System.exit(1);
 		StringTokenizer st = new StringTokenizer(s, ",");
 		if (st.countTokens() != 4) {
-			JOptionPane.showMessageDialog(main, "Download option does not take "+st.countTokens()+" bounding parameter.");
+			JOptionPane.showMessageDialog(main, "Malformed bounding box: "+s);
 			return;
 		}
@@ -355,5 +379,5 @@
 	}
 
-	
+
 	/**
 	 * Sets some icons to the ui.
Index: /src/org/openstreetmap/josm/actions/DownloadAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/DownloadAction.java	(revision 91)
+++ /src/org/openstreetmap/josm/actions/DownloadAction.java	(revision 92)
@@ -13,5 +13,4 @@
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Map;
 
 import javax.swing.DefaultListModel;
@@ -36,4 +35,5 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.MapView;
+import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.gui.WorldChooser;
 import org.openstreetmap.josm.gui.BookmarkList.Bookmark;
@@ -60,20 +60,21 @@
 	 * Run in the worker thread.
 	 */
-    private final class DownloadOsmTask extends PleaseWaitRunnable {
-	    private final OsmServerReader reader;
+	private final class DownloadOsmTask extends PleaseWaitRunnable {
+		private final OsmServerReader reader;
 		private DataSet dataSet;
 
-	    private DownloadOsmTask(OsmServerReader reader) {
-		    super("Downloading data");
-		    this.reader = reader;
-	    }
-
-	    @Override public void realRun() throws IOException, SAXException {
-    		dataSet = reader.parseOsm();
-    		if (dataSet == null)
-    			return;
-    		if (dataSet.nodes.isEmpty())
-    			JOptionPane.showMessageDialog(Main.main, "No data imported.");
-	    }
+		private DownloadOsmTask(OsmServerReader reader) {
+			super("Downloading data");
+			this.reader = reader;
+			reader.setProgressInformation(currentAction, progress);
+		}
+
+		@Override public void realRun() throws IOException, SAXException {
+			dataSet = reader.parseOsm();
+			if (dataSet == null)
+				return;
+			if (dataSet.nodes.isEmpty())
+				JOptionPane.showMessageDialog(Main.main, "No data imported.");
+		}
 
 		@Override protected void finish() {
@@ -81,25 +82,28 @@
 				return; // user cancelled download or error occoured
 			Layer layer = new OsmDataLayer(dataSet, "Data Layer", false);
-	    	if (Main.main.getMapFrame() == null)
-	    		Main.main.setMapFrame(new MapFrame(layer));
-	    	else
-	    		Main.main.getMapFrame().mapView.addLayer(layer);
-		}
-	    
-    }
-
-
-    private final class DownloadGpsTask extends PleaseWaitRunnable {
-	    private final OsmServerReader reader;
+			if (Main.main.getMapFrame() == null)
+				Main.main.setMapFrame(new MapFrame(layer));
+			else
+				Main.main.getMapFrame().mapView.addLayer(layer);
+		}
+
+		@Override protected void cancel() {
+			reader.cancel();
+		}
+	}
+
+
+	private final class DownloadGpsTask extends PleaseWaitRunnable {
+		private final OsmServerReader reader;
 		private Collection<Collection<GpsPoint>> rawData;
 
-	    private DownloadGpsTask(OsmServerReader reader) {
-		    super("Downloading GPS data");
-		    this.reader = reader;
-	    }
-
-	    @Override public void realRun() throws IOException, JDOMException {
-    		rawData = reader.parseRawGps();
-	    }
+		private DownloadGpsTask(OsmServerReader reader) {
+			super("Downloading GPS data");
+			this.reader = reader;
+		}
+
+		@Override public void realRun() throws IOException, JDOMException {
+			rawData = reader.parseRawGps();
+		}
 
 		@Override protected void finish() {
@@ -108,16 +112,18 @@
 			String name = latlon[0].getText() + " " + latlon[1].getText() + " x " + latlon[2].getText() + " " + latlon[3].getText();
 			Layer layer = new RawGpsDataLayer(rawData, name);
-	    	if (Main.main.getMapFrame() == null)
-	    		Main.main.setMapFrame(new MapFrame(layer));
-	    	else
-	    		Main.main.getMapFrame().mapView.addLayer(layer);
-		}
-	    
-    }
-    
-    
-	/**
-     * minlat, minlon, maxlat, maxlon
-     */
+			if (Main.main.getMapFrame() == null)
+				Main.main.setMapFrame(new MapFrame(layer));
+			else
+				Main.main.getMapFrame().mapView.addLayer(layer);
+		}
+
+		@Override protected void cancel() {
+		}
+	}
+
+
+	/**
+	 * minlat, minlon, maxlat, maxlon
+	 */
 	JTextField[] latlon = new JTextField[]{
 			new JTextField(9),
@@ -136,5 +142,4 @@
 
 	public void actionPerformed(ActionEvent e) {
-		
 		String osmDataServer = Main.pref.get("osm-server.url");
 		//TODO: Remove this in later versions (temporary only)
@@ -178,5 +183,5 @@
 		}
 		dlg.add(rawGps, GBC.eop());
-		
+
 		// OSM url edit
 		dlg.add(new JLabel("URL from www.openstreetmap.org"), GBC.eol());
@@ -221,20 +226,15 @@
 				SwingUtilities.invokeLater(new Runnable() {
 					public void run() {
-						Map<String, Double> map = readArgs(osmUrl.getText());
-						try {
-							double size = 180.0 / Math.pow(2, map.get("zoom"));
-							Bounds b = new Bounds(
-									new LatLon(map.get("lat") - size/2, map.get("lon") - size),
-									new LatLon(map.get("lat") + size/2, map.get("lon") + size));
+						Bounds b = osmurl2bounds(osmUrl.getText());
+						if (b != null)
 							setEditBounds(b);
-						} catch (Exception x) { // NPE or IAE
+						else 
 							for (JTextField f : latlon)
 								f.setText("");
-						}
 					}
 				});
 			}
 		});
-		
+
 		// Bookmarks
 		dlg.add(new JLabel("Bookmarks"), GBC.eol());
@@ -289,5 +289,5 @@
 		wc.setPreferredSize(new Dimension(d.width, d.width/2));
 		wc.addInputFields(latlon, osmUrl, osmUrlRefresher);
-		
+
 		// Finally: the dialog
 		Bookmark b;
@@ -330,14 +330,11 @@
 		}
 	}
-	
-	
-	/**
-	 * Extrakt URL arguments.
-	 */
-	private Map<String, Double> readArgs(String s) {
-		int i = s.indexOf('?');
+
+
+	public static Bounds osmurl2bounds(String url) {
+		int i = url.indexOf('?');
 		if (i == -1)
-			return new HashMap<String, Double>();
-		String[] args = s.substring(i+1).split("&");
+			return null;
+		String[] args = url.substring(i+1).split("&");
 		HashMap<String, Double> map = new HashMap<String, Double>();
 		for (String arg : args) {
@@ -350,7 +347,14 @@
 			}
 		}
-		return map;
-	}
-	
+		try {
+			double size = 180.0 / Math.pow(2, map.get("zoom"));
+			return new Bounds(
+					new LatLon(map.get("lat") - size/2, map.get("lon") - size),
+					new LatLon(map.get("lat") + size/2, map.get("lon") + size));
+		} catch (Exception x) { // NPE or IAE
+			return null;
+		}
+	}
+
 	/**
 	 * Set the four edit fields to the given bounds coordinates.
Index: /src/org/openstreetmap/josm/actions/JosmAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/JosmAction.java	(revision 91)
+++ /src/org/openstreetmap/josm/actions/JosmAction.java	(revision 92)
@@ -1,20 +1,11 @@
 package org.openstreetmap.josm.actions;
 
-import java.awt.EventQueue;
-import java.io.FileNotFoundException;
-import java.io.IOException;
 
 import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
 import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
 import javax.swing.KeyStroke;
 
-import org.jdom.JDOMException;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.tools.ImageProvider;
-import org.xml.sax.SAXException;
 
 /**
@@ -24,74 +15,4 @@
 abstract public class JosmAction extends AbstractAction {
 
-	/**
-	 * Instanced of this thread will display a "Please Wait" message in middle of JOSM
-	 * to indicate a progress beeing executed.
-	 *  
-	 * @author Imi
-	 */
-	protected abstract class PleaseWaitRunnable implements Runnable {
-		public final JDialog pleaseWaitDlg;
-		private String errorMessage;
-		/**
-		 * Create the runnable object with a given message for the user.
-		 */
-		public PleaseWaitRunnable(String msg) {
-			pleaseWaitDlg = new JDialog(Main.main, true);
-			pleaseWaitDlg.setUndecorated(true);
-			JLabel l = new JLabel(msg+". Please Wait.");
-			l.setBorder(BorderFactory.createCompoundBorder(
-					BorderFactory.createEtchedBorder(),
-					BorderFactory.createEmptyBorder(20,20,20,20)));
-			pleaseWaitDlg.getContentPane().add(l);
-			pleaseWaitDlg.pack();
-			pleaseWaitDlg.setLocationRelativeTo(Main.main);
-			pleaseWaitDlg.setResizable(false);
-		}
-		public final void run() {
-			try {
-				realRun();
-	    	} catch (SAXException x) {
-	    		x.printStackTrace();
-	    		errorMessage = "Error while parsing: "+x.getMessage();
-	    	} catch (JDOMException x) {
-	    		x.printStackTrace();
-	    		errorMessage = "Error while parsing: "+x.getMessage();
-	    	} catch (FileNotFoundException x) {
-	    		x.printStackTrace();
-	    		errorMessage = "URL not found: " + x.getMessage();
-	    	} catch (IOException x) {
-	    		x.printStackTrace();
-	    		errorMessage = x.getMessage();
-			} finally {
-				closeDialog();
-			}
-		}
-		/**
-		 * Called in the worker thread to do the actual work. When any of the
-		 * exception is thrown, a message box will be displayed and closeDialog
-		 * is called. finish() is called in any case.
-		 */
-		protected abstract void realRun() throws SAXException, JDOMException, IOException;
-		/**
-		 * Finish up the data work. Is guaranteed to be called if realRun is called.
-		 * Finish is called in the gui thread just after the dialog disappeared.
-		 */
-		protected void finish() {}
-		/**
-		 * Close the dialog. Usually called from worker thread.
-		 */
-		public void closeDialog() {
-			EventQueue.invokeLater(new Runnable(){
-				public void run() {
-					finish();
-					pleaseWaitDlg.setVisible(false);
-					pleaseWaitDlg.dispose();
-					if (errorMessage != null)
-						JOptionPane.showMessageDialog(Main.main, errorMessage);
-                }
-			});
-		}
-	}
-	
 	/**
 	 * Construct the action as menu action entry.
Index: /src/org/openstreetmap/josm/actions/UploadAction.java
===================================================================
--- /src/org/openstreetmap/josm/actions/UploadAction.java	(revision 91)
+++ /src/org/openstreetmap/josm/actions/UploadAction.java	(revision 92)
@@ -19,4 +19,5 @@
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
+import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.io.OsmServerWriter;
 import org.openstreetmap.josm.tools.GBC;
@@ -38,5 +39,5 @@
 
 	public void actionPerformed(ActionEvent e) {
-		
+
 		String osmDataServer = Main.pref.get("osm-server.url");
 		//TODO: Remove this in later versions (temporary only)
@@ -54,5 +55,5 @@
 			Main.pref.put("osm-server.url", osmDataServer.substring(0, osmDataServer.length()-cutPos));
 		}
-		
+
 		if (!Main.main.getMapFrame().conflictDialog.conflicts.isEmpty()) {
 			JOptionPane.showMessageDialog(Main.main, "There are unresolved conflicts. You have to resolve these first.");
@@ -82,14 +83,17 @@
 		all.addAll(update);
 		all.addAll(delete);
-		
+
 		PleaseWaitRunnable uploadTask = new PleaseWaitRunnable("Uploading data"){
-        			@Override protected void realRun() throws JDOMException {
-        				server.uploadOsm(all);
-        			}
-        			@Override protected void finish() {
-        				Main.main.getMapFrame().mapView.editLayer().cleanData(server.processed, !add.isEmpty());
-                    }
-        			
-        		};
+			@Override protected void realRun() throws JDOMException {
+				server.setProgressInformation(currentAction, progress);
+				server.uploadOsm(all);
+			}
+			@Override protected void finish() {
+				Main.main.getMapFrame().mapView.editLayer().cleanData(server.processed, !add.isEmpty());
+			}
+			@Override protected void cancel() {
+				server.cancel();
+			}
+		};
 		Main.worker.execute(uploadTask);
 		uploadTask.pleaseWaitDlg.setVisible(true);
Index: /src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java
===================================================================
--- /src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java	(revision 92)
+++ /src/org/openstreetmap/josm/data/osm/visitor/NameVisitor.java	(revision 92)
@@ -0,0 +1,84 @@
+
+package org.openstreetmap.josm.data.osm.visitor;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.swing.Icon;
+
+import org.openstreetmap.josm.data.osm.Segment;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.tools.ImageProvider;
+
+/**
+ * Able to create a name and an icon for each data element.
+ * 
+ * @author imi
+ */
+public class NameVisitor implements Visitor {
+
+	/**
+	 * The name of the item class
+	 */
+	public String className;
+	/**
+	 * The name of this item.
+	 */
+	public String name;
+	/**
+	 * The icon of this item.
+	 */
+	public Icon icon;
+	
+	
+	/**
+	 * If the segment has a key named "name", its value is displayed. 
+	 * Otherwise, if it has "id", this is used. If none of these available, 
+	 * "(x1,y1) -> (x2,y2)" is displayed with the nodes coordinates.
+	 */
+	public void visit(Segment ls) {
+		name = ls.get("name");
+		if (name == null) {
+			if (ls.incomplete)
+				name = ls.id == 0 ? "new" : ""+ls.id;
+			else
+				name = (ls.id==0?"":ls.id+" ")+"("+ls.from.coor.lat()+","+ls.from.coor.lon()+") -> ("+ls.to.coor.lat()+","+ls.to.coor.lon()+")";
+		}
+		icon = ImageProvider.get("data", "segment");
+		className = "segment";
+	}
+
+	/**
+	 * 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.get("name");
+		if (name == null)
+			name = (n.id==0?"":""+n.id)+" ("+n.coor.lat()+","+n.coor.lon()+")";
+		icon = ImageProvider.get("data", "node");
+		className = "node";
+	}
+
+	/**
+	 * If the way has a name-key or id-key, this is displayed. If not, (x nodes)
+	 * is displayed with x beeing the number of nodes in the way.
+	 */
+	public void visit(Way w) {
+		name = w.get("name");
+		if (name == null) {
+			AllNodesVisitor.getAllNodes(w.segments);
+			Set<Node> nodes = new HashSet<Node>();
+			for (Segment ls : w.segments) {
+				if (!ls.incomplete) {
+					nodes.add(ls.from);
+					nodes.add(ls.to);
+				}
+			}
+			name = "("+nodes.size()+" nodes)";
+		}
+		icon = ImageProvider.get("data", "way");
+		className = "way";
+	}
+}
Index: c/org/openstreetmap/josm/data/osm/visitor/SelectionComponentVisitor.java
===================================================================
--- /src/org/openstreetmap/josm/data/osm/visitor/SelectionComponentVisitor.java	(revision 91)
+++ 	(revision )
@@ -1,77 +1,0 @@
-
-package org.openstreetmap.josm.data.osm.visitor;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.swing.Icon;
-
-import org.openstreetmap.josm.data.osm.Segment;
-import org.openstreetmap.josm.data.osm.Node;
-import org.openstreetmap.josm.data.osm.Way;
-import org.openstreetmap.josm.tools.ImageProvider;
-
-/**
- * Able to create a name and an icon for each data element.
- * 
- * @author imi
- */
-public class SelectionComponentVisitor implements Visitor {
-
-	/**
-	 * The name of this item.
-	 */
-	public String name;
-	/**
-	 * The icon of this item.
-	 */
-	public Icon icon;
-	
-	
-	/**
-	 * If the segment has a key named "name", its value is displayed. 
-	 * Otherwise, if it has "id", this is used. If none of these available, 
-	 * "(x1,y1) -> (x2,y2)" is displayed with the nodes coordinates.
-	 */
-	public void visit(Segment ls) {
-		name = ls.get("name");
-		if (name == null) {
-			if (ls.incomplete)
-				name = ls.id == 0 ? "new" : ""+ls.id;
-			else
-				name = (ls.id==0?"":ls.id+" ")+"("+ls.from.coor.lat()+","+ls.from.coor.lon()+") -> ("+ls.to.coor.lat()+","+ls.to.coor.lon()+")";
-		}
-		icon = ImageProvider.get("data", "segment");
-	}
-
-	/**
-	 * 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.get("name");
-		if (name == null)
-			name = (n.id==0?"":""+n.id)+" ("+n.coor.lat()+","+n.coor.lon()+")";
-		icon = ImageProvider.get("data", "node");
-	}
-
-	/**
-	 * If the way has a name-key or id-key, this is displayed. If not, (x nodes)
-	 * is displayed with x beeing the number of nodes in the way.
-	 */
-	public void visit(Way w) {
-		name = w.get("name");
-		if (name == null) {
-			AllNodesVisitor.getAllNodes(w.segments);
-			Set<Node> nodes = new HashSet<Node>();
-			for (Segment ls : w.segments) {
-				if (!ls.incomplete) {
-					nodes.add(ls.from);
-					nodes.add(ls.to);
-				}
-			}
-			name = "("+nodes.size()+" nodes)";
-		}
-		icon = ImageProvider.get("data", "way");
-	}
-}
Index: /src/org/openstreetmap/josm/gui/MapStatus.java
===================================================================
--- /src/org/openstreetmap/josm/gui/MapStatus.java	(revision 91)
+++ /src/org/openstreetmap/josm/gui/MapStatus.java	(revision 92)
@@ -30,5 +30,5 @@
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.visitor.SelectionComponentVisitor;
+import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
 import org.openstreetmap.josm.tools.GBC;
 
@@ -120,5 +120,5 @@
 					osmNearest = mv.getNearest(ms.mousePos, (ms.modifiers & MouseEvent.ALT_DOWN_MASK) != 0);
 					if (osmNearest != null) {
-						SelectionComponentVisitor visitor = new SelectionComponentVisitor();
+						NameVisitor visitor = new NameVisitor();
 						osmNearest.visit(visitor);
 						nameText.setText(visitor.name);
@@ -133,5 +133,5 @@
 						JPanel c = new JPanel(new GridBagLayout());
 						for (final OsmPrimitive osm : osms) {
-							SelectionComponentVisitor visitor = new SelectionComponentVisitor();
+							NameVisitor visitor = new NameVisitor();
 							osm.visit(visitor);
 							final StringBuilder text = new StringBuilder();
Index: /src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java
===================================================================
--- /src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java	(revision 91)
+++ /src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java	(revision 92)
@@ -8,5 +8,5 @@
 
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
-import org.openstreetmap.josm.data.osm.visitor.SelectionComponentVisitor;
+import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
 
 /**
@@ -16,5 +16,5 @@
 public class OsmPrimitivRenderer extends DefaultListCellRenderer {
 
-	private SelectionComponentVisitor visitor = new SelectionComponentVisitor();
+	private NameVisitor visitor = new NameVisitor();
 
 	@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Index: /src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
===================================================================
--- /src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java	(revision 92)
+++ /src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java	(revision 92)
@@ -0,0 +1,128 @@
+package org.openstreetmap.josm.gui;
+
+import java.awt.EventQueue;
+import java.awt.GridBagLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoundedRangeModel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+
+import org.jdom.JDOMException;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.GBC;
+import org.xml.sax.SAXException;
+
+/**
+ * Instanced of this thread will display a "Please Wait" message in middle of JOSM
+ * to indicate a progress beeing executed.
+ *  
+ * @author Imi
+ */
+public abstract class PleaseWaitRunnable implements Runnable {
+	public final JDialog pleaseWaitDlg;
+	private String errorMessage;
+
+	private final JProgressBar progressBar = new JProgressBar();
+	private boolean closeDialogCalled = false;
+
+	protected final JLabel currentAction = new JLabel("Contact OSM server...");
+	protected final BoundedRangeModel progress = progressBar.getModel();
+
+	/**
+	 * Create the runnable object with a given message for the user.
+	 */
+	public PleaseWaitRunnable(String msg) {
+		pleaseWaitDlg = new JDialog(Main.main, msg, true);
+		pleaseWaitDlg.setLayout(new GridBagLayout());
+		JPanel pane = new JPanel(new GridBagLayout());
+		pane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
+		pane.add(currentAction, GBC.eol().fill(GBC.HORIZONTAL));
+		pane.add(progressBar, GBC.eop().fill(GBC.HORIZONTAL));
+		JButton cancel = new JButton("Cancel");
+		pane.add(cancel, GBC.eol().anchor(GBC.CENTER));
+		pleaseWaitDlg.setContentPane(pane);
+		pleaseWaitDlg.setSize(350,100);
+		pleaseWaitDlg.setLocationRelativeTo(Main.main);
+
+		cancel.addActionListener(new ActionListener(){
+			public void actionPerformed(ActionEvent e) {
+				cancel();
+			}
+		});
+		pleaseWaitDlg.addWindowListener(new WindowAdapter(){
+			@Override public void windowClosing(WindowEvent e) {
+				if (!closeDialogCalled) {
+					cancel();
+					closeDialog();
+				}
+			}
+		});
+	}
+
+	public final void run() {
+		try {
+			realRun();
+		} catch (SAXException x) {
+			x.printStackTrace();
+			errorMessage = "Error while parsing: "+x.getMessage();
+		} catch (JDOMException x) {
+			x.printStackTrace();
+			errorMessage = "Error while parsing: "+x.getMessage();
+		} catch (FileNotFoundException x) {
+			x.printStackTrace();
+			errorMessage = "URL not found: " + x.getMessage();
+		} catch (IOException x) {
+			x.printStackTrace();
+			errorMessage = x.getMessage();
+		} finally {
+			closeDialog();
+		}
+	}
+
+	/**
+	 * User pressed cancel button.
+	 */
+	protected abstract void cancel();
+
+	/**
+	 * Called in the worker thread to do the actual work. When any of the
+	 * exception is thrown, a message box will be displayed and closeDialog
+	 * is called. finish() is called in any case.
+	 */
+	protected abstract void realRun() throws SAXException, JDOMException, IOException;
+
+	/**
+	 * Finish up the data work. Is guaranteed to be called if realRun is called.
+	 * Finish is called in the gui thread just after the dialog disappeared.
+	 */
+	protected abstract void finish();
+
+	/**
+	 * Close the dialog. Usually called from worker thread.
+	 */
+	public void closeDialog() {
+		if (closeDialogCalled)
+			return;
+		closeDialogCalled  = true;
+		EventQueue.invokeLater(new Runnable(){
+			public void run() {
+				finish();
+				pleaseWaitDlg.setVisible(false);
+				pleaseWaitDlg.dispose();
+				if (errorMessage != null)
+					JOptionPane.showMessageDialog(Main.main, errorMessage);
+			}
+		});
+	}
+}
Index: /src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
===================================================================
--- /src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 91)
+++ /src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java	(revision 92)
@@ -234,5 +234,5 @@
 			}
 		});
-		propertyTable.addMouseListener(new DblClickWatch());
+		//propertyTable.addMouseListener(new DblClickWatch());
 
 		JScrollPane scrollPane = new JScrollPane(propertyTable);
Index: /src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java
===================================================================
--- /src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 91)
+++ /src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java	(revision 92)
@@ -11,6 +11,6 @@
 import java.awt.event.MouseEvent;
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.io.Reader;
+import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -31,4 +31,5 @@
 import javax.swing.ListSelectionModel;
 
+import org.jdom.JDOMException;
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.SelectionChangedListener;
@@ -36,5 +37,7 @@
 import org.openstreetmap.josm.gui.MapFrame;
 import org.openstreetmap.josm.gui.OsmPrimitivRenderer;
+import org.openstreetmap.josm.gui.PleaseWaitRunnable;
 import org.openstreetmap.josm.io.OsmIdReader;
+import org.openstreetmap.josm.io.ProgressReader;
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -51,4 +54,52 @@
 public class SelectionListDialog extends ToggleDialog implements SelectionChangedListener {
 
+	public static enum SearchMode {replace, add, remove}
+
+	private static class SelectionWebsiteLoader extends PleaseWaitRunnable {
+		public final URL url;
+		public Collection<OsmPrimitive> sel;
+		private final SearchMode mode;
+		private OsmIdReader idReader = new OsmIdReader();
+		public SelectionWebsiteLoader(String urlStr, SearchMode mode) {
+	        super("Load Selection");
+	        this.mode = mode;
+	        URL u = null;
+			try {u = new URL(urlStr);} catch (MalformedURLException e) {}
+            this.url = u;
+        }
+		@Override protected void realRun() throws SAXException, JDOMException, IOException {
+			currentAction.setText("Contact "+url.getHost()+"...");
+			sel = mode != SearchMode.remove ? new LinkedList<OsmPrimitive>() : Main.ds.allNonDeletedPrimitives();
+			try {
+		        HttpURLConnection con = (HttpURLConnection)url.openConnection();
+		        Reader in = new ProgressReader(con, progress);
+				currentAction.setText("Downloading...");
+				Map<Long, String> ids = idReader.parseIds(in);
+		        for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) {
+		        	if (ids.containsKey(osm.id) && osm.getClass().getName().toLowerCase().endsWith(ids.get(osm.id))) {
+		        		if (mode == SearchMode.remove)
+		        			sel.remove(osm);
+		        		else
+		        			sel.add(osm);
+		        	}
+				}
+	        } catch (IOException e) {
+		        e.printStackTrace();
+		        JOptionPane.showMessageDialog(Main.main, "Could not read from url: '"+url+"'");
+	        } catch (SAXException e) {
+		        e.printStackTrace();
+		        JOptionPane.showMessageDialog(Main.main, "Parsing error in url: '"+url+"'");
+	        }
+        }
+		@Override protected void cancel() {
+			sel = null;
+			idReader.cancel();
+		}
+		@Override protected void finish() {
+			if (sel != null)
+				Main.ds.setSelected(sel);
+        }
+	}
+	
 	/**
 	 * The selection's list data.
@@ -128,23 +179,6 @@
 					return;
 				lastSearch = input.getText();
-				Collection<OsmPrimitive> sel = null;
-				if (lastSearch.startsWith("http://"))
-					sel = selectFromWebsite(lastSearch, replace.isSelected(), add.isSelected(), remove.isSelected());
-				if (sel == null) {
-					sel = Main.ds.getSelected();
-					SearchCompiler.Match matcher = SearchCompiler.compile(lastSearch);
-					for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) {
-						if (replace.isSelected()) {
-							if (matcher.match(osm))
-								sel.add(osm);
-							else
-								sel.remove(osm);
-						} else if (add.isSelected() && !osm.selected && matcher.match(osm))
-							sel.add(osm);
-						else if (remove.isSelected() && osm.selected && matcher.match(osm))
-							sel.remove(osm);
-					}
-				}
-				Main.ds.setSelected(sel);
+				SearchMode mode = replace.isSelected() ? SearchMode.replace : (add.isSelected() ? SearchMode.add : SearchMode.remove);
+				search(lastSearch, mode);
 			}
 		});
@@ -154,29 +188,4 @@
 		selectionChanged(Main.ds.getSelected());
 	}
-
-	private Collection<OsmPrimitive> selectFromWebsite(String url, boolean replace, boolean add, boolean remove) {
-		Collection<OsmPrimitive> sel = replace ? new LinkedList<OsmPrimitive>() : Main.ds.allNonDeletedPrimitives();
-		try {
-	        Reader in = new InputStreamReader(new URL(url).openStream());
-	        Map<Long, String> ids = OsmIdReader.parseIds(in);
-	        for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) {
-	        	if (ids.containsKey(osm.id) && osm.getClass().getName().toLowerCase().endsWith(ids.get(osm.id))) {
-	        		if (remove)
-	        			sel.remove(osm);
-	        		else
-	        			sel.add(osm);
-	        	}
-			}
-        } catch (MalformedURLException e) {
-	        return null;
-        } catch (IOException e) {
-	        e.printStackTrace();
-	        JOptionPane.showMessageDialog(Main.main, "Could not read from url: '"+url+"'");
-        } catch (SAXException e) {
-	        e.printStackTrace();
-	        JOptionPane.showMessageDialog(Main.main, "Parsing error in url: '"+url+"'");
-        }
-        return sel;
-    }
 
 	@Override public void setVisible(boolean b) {
@@ -216,3 +225,28 @@
 		Main.ds.setSelected(sel);
 	}
+
+	public static void search(String search, SearchMode mode) {
+	    if (search.startsWith("http://")) {
+	    	SelectionWebsiteLoader loader = new SelectionWebsiteLoader(search, mode);
+	    	if (loader.url != null) {
+	    		Main.worker.execute(loader);
+	    		loader.pleaseWaitDlg.setVisible(true);
+	    		return;
+	    	}
+	    }
+	    Collection<OsmPrimitive> sel = Main.ds.getSelected();
+    	SearchCompiler.Match matcher = SearchCompiler.compile(search);
+    	for (OsmPrimitive osm : Main.ds.allNonDeletedPrimitives()) {
+    		if (mode == SearchMode.replace) {
+    			if (matcher.match(osm))
+    				sel.add(osm);
+    			else
+    				sel.remove(osm);
+    		} else if (mode == SearchMode.add && !osm.selected && matcher.match(osm))
+    			sel.add(osm);
+    		else if (mode == SearchMode.remove && osm.selected && matcher.match(osm))
+    			sel.remove(osm);
+    	}
+	    Main.ds.setSelected(sel);
+    }
 }
Index: /src/org/openstreetmap/josm/io/OsmConnection.java
===================================================================
--- /src/org/openstreetmap/josm/io/OsmConnection.java	(revision 91)
+++ /src/org/openstreetmap/josm/io/OsmConnection.java	(revision 92)
@@ -7,4 +7,5 @@
 import java.net.PasswordAuthentication;
 
+import javax.swing.BoundedRangeModel;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
@@ -24,51 +25,10 @@
 public class OsmConnection {
 
-	/**
-	 * The authentication class handling the login requests.
-	 */
-	private static class OsmAuth extends Authenticator {
-		/**
-		 * Set to true, when the autenticator tried the password once.
-		 */
-		boolean passwordtried = false;
-		/**
-		 * Whether the user cancelled the password dialog
-		 */
-		boolean cancelled = false;
-
-		@Override protected PasswordAuthentication getPasswordAuthentication() {
-			String username = Main.pref.get("osm-server.username");
-			String password = Main.pref.get("osm-server.password");
-			if (passwordtried || username.equals("") || password.equals("")) {
-				JPanel p = new JPanel(new GridBagLayout());
-				p.add(new JLabel("Username"), GBC.std().insets(0,0,10,0));
-				JTextField usernameField = new JTextField(username, 20);
-				p.add(usernameField, GBC.eol());
-				p.add(new JLabel("Password"), GBC.std().insets(0,0,10,0));
-				JPasswordField passwordField = new JPasswordField(password, 20);
-				p.add(passwordField, GBC.eol());
-				JLabel warning = new JLabel("Warning: The password is transferred unencrypted.");
-				warning.setFont(warning.getFont().deriveFont(Font.ITALIC));
-				p.add(warning, GBC.eol());
-				int choice = JOptionPane.showConfirmDialog(Main.main, p, "Enter Password", JOptionPane.OK_CANCEL_OPTION);
-				if (choice == JOptionPane.CANCEL_OPTION) {
-					cancelled = true;
-					return null;
-				}
-				username = usernameField.getText();
-				password = String.valueOf(passwordField.getPassword());
-				if (username.equals(""))
-					return null;
-			}
-			passwordtried = true;
-			return new PasswordAuthentication(username, password.toCharArray());
-		}
-	}
-
-	/**
-	 * The authenticator.
-	 */
+	protected boolean cancel = false;
+	protected HttpURLConnection activeConnection;
+	protected JLabel currentAction;
+	protected BoundedRangeModel progress;
+	
 	private static OsmAuth authentication;
-	
 	/**
 	 * Initialize the http defaults and the authenticator.
@@ -80,8 +40,50 @@
 	
 	/**
+     * The authentication class handling the login requests.
+     */
+    private static class OsmAuth extends Authenticator {
+    	/**
+    	 * Set to true, when the autenticator tried the password once.
+    	 */
+    	boolean passwordtried = false;
+    	/**
+    	 * Whether the user cancelled the password dialog
+    	 */
+    	boolean authCancelled = false;
+    
+    	@Override protected PasswordAuthentication getPasswordAuthentication() {
+    		String username = Main.pref.get("osm-server.username");
+    		String password = Main.pref.get("osm-server.password");
+    		if (passwordtried || username.equals("") || password.equals("")) {
+    			JPanel p = new JPanel(new GridBagLayout());
+    			p.add(new JLabel("Username"), GBC.std().insets(0,0,10,0));
+    			JTextField usernameField = new JTextField(username, 20);
+    			p.add(usernameField, GBC.eol());
+    			p.add(new JLabel("Password"), GBC.std().insets(0,0,10,0));
+    			JPasswordField passwordField = new JPasswordField(password, 20);
+    			p.add(passwordField, GBC.eol());
+    			JLabel warning = new JLabel("Warning: The password is transferred unencrypted.");
+    			warning.setFont(warning.getFont().deriveFont(Font.ITALIC));
+    			p.add(warning, GBC.eol());
+    			int choice = JOptionPane.showConfirmDialog(Main.main, p, "Enter Password", JOptionPane.OK_CANCEL_OPTION);
+    			if (choice == JOptionPane.CANCEL_OPTION) {
+    				authCancelled = true;
+    				return null;
+    			}
+    			username = usernameField.getText();
+    			password = String.valueOf(passwordField.getPassword());
+    			if (username.equals(""))
+    				return null;
+    		}
+    		passwordtried = true;
+    		return new PasswordAuthentication(username, password.toCharArray());
+    	}
+    }
+
+	/**
 	 * Must be called before each connection attemp to initialize the authentication.
 	 */
 	protected final void initAuthentication() {
-		authentication.cancelled = false;
+		authentication.authCancelled = false;
 		authentication.passwordtried = false;
 	}
@@ -90,6 +92,21 @@
 	 * @return Whether the connection was cancelled.
 	 */
-	protected final boolean isCancelled() {
-		return authentication.cancelled;
+	protected final boolean isAuthCancelled() {
+		return authentication.authCancelled;
 	}
+
+	public void setProgressInformation(JLabel currentAction, BoundedRangeModel progress) {
+		this.currentAction = currentAction;
+		this.progress = progress;
+    }
+
+	public void cancel() {
+		currentAction.setText("Aborting...");
+    	cancel = true;
+    	if (activeConnection != null) {
+    		activeConnection.setConnectTimeout(1);
+    		activeConnection.setReadTimeout(1);
+    		activeConnection.disconnect();
+    	}
+    }
 }
Index: /src/org/openstreetmap/josm/io/OsmIdReader.java
===================================================================
--- /src/org/openstreetmap/josm/io/OsmIdReader.java	(revision 91)
+++ /src/org/openstreetmap/josm/io/OsmIdReader.java	(revision 92)
@@ -18,5 +18,7 @@
 public class OsmIdReader extends MinML2 {
 
+	private boolean cancel;
 	Map<Long, String> entries = new HashMap<Long, String>();
+	private Reader in;
 
 	@Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
@@ -31,8 +33,19 @@
     }
 
-	public static Map<Long, String> parseIds(Reader in) throws IOException, SAXException {
-		OsmIdReader r = new OsmIdReader();
-        r.parse(in);
-		return r.entries;
+	public Map<Long, String> parseIds(Reader in) throws IOException, SAXException {
+        this.in = in;
+		try {
+	        parse(in);
+        } catch (SAXException e) {
+        	if (!cancel)
+        		throw e;
+        }        
+		return entries;
+	}
+	
+	public void cancel() {
+		cancel = true;
+		if (in != null)
+            try {in.close();} catch (IOException e) {}
 	}
 }
Index: /src/org/openstreetmap/josm/io/OsmServerReader.java
===================================================================
--- /src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 91)
+++ /src/org/openstreetmap/josm/io/OsmServerReader.java	(revision 92)
@@ -2,5 +2,4 @@
 
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.HttpURLConnection;
@@ -68,4 +67,5 @@
 				break;
 			r.close();
+			activeConnection = null;
 		}
 
@@ -83,6 +83,8 @@
 		if (r == null)
 			return null;
+		currentAction.setText("Downloading OSM data...");
 		DataSet data = OsmReader.parseDataSet(r);
 		r.close();
+		activeConnection = null;
 		return data;
 	}
@@ -99,9 +101,9 @@
 		initAuthentication();
 		URL url = new URL(urlStr);
-		HttpURLConnection con = (HttpURLConnection)url.openConnection();
-		con.setConnectTimeout(20000);
-		if (con.getResponseCode() == 401 && isCancelled())
+		activeConnection = (HttpURLConnection)url.openConnection();
+		activeConnection.setConnectTimeout(15000);
+		if (isAuthCancelled() && activeConnection.getResponseCode() == 401)
 			return null;
-		return new InputStreamReader(con.getInputStream());
+		return new ProgressReader(activeConnection, progress);
 	}
 }
Index: /src/org/openstreetmap/josm/io/OsmServerWriter.java
===================================================================
--- /src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 91)
+++ /src/org/openstreetmap/josm/io/OsmServerWriter.java	(revision 92)
@@ -16,8 +16,9 @@
 import org.jdom.JDOMException;
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.osm.Segment;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
+import org.openstreetmap.josm.data.osm.Segment;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.data.osm.visitor.NameVisitor;
 import org.openstreetmap.josm.data.osm.visitor.Visitor;
 
@@ -44,5 +45,10 @@
 	 */
 	public Collection<OsmPrimitive> processed;
-	
+
+	/**
+	 * Whether the operation should be aborted as soon as possible.
+	 */
+	private boolean cancel = false;
+
 	/**
 	 * Send the dataset to the server. Ask the user first and does nothing if he
@@ -53,7 +59,17 @@
 		initAuthentication();
 
+		progress.setMaximum(list.size());
+		progress.setValue(0);
+
+		NameVisitor v = new NameVisitor();
 		try {
-			for (OsmPrimitive osm : list)
+			for (OsmPrimitive osm : list) {
+				if (cancel)
+					return;
+				osm.visit(v);
+				currentAction.setText("Upload "+v.className+" "+osm.id+"...");
 				osm.visit(this);
+				progress.setValue(progress.getValue()+1);
+			}
 		} catch (RuntimeException e) {
 			throw new JDOMException("An error occoured: ", e);
@@ -138,23 +154,23 @@
 			URL url = new URL(Main.pref.get("osm-server.url") + "/0.3/" + urlSuffix + "/" + osm.id);
 			System.out.println("upload to: "+url);
-			HttpURLConnection con = (HttpURLConnection) url.openConnection();
-			con.setConnectTimeout(20000);
-			con.setRequestMethod(requestMethod);
+			activeConnection = (HttpURLConnection) url.openConnection();
+			activeConnection.setConnectTimeout(15000);
+			activeConnection.setRequestMethod(requestMethod);
 			if (addBody)
-				con.setDoOutput(true);
-			con.connect();
+				activeConnection.setDoOutput(true);
+			activeConnection.connect();
 
 			if (addBody) {
-				Writer out = new OutputStreamWriter(con.getOutputStream());
+				Writer out = new OutputStreamWriter(activeConnection.getOutputStream());
 				OsmWriter.outputSingle(out, osm, true);
 				out.close();
 			}
 
-			int retCode = con.getResponseCode();
+			int retCode = activeConnection.getResponseCode();
 			if (retCode == 200 && osm.id == 0)
-				osm.id = readId(con.getInputStream());
+				osm.id = readId(activeConnection.getInputStream());
 			System.out.println("got return: "+retCode+" with id "+osm.id);
-			String retMsg = con.getResponseMessage();
-			con.disconnect();
+			String retMsg = activeConnection.getResponseMessage();
+			activeConnection.disconnect();
 			if (retCode == 410 && requestMethod.equals("DELETE"))
 				return; // everything fine.. was already deleted.
@@ -170,5 +186,6 @@
 			if (e instanceof RuntimeException)
 				throw (RuntimeException)e;
-			throw new RuntimeException(e.getMessage(), e);
+			if (!cancel)
+				throw new RuntimeException(e.getMessage(), e);
 		}
 	}
Index: /src/org/openstreetmap/josm/io/ProgressReader.java
===================================================================
--- /src/org/openstreetmap/josm/io/ProgressReader.java	(revision 92)
+++ /src/org/openstreetmap/josm/io/ProgressReader.java	(revision 92)
@@ -0,0 +1,38 @@
+package org.openstreetmap.josm.io;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.HttpURLConnection;
+
+import javax.swing.BoundedRangeModel;
+
+/**
+ * Read from an other reader and increment an progress counter while on the way.
+ * @author Imi
+ */
+public class ProgressReader extends Reader {
+
+	private final Reader in;
+	private final BoundedRangeModel progress;
+
+	public ProgressReader(HttpURLConnection con, BoundedRangeModel progress) throws IOException {
+		this.in = new InputStreamReader(con.getInputStream());
+		this.progress = progress;
+		int contentLength = con.getContentLength();
+		if (contentLength > 0)
+			progress.setMaximum(contentLength);
+		progress.setValue(0);
+    }
+
+	@Override public void close() throws IOException {
+		in.close();
+	}
+
+	@Override public int read(char[] cbuf, int off, int len) throws IOException {
+		int read = in.read(cbuf, off, len);
+		progress.setValue(progress.getValue()+read);
+		return read;
+	}
+
+}
