Ignore:
Timestamp:
2023-04-25T17:06:43+02:00 (3 years ago)
Author:
taylor.smock
Message:

Fix #22798: Convert dialog actions which extend AbstractAction to ones which extend JosmAction

This will allow users to bind shortcuts to actions they make frequently, such as
creating new relations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r18311 r18715  
    311311    }
    312312
    313     protected class OnOffAction extends AbstractAction implements ListSelectionListener {
     313    protected class OnOffAction extends JosmAction implements ListSelectionListener {
    314314        /**
    315315         * Constructs a new {@code OnOffAction}.
    316316         */
    317317        public OnOffAction() {
    318             putValue(NAME, tr("On/Off"));
    319             putValue(SHORT_DESCRIPTION, tr("Turn selected styles on or off"));
    320             new ImageProvider("apply").getResource().attachImageIcon(this, true);
     318            super(tr("On/Off"), "apply", tr("Turn selected styles on or off"),
     319                    Shortcut.registerShortcut("map:paint:style:on_off", tr("Filter: Add"), KeyEvent.VK_UNDEFINED, Shortcut.NONE),
     320                    false, false);
    321321            updateEnabledState();
    322322        }
    323323
     324        @Override
    324325        protected void updateEnabledState() {
    325326            setEnabled(!cbWireframe.isSelected() && tblStyles.getSelectedRowCount() > 0);
     
    342343     * The action to move down the currently selected entries in the list.
    343344     */
    344     protected class MoveUpDownAction extends AbstractAction implements ListSelectionListener {
     345    protected class MoveUpDownAction extends JosmAction implements ListSelectionListener {
    345346
    346347        private final int increment;
     
    351352         */
    352353        public MoveUpDownAction(boolean isDown) {
     354            super(isDown ? tr("Down") : tr("Up"), "dialogs/" + (isDown ? "down" : "up"),
     355                    isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up."),
     356                    isDown ? Shortcut.registerShortcut("map:paint:style:down", tr("Map Paint Styles: Move selected entry down"),
     357                            KeyEvent.VK_UNDEFINED, Shortcut.NONE)
     358                    : Shortcut.registerShortcut("map:paint:style:up", tr("Map Paint Styles: Move selected entry up"),
     359                            KeyEvent.VK_UNDEFINED, Shortcut.NONE),
     360                    false, false);
    353361            increment = isDown ? 1 : -1;
    354             putValue(NAME, isDown ? tr("Down") : tr("Up"));
    355             new ImageProvider("dialogs", isDown ? "down" : "up").getResource().attachImageIcon(this, true);
    356             putValue(SHORT_DESCRIPTION, isDown ? tr("Move the selected entry one row down.") : tr("Move the selected entry one row up."));
    357362            updateEnabledState();
    358363        }
    359364
     365        @Override
    360366        public void updateEnabledState() {
    361367            int[] sel = tblStyles.getSelectedRows();
Note: See TracChangeset for help on using the changeset viewer.