Ticket #2917: select-existing-edit-layer.patch
File select-existing-edit-layer.patch, 1.3 KB (added by , 16 years ago) |
---|
-
src/org/openstreetmap/josm/Main.java
227 227 } 228 228 /** 229 229 * Replies the current edit layer. Creates one if no {@see OsmDataLayer} 230 * exists. Replies null, if the currently active layer isn't an instance 231 * of {@see OsmDataLayer}. 230 * exists. 232 231 * 233 232 * @return the current edit layer 234 233 */ 235 234 public final OsmDataLayer createOrGetEditLayer() { 236 if (map == null || map.mapView.getEditLayer() == null) { 235 OsmDataLayer osmDataLayer = null; 236 if ((map != null) && 237 ((osmDataLayer = map.mapView.getEditLayer()) == null)) { 238 for (Layer layer : Main.map.mapView.getAllLayers()) { 239 if (layer instanceof OsmDataLayer) { 240 osmDataLayer = (OsmDataLayer) layer; 241 break; 242 } 243 } 244 } 245 if (osmDataLayer == null) { 237 246 menu.newAction.actionPerformed(null); 247 osmDataLayer = map.mapView.getEditLayer(); 238 248 } 239 return map.mapView.getEditLayer(); 249 250 return osmDataLayer; 240 251 } 241 252 242 253 /**