[6336] | 1 | // License: GPL. For details, see LICENSE file.
|
---|
[2512] | 2 | package org.openstreetmap.josm.actions;
|
---|
| 3 |
|
---|
[7859] | 4 | import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
|
---|
[2512] | 5 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
| 6 |
|
---|
[7859] | 7 | import java.awt.event.ActionEvent;
|
---|
[2512] | 8 | import java.awt.event.KeyEvent;
|
---|
[7859] | 9 | import java.util.Collection;
|
---|
[2512] | 10 |
|
---|
[4408] | 11 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
[2512] | 12 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
[4408] | 13 | import org.openstreetmap.josm.gui.dialogs.InspectPrimitiveDialog;
|
---|
[2512] | 14 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
| 15 |
|
---|
[7859] | 16 | /**
|
---|
| 17 | * Display advanced object information about OSM nodes, ways, or relations.
|
---|
| 18 | * @since 1697
|
---|
| 19 | */
|
---|
[4408] | 20 | public class InfoAction extends JosmAction {
|
---|
[2512] | 21 |
|
---|
[6336] | 22 | /**
|
---|
| 23 | * Constructs a new {@code InfoAction}.
|
---|
| 24 | */
|
---|
[2512] | 25 | public InfoAction() {
|
---|
[7771] | 26 | super(tr("Advanced info"), "info",
|
---|
[4942] | 27 | tr("Display advanced object information about OSM nodes, ways, or relations."),
|
---|
| 28 | Shortcut.registerShortcut("core:info",
|
---|
[4982] | 29 | tr("Advanced info"), KeyEvent.VK_I, Shortcut.CTRL),
|
---|
[4942] | 30 | true, "action/info", true);
|
---|
[3761] | 31 | putValue("help", ht("/Action/InfoAboutElements"));
|
---|
[2512] | 32 | }
|
---|
| 33 |
|
---|
| 34 | @Override
|
---|
[4408] | 35 | public void actionPerformed(ActionEvent ae) {
|
---|
[13434] | 36 | DataSet set = getLayerManager().getActiveDataSet();
|
---|
[5925] | 37 | if (set != null) {
|
---|
[12672] | 38 | new InspectPrimitiveDialog(set.getAllSelected(), set).showDialog();
|
---|
[5925] | 39 | }
|
---|
[2512] | 40 | }
|
---|
[4408] | 41 |
|
---|
| 42 | @Override
|
---|
| 43 | public void updateEnabledState() {
|
---|
[13434] | 44 | updateEnabledStateOnCurrentSelection(true);
|
---|
[4408] | 45 | }
|
---|
| 46 |
|
---|
| 47 | @Override
|
---|
| 48 | protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
|
---|
| 49 | setEnabled(!selection.isEmpty());
|
---|
| 50 | }
|
---|
[2512] | 51 | }
|
---|