| 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.data.osm.OsmData;
|
|---|
| 12 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
|---|
| 13 | import org.openstreetmap.josm.gui.dialogs.InspectPrimitiveDialog;
|
|---|
| 14 | import org.openstreetmap.josm.tools.Shortcut;
|
|---|
| 15 |
|
|---|
| 16 | /**
|
|---|
| 17 | * Display advanced object information about OSM nodes, ways, or relations.
|
|---|
| 18 | * @since 1697
|
|---|
| 19 | */
|
|---|
| 20 | public class InfoAction extends JosmAction {
|
|---|
| 21 |
|
|---|
| 22 | /**
|
|---|
| 23 | * Constructs a new {@code InfoAction}.
|
|---|
| 24 | */
|
|---|
| 25 | public InfoAction() {
|
|---|
| 26 | super(tr("Advanced info"), "info",
|
|---|
| 27 | tr("Display advanced object information about OSM nodes, ways, or relations."),
|
|---|
| 28 | Shortcut.registerShortcut("core:info",
|
|---|
| 29 | tr("View: {0}", tr("Advanced info")), KeyEvent.VK_I, Shortcut.CTRL),
|
|---|
| 30 | true, "action/info", true);
|
|---|
| 31 | setHelpId(ht("/Action/InfoAboutElements"));
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | @Override
|
|---|
| 35 | public void actionPerformed(ActionEvent ae) {
|
|---|
| 36 | OsmData<?, ?, ?, ?> set = getLayerManager().getActiveData();
|
|---|
| 37 | if (set != null) {
|
|---|
| 38 | new InspectPrimitiveDialog(set.getAllSelected(), set).showDialog();
|
|---|
| 39 | }
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | @Override
|
|---|
| 43 | public void updateEnabledState() {
|
|---|
| 44 | updateEnabledStateOnCurrentSelection(true);
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | @Override
|
|---|
| 48 | protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
|
|---|
| 49 | setEnabled(!selection.isEmpty());
|
|---|
| 50 | }
|
|---|
| 51 | }
|
|---|