Ignore:
Timestamp:
2009-07-21T19:52:53+02:00 (15 years ago)
Author:
Gubaer
Message:

JosmAction is now a LayerChangeListener and a SelectionChangeListener
updated all JosmActions
fixed #3018: Make sure tools menu entries (and actions) are deactivated when no layer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r1814 r1820  
    2323import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2424import org.openstreetmap.josm.gui.ExtendedDialog;
    25 import org.openstreetmap.josm.gui.layer.Layer;
    26 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
    2725import org.openstreetmap.josm.tools.GBC;
    2826import org.openstreetmap.josm.tools.Shortcut;
    2927
    30 public class SearchAction extends JosmAction implements LayerChangeListener{
     28public class SearchAction extends JosmAction{
    3129
    3230    public static final int SEARCH_HISTORY_SIZE = 10;
     
    4341        super(tr("Search..."), "dialogs/search", tr("Search for objects."),
    4442                Shortcut.registerShortcut("system:find", tr("Search..."), KeyEvent.VK_F, Shortcut.GROUP_HOTKEY), true);
    45         Layer.listeners.add(this);
    46         refreshEnabled();
    4743    }
    4844
     
    240236     *
    241237     */
    242     protected void refreshEnabled() {
     238    @Override
     239    protected void updateEnabledState() {
    243240        setEnabled(getEditLayer() != null);
    244241    }
    245 
    246     /* ---------------------------------------------------------------------------------- */
    247     /* Interface LayerChangeListener                                                      */
    248     /* ---------------------------------------------------------------------------------- */
    249     public void activeLayerChange(Layer oldLayer, Layer newLayer) {
    250         refreshEnabled();
    251     }
    252 
    253     public void layerAdded(Layer newLayer) {
    254         refreshEnabled();
    255     }
    256 
    257     public void layerRemoved(Layer oldLayer) {
    258         refreshEnabled();
    259     }
    260242}
Note: See TracChangeset for help on using the changeset viewer.