source: josm/trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SortAction.java@ 14138

Last change on this file since 14138 was 14138, checked in by Don-vip, 6 years ago

see #15229 - deprecate Main.platform and related methods - new class PlatformManager

File size: 1.5 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.tools.ImageProvider;
10import org.openstreetmap.josm.tools.PlatformManager;
11import org.openstreetmap.josm.tools.Shortcut;
12
13/**
14 * Sort the relation members
15 * @since 9496
16 */
17public class SortAction extends AbstractRelationEditorAction {
18 private static final long serialVersionUID = 1L;
19
20 /**
21 * Constructs a new {@code SortAction}.
22 * @param editorAccess An interface to access the relation editor contents.
23 */
24 public SortAction(IRelationEditorActionAccess editorAccess) {
25 super(editorAccess, IRelationEditorUpdateOn.MEMBER_TABLE_CHANGE);
26 new ImageProvider("dialogs", "sort").getResource().attachImageIcon(this, true);
27 putValue(NAME, tr("Sort"));
28 Shortcut sc = Shortcut.registerShortcut("relationeditor:sort", tr("Relation Editor: Sort"), KeyEvent.VK_END, Shortcut.ALT);
29 sc.setAccelerator(this);
30 putValue(SHORT_DESCRIPTION, PlatformManager.getPlatform().makeTooltip(tr("Sort the relation members"), sc));
31 updateEnabledState();
32 }
33
34 @Override
35 public void actionPerformed(ActionEvent e) {
36 editorAccess.getMemberTableModel().sort();
37 }
38
39 @Override
40 protected void updateEnabledState() {
41 setEnabled(editorAccess.getMemberTableModel().getRowCount() > 0);
42 }
43}
Note: See TracBrowser for help on using the repository browser.