Line | |
---|
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 |
|
---|
8 | import org.openstreetmap.josm.tools.ImageProvider;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Reverse the order of the relation members.
|
---|
12 | * @since 9496
|
---|
13 | */
|
---|
14 | public class ReverseAction extends AbstractRelationEditorAction {
|
---|
15 | private static final long serialVersionUID = 1L;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Constructs a new {@code ReverseAction}.
|
---|
19 | * @param editorAccess An interface to access the relation editor contents.
|
---|
20 | */
|
---|
21 | public ReverseAction(IRelationEditorActionAccess editorAccess) {
|
---|
22 | super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE);
|
---|
23 |
|
---|
24 | putValue(SHORT_DESCRIPTION, tr("Reverse the order of the relation members"));
|
---|
25 | new ImageProvider("dialogs/relation", "reverse").getResource().attachImageIcon(this, true);
|
---|
26 | putValue(NAME, tr("Reverse"));
|
---|
27 | updateEnabledState();
|
---|
28 | }
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void actionPerformed(ActionEvent e) {
|
---|
32 | editorAccess.getMemberTableModel().reverse();
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | protected void updateEnabledState() {
|
---|
37 | setEnabled(editorAccess.getMemberTableModel().getRowCount() > 0);
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.