Ticket #17469: 17469-shortcut.patch

File 17469-shortcut.patch, 2.0 KB (added by GerdP, 7 years ago)

Allow to bind shortcut to "Ignore for now" action

  • src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java

     
    3030
    3131import org.openstreetmap.josm.actions.AbstractSelectAction;
    3232import org.openstreetmap.josm.actions.AutoScaleAction;
     33import org.openstreetmap.josm.actions.JosmAction;
    3334import org.openstreetmap.josm.actions.ValidateAction;
    3435import org.openstreetmap.josm.actions.relation.EditRelationAction;
    3536import org.openstreetmap.josm.command.Command;
     
    116117                Shortcut.registerShortcut("subwindow:validator", tr("Toggle: {0}", tr("Validation Results")),
    117118                        KeyEvent.VK_V, Shortcut.ALT_SHIFT), 150, false, ValidatorPreference.class);
    118119
    119         Action removeProblemAction = new AbstractAction() {
    120             {
    121                 putValue(NAME, tr("Ignore for now"));
    122                 putValue(SHORT_DESCRIPTION, tr("Ignore and remove from tree."));
    123                 new ImageProvider("dialogs", "delete").getResource().attachImageIcon(this, true);
    124             }
     120        JosmAction removeProblemAction = new JosmAction(
     121            tr("Ignore for now"),
     122            "dialogs/delete",
     123            tr("Ignore and remove from tree."),
     124            Shortcut.registerShortcut("tools:validate:ignore-for-now",
     125                    tr("Ignore and remove from tree."),
     126                    KeyEvent.VK_I, Shortcut.CTRL_SHIFT),
     127            false, false) {
    125128
    126129            @Override
    127130            public void actionPerformed(ActionEvent e) {
    128131                TestError error = getSelectedError();
    129                 error.setIgnored(true);
    130                 tree.resetErrors();
     132                if (error != null) {
     133                    error.setIgnored(true);
     134                    tree.resetErrors();
     135                    invalidateValidatorLayers();
     136                }
    131137            }
    132138        };
    133139