Changeset 5415 in josm


Ignore:
Timestamp:
2012-08-10T00:53:55+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #7936 - Validator dialog is not updated when the active edit layer is deleted

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r5300 r5415  
    296296    @Override
    297297    public void layerRemoved(Layer oldLayer) {
    298         if (oldLayer instanceof OsmDataLayer && Main.map.mapView.getActiveLayer() == oldLayer) {
    299             Main.map.validatorDialog.tree.setErrorList(new ArrayList<TestError>());
    300         }
    301298        if (oldLayer == errorLayer) {
    302299            errorLayer = null;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

    r5360 r5415  
    8585    private DefaultMutableTreeNode lastSelectedNode = null;
    8686
     87    private OsmDataLayer linkedLayer;
     88
    8789    /**
    8890     * Constructor
     
    367369            }
    368370        }
    369         Main.main.getCurrentDataSet().setSelected(sel);
     371        DataSet ds = Main.main.getCurrentDataSet();
     372        if (ds != null) {
     373            ds.setSelected(sel);
     374        }
    370375    }
    371376
     
    427432    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    428433        if (newLayer instanceof OsmDataLayer) {
    429             tree.setErrorList(((OsmDataLayer) newLayer).validationErrors);
     434            linkedLayer = (OsmDataLayer)newLayer;
     435            tree.setErrorList(linkedLayer.validationErrors);
    430436        }
    431437    }
     
    435441
    436442    @Override
    437     public void layerRemoved(Layer oldLayer) {}
     443    public void layerRemoved(Layer oldLayer) {
     444        if (oldLayer == linkedLayer) {
     445            tree.setErrorList(new ArrayList<TestError>());
     446        }
     447    }
    438448
    439449    /**
Note: See TracChangeset for help on using the changeset viewer.