1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
---|
5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
6 |
|
---|
7 | import java.awt.event.ActionEvent;
|
---|
8 | import java.awt.event.KeyEvent;
|
---|
9 | import java.util.Collection;
|
---|
10 |
|
---|
11 | import org.openstreetmap.josm.Main;
|
---|
12 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
13 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
14 | import org.openstreetmap.josm.gui.dialogs.InspectPrimitiveDialog;
|
---|
15 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Display advanced object information about OSM nodes, ways, or relations.
|
---|
19 | * @since 1697
|
---|
20 | */
|
---|
21 | public 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 | updateEnabledStateOnCurrentSelection();
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override
|
---|
49 | protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
|
---|
50 | setEnabled(!selection.isEmpty());
|
---|
51 | }
|
---|
52 | }
|
---|