Ignore:
Timestamp:
2020-05-27T11:16:39+02:00 (4 years ago)
Author:
GerdP
Message:

see #19296: Actions should avoid to install listeners which are not needed

  • either don't call installAdapters() or overwrite listenToSelectionChange()
  • partly reverts previous changes so that installAdapters() is not overwritten

One has to be careful because installAdapters() also calls initEnabledState()

File:
1 edited

Legend:

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

    r16411 r16509  
    5656        super(tr("Jump to Position"), (ImageProvider) null, tr("Opens a dialog that allows to jump to a specific location"),
    5757                Shortcut.registerShortcut("tools:jumpto", tr("Tool: {0}", tr("Jump to Position")),
    58                         KeyEvent.VK_J, Shortcut.CTRL), true, "action/jumpto", true);
     58                        KeyEvent.VK_J, Shortcut.CTRL), true, "action/jumpto", false);
     59        // make this action listen to mapframe change events
     60        MainApplication.addMapFrameListener((o, n) -> updateEnabledState());
     61
    5962        setHelpId(ht("/Action/JumpToPosition"));
    6063    }
     
    242245        setEnabled(MainApplication.isDisplayingMapView());
    243246    }
    244 
    245     @Override
    246     protected void installAdapters() {
    247         super.installAdapters();
    248         // make this action listen to mapframe change events
    249         MainApplication.addMapFrameListener((o, n) -> updateEnabledState());
    250     }
    251247}
Note: See TracChangeset for help on using the changeset viewer.