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

Last change on this file since 10420 was 10413, checked in by Don-vip, 8 years ago

fix #12983 - replace calls to Main.main.get[Active|Edit]Layer() by Main.getLayerManager().get[Active|Edit]Layer() - gsoc-core

  • Property svn:eol-style set to native
File size: 1.8 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 = getLayerManager().getEditDataSet();
38 if (set != null) {
39 new InspectPrimitiveDialog(set.getAllSelected(), Main.getLayerManager().getEditLayer()).showDialog();
40 }
41 }
42
43 @Override
44 public void updateEnabledState() {
45 DataSet ds = getLayerManager().getEditDataSet();
46 if (ds == null) {
47 setEnabled(false);
48 } else {
49 updateEnabledState(ds.getAllSelected());
50 }
51 }
52
53 @Override
54 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
55 setEnabled(!selection.isEmpty());
56 }
57}
Note: See TracBrowser for help on using the repository browser.