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

Last change on this file since 12346 was 10548, checked in by simon04, 8 years ago

Remove duplicated code

Use updateEnabledStateOnCurrentSelection introduced r10409

  • 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 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 updateEnabledStateOnCurrentSelection();
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.