source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/MoveDownAction.java @ 14027

Last change on this file since 14027 was 14027, checked in by michael2402, 5 months ago

See #16388: New mechanism for plugins to register relation editor actions.

File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.dialogs.relation.actions;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.event.ActionEvent;
7import java.awt.event.KeyEvent;
8
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.tools.ImageProvider;
11import org.openstreetmap.josm.tools.Shortcut;
12
13/**
14 * Move the currently selected members down.
15 * @since 9496
16 */
17public class MoveDownAction extends AbstractRelationEditorAction {
18        private static final long serialVersionUID = 1L;
19
20    /**
21     * Constructs a new {@code MoveDownAction}.
22     * @param memberTable member table
23     * @param memberTableModel member table model
24     * @param actionMapKey action map key
25     */
26    public MoveDownAction(IRelationEditorActionAccess editorAccess, String actionMapKey) {
27        super(editorAccess, actionMapKey, IRelationEditorUpdateOn.MEMBER_TABLE_SELECTION);
28        new ImageProvider("dialogs", "movedown").getResource().attachImageIcon(this, true);
29        Shortcut sc = Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"), KeyEvent.VK_DOWN, Shortcut.ALT);
30        sc.setAccelerator(this);
31        putValue(SHORT_DESCRIPTION, Main.platform.makeTooltip(tr("Move the currently selected members down"), sc));
32        setEnabled(false);
33    }
34
35    @Override
36    public void actionPerformed(ActionEvent e) {
37        editorAccess.getMemberTableModel().moveDown(editorAccess.getMemberTable().getSelectedRows());
38    }
39
40    @Override
41    protected void updateEnabledState() {
42        setEnabled(editorAccess.getMemberTableModel().canMoveDown(editorAccess.getMemberTable().getSelectedRows()));
43    }
44}
Note: See TracBrowser for help on using the repository browser.