Index: trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
===================================================================
--- trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 5023)
+++ trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java	(revision 5024)
@@ -7,4 +7,6 @@
 import java.util.Collection;
 import java.util.concurrent.Future;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.openstreetmap.josm.Main;
@@ -35,4 +37,6 @@
     
     protected OsmDataLayer targetLayer;
+    
+    protected String newLayerName = null;
 
     protected void rememberDownloadedData(DataSet ds) {
@@ -64,4 +68,7 @@
                 progressMonitor);
         currentBounds = null;
+        // Extract .osm filename from URL to set the new layer name
+        Matcher matcher = Pattern.compile("http://.*/(.*\\.osm)").matcher(url);
+        newLayerName = matcher.matches() ? matcher.group(1) : null;
         return Main.worker.submit(downloadTask);
     }
@@ -150,6 +157,13 @@
         }
         
+        protected OsmDataLayer createNewLayer(String layerName) {
+            if (layerName == null || layerName.isEmpty()) {
+                layerName = OsmDataLayer.createNewName();
+            }
+            return new OsmDataLayer(dataSet, layerName, null);
+        }
+        
         protected OsmDataLayer createNewLayer() {
-            return new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
+            return createNewLayer(null);
         }
 
@@ -172,5 +186,5 @@
                 // or it is not clear which layer to merge to
                 //
-                targetLayer = createNewLayer();
+                targetLayer = createNewLayer(newLayerName);
                 final boolean isDisplayingMapView = Main.isDisplayingMapView();
 
