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

Last change on this file since 9804 was 7859, checked in by Don-vip, 9 years ago

fix various Sonar issues, improve Javadoc

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
5import static org.openstreetmap.josm.tools.I18n.tr;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9import java.util.Collection;
10
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
17/**
18 * Display advanced object information about OSM nodes, ways, or relations.
19 * @since 1697
20 */
21public class InfoAction extends JosmAction {
22
23 /**
24 * Constructs a new {@code InfoAction}.
25 */
26 public InfoAction() {
27 super(tr("Advanced info"), "info",
28 tr("Display advanced object information about OSM nodes, ways, or relations."),
29 Shortcut.registerShortcut("core:info",
30 tr("Advanced info"), KeyEvent.VK_I, Shortcut.CTRL),
31 true, "action/info", true);
32 putValue("help", ht("/Action/InfoAboutElements"));
33 }
34
35 @Override
36 public void actionPerformed(ActionEvent ae) {
37 DataSet set = getCurrentDataSet();
38 if (set != null) {
39 new InspectPrimitiveDialog(set.getAllSelected(), Main.main.getEditLayer()).showDialog();
40 }
41 }
42
43 @Override
44 public void updateEnabledState() {
45 if (getCurrentDataSet() == null) {
46 setEnabled(false);
47 } else {
48 updateEnabledState(getCurrentDataSet().getAllSelected());
49 }
50 }
51
52 @Override
53 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
54 setEnabled(!selection.isEmpty());
55 }
56}
Note: See TracBrowser for help on using the repository browser.