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