Changeset 5477 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2012-08-25T21:04:25+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r5456 r5477 34 34 } 35 35 36 protected GpxLayer getLayer() { 37 if (!Main.isDisplayingMapView()) return null; 38 if (Main.map.mapView.getActiveLayer() == null) return null; 36 /** 37 * Get the layer to export. 38 * @return The layer to export, either a {@link GpxLayer} or {@link OsmDataLayer}. 39 */ 40 protected Layer getLayer() { 41 if(!Main.isDisplayingMapView()) 42 return null; 39 43 Layer layer = Main.map.mapView.getActiveLayer(); 40 if (! (layer instanceof GpxLayer)) return null; 41 return (GpxLayer)layer; 44 return (layer instanceof GpxLayer || layer instanceof OsmDataLayer) ? layer : null; 42 45 } 43 46 … … 45 48 if (!isEnabled()) 46 49 return; 47 GpxLayer layer = getLayer();50 Layer layer = getLayer(); 48 51 if (layer == null) { 49 52 JOptionPane.showMessageDialog( … … 95 98 @Override 96 99 protected void updateEnabledState() { 97 boolean check = 98 Main.isDisplayingMapView() 99 && Main.map.mapView.getActiveLayer() != null; 100 if(!check) { 101 setEnabled(false); 102 return; 103 } 104 Layer layer = Main.map.mapView.getActiveLayer(); 105 setEnabled(layer instanceof GpxLayer); 100 setEnabled(getLayer() != null); 106 101 } 107 102 }
Note:
See TracChangeset
for help on using the changeset viewer.