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

Last change on this file since 7206 was 6336, checked in by Don-vip, 10 years ago

code cleanup / robustness in edit layer handling

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
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 /**
20 * Constructs a new {@code InfoAction}.
21 */
22 public InfoAction() {
23 super(tr("Advanced info"), "about",
24 tr("Display advanced object information about OSM nodes, ways, or relations."),
25 Shortcut.registerShortcut("core:info",
26 tr("Advanced info"), KeyEvent.VK_I, Shortcut.CTRL),
27 true, "action/info", true);
28 putValue("help", ht("/Action/InfoAboutElements"));
29 }
30
31 @Override
32 public void actionPerformed(ActionEvent ae) {
33 DataSet set = getCurrentDataSet();
34 if (set != null) {
35 new InspectPrimitiveDialog(set.getAllSelected(), Main.main.getEditLayer()).showDialog();
36 }
37 }
38
39 @Override
40 public void updateEnabledState() {
41 if (getCurrentDataSet() == null) {
42 setEnabled(false);
43 } else {
44 updateEnabledState(getCurrentDataSet().getAllSelected());
45 }
46 }
47
48 @Override
49 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
50 setEnabled(!selection.isEmpty());
51 }
52}
Note: See TracBrowser for help on using the repository browser.