source: josm/trunk/src/org/openstreetmap/josm/actions/InfoAction.java@ 4408

Last change on this file since 4408 was 4408, checked in by simon04, 13 years ago

fix #6773 - shortcuts for History and Advanced info dialog

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1//License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.actions;
3
4import java.awt.event.ActionEvent;
5import static org.openstreetmap.josm.tools.I18n.tr;
6import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
7
8import java.awt.event.KeyEvent;
9
10import java.util.Collection;
11import org.openstreetmap.josm.Main;
12import org.openstreetmap.josm.data.osm.DataSet;
13import org.openstreetmap.josm.data.osm.OsmPrimitive;
14import org.openstreetmap.josm.gui.dialogs.InspectPrimitiveDialog;
15import org.openstreetmap.josm.tools.Shortcut;
16
17public class InfoAction extends JosmAction {
18
19 public InfoAction() {
20 super(tr("Advanced info"), "about",
21 tr("Display advanced object information about OSM nodes, ways, or relations."),
22 Shortcut.registerShortcut("core:info",
23 tr("Advanced info"), KeyEvent.VK_I, Shortcut.GROUP_HOTKEY), false);
24 putValue("help", ht("/Action/InfoAboutElements"));
25 putValue("toolbar", "action/info");
26 Main.toolbar.register(this);
27 }
28
29 @Override
30 public void actionPerformed(ActionEvent ae) {
31 DataSet set = getCurrentDataSet();
32 if (set != null) {
33 new InspectPrimitiveDialog(set.getSelected(), Main.map.mapView.getEditLayer()).showDialog();
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.