Changeset 14912 in josm


Ignore:
Timestamp:
2019-03-21T08:58:02+01:00 (9 months ago)
Author:
GerdP
Message:

see #17469: add shortcut Shift+Minus for "Ignore for now" action

File:
1 edited

Legend:

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

    r14894 r14912  
    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;
     
    8687
    8788    /** The display tree */
    88     public ValidatorTreePanel tree;
     89    public final ValidatorTreePanel tree;
    8990
    9091    /** The validate action */
     
    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             }
    125 
    126             @Override
    127             public void actionPerformed(ActionEvent e) {
    128                 TestError error = getSelectedError();
    129                 error.setIgnored(true);
    130                 tree.resetErrors();
    131             }
    132         };
    133 
    134         popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get("problem"));
    135         popupMenuHandler.addAction(new EditRelationAction());
    136         popupMenuHandler.addAction(removeProblemAction);
    137 
    138120        tree = new ValidatorTreePanel();
    139121        tree.addMouseListener(new MouseEventHandler());
    140122        addTreeSelectionListener(new SelectionWatch());
    141123        InputMapUtils.unassignCtrlShiftUpDown(tree, JComponent.WHEN_FOCUSED);
     124
     125        JosmAction ignoreForNowAction = new JosmAction(tr("Ignore for now"), "dialogs/delete",
     126                tr("Ignore and remove from tree."), Shortcut.registerShortcut("tools:validate:ignore-for-now",
     127                        tr("Ignore and remove from tree."), KeyEvent.VK_MINUS, Shortcut.SHIFT),
     128                false, false) {
     129
     130            @Override
     131            public void actionPerformed(ActionEvent e) {
     132                TestError error = getSelectedError();
     133                if (error != null) {
     134                    error.setIgnored(true);
     135                    tree.resetErrors();
     136                    invalidateValidatorLayers();
     137                }
     138            }
     139        };
     140
     141        popupMenuHandler.addAction(MainApplication.getMenu().autoScaleActions.get("problem"));
     142        popupMenuHandler.addAction(new EditRelationAction());
     143        popupMenuHandler.addAction(ignoreForNowAction);
    142144
    143145        List<SideButton> buttons = new LinkedList<>();
Note: See TracChangeset for help on using the changeset viewer.