source: josm/trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java @ 5241

Revision 4982, 1.5 KB checked in by stoecker, 3 months ago (diff)

see #7226 - patch by akks (fixed a bit) - fix shortcut deprecations

  • Property svn:eol-style set to native
Line 
1//License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.actions;
3
4import java.awt.event.ActionEvent;
5import java.awt.event.KeyEvent;
6import java.util.Collection;
7
8import org.openstreetmap.josm.Main;
9import org.openstreetmap.josm.data.osm.DataSet;
10import org.openstreetmap.josm.data.osm.OsmPrimitive;
11import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
12import org.openstreetmap.josm.tools.Shortcut;
13
14import static org.openstreetmap.josm.tools.I18n.tr;
15import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
16
17public class HistoryInfoAction extends JosmAction {
18
19        public HistoryInfoAction() {
20                super(tr("History"), "about",
21                                tr("Display history information about OSM ways, nodes, or relations."),
22                                Shortcut.registerShortcut("core:historyinfo",
23                                tr("History"), KeyEvent.VK_H, Shortcut.CTRL), false);
24                putValue("help", ht("/Action/ObjectHistory"));
25                putValue("toolbar", "action/historyinfo");
26                Main.toolbar.register(this);
27        }
28
29        @Override
30        public void actionPerformed(ActionEvent ae) {
31                DataSet set = getCurrentDataSet();
32                if (set != null) {
33                        HistoryBrowserDialogManager.getInstance().showHistory(set.getSelected());
34                }
35        }
36
37        @Override
38        public void updateEnabledState() {
39                if (getCurrentDataSet() == null) {
40                        setEnabled(false);
41                } else {
42                        updateEnabledState(getCurrentDataSet().getSelected());
43                }
44        }
45
46        @Override
47        protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
48                setEnabled(!selection.isEmpty());
49        }
50}
Note: See TracBrowser for help on using the repository browser.