Ignore:
Timestamp:
2009-07-19T10:31:27+02:00 (15 years ago)
Author:
Gubaer
Message:

improved enabling/disabling of menu entries and action buttons depending on current state of JOSM (number of open layers, type of active layer, etc.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r1797 r1808  
    210210     */
    211211    public void removeLayer(Layer layer) {
     212        if (layer == activeLayer) {
     213            if (layer instanceof OsmDataLayer) {
     214                Main.ds = null;
     215            }
     216            activeLayer = null;
     217        }
    212218        if (layers.remove(layer)) {
    213219            for (Layer.LayerChangeListener l : Layer.listeners) {
    214220                l.layerRemoved(layer);
    215             }
    216         }
    217         if (layer == activeLayer) {
    218             if (layer instanceof OsmDataLayer) {
    219                 Main.ds = null;
    220221            }
    221222        }
     
    419420        // workaround for #1461 (zoom to download bounding box instead of all data)
    420421        // In case we already have an existing data layer ...
    421         Collection<DataSource> dataSources = Main.main.createOrGetEditLayer().data.dataSources;
     422        OsmDataLayer layer= getEditLayer();
     423        if (layer == null)
     424            return false;
     425        Collection<DataSource> dataSources = layer.data.dataSources;
    422426        // ... with bounding box[es] of data loaded from OSM or a file...
    423427        BoundingXYVisitor bbox = new BoundingXYVisitor();
Note: See TracChangeset for help on using the changeset viewer.