Changeset 6034 in josm


Ignore:
Timestamp:
2013-06-27T01:36:33+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8823 - enable map paint styles switching with GPX layers

File:
1 edited

Legend:

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

    r5927 r6034  
    1515import org.openstreetmap.josm.gui.dialogs.MapPaintDialog;
    1616import org.openstreetmap.josm.gui.dialogs.MapPaintDialog.LaunchMapPaintPreferencesAction;
     17import org.openstreetmap.josm.gui.layer.GpxLayer;
     18import org.openstreetmap.josm.gui.layer.Layer;
    1719import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.MapPaintSylesUpdateListener;
    1820import org.openstreetmap.josm.gui.util.StayOpenCheckBoxMenuItem;
    1921import org.openstreetmap.josm.tools.ImageProvider;
    2022
     23/**
     24 * The View -> Map Paint Styles menu
     25 * @since 5086
     26 */
    2127public class MapPaintMenu extends JMenu implements MapPaintSylesUpdateListener {
    2228
     
    5864        @Override
    5965        public void updateEnabledState() {
    60             setEnabled(Main.isDisplayingMapView() && Main.main.getEditLayer() != null);
     66            setEnabled(Main.isDisplayingMapView() && (Main.main.getEditLayer() != null || mapHasGpxLayer()));
     67        }
     68
     69        private boolean mapHasGpxLayer() {
     70            for (Layer layer : Main.map.mapView.getAllLayers()) {
     71                if (layer instanceof GpxLayer) {
     72                    return true;
     73                }
     74            }
     75            return false;
    6176        }
    6277    }
     
    6984    };
    7085
     86    /**
     87     * Constructs a new {@code MapPaintMenu}
     88     */
    7189    public MapPaintMenu() {
    7290        super(tr("Map Paint Styles"));
Note: See TracChangeset for help on using the changeset viewer.