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

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

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

File size: 1.2 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;
7
8import org.openstreetmap.josm.tools.ImageProvider;
9
10/**
11 * Reverse the order of the relation members.
12 * @since 9496
13 */
14public class ReverseAction extends AbstractRelationEditorAction {
15        private static final long serialVersionUID = 1L;
16
17    /**
18     * Constructs a new {@code ReverseAction}.
19     * @param editorAccess
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.