source: josm/trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java@ 10300

Last change on this file since 10300 was 8061, checked in by bastiK, 9 years ago

see #11096 - strip .png

  • Property svn:eol-style set to native
File size: 2.5 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;
9
10import org.openstreetmap.josm.Main;
11import org.openstreetmap.josm.data.osm.DataSet;
12import org.openstreetmap.josm.gui.dialogs.OsmIdSelectionDialog;
13import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
14import org.openstreetmap.josm.io.OnlineResource;
15import org.openstreetmap.josm.tools.Shortcut;
16
17/**
18 * Display history information about OSM ways, nodes, or relations.
19 * @since 968
20 */
21public class HistoryInfoAction extends JosmAction {
22
23 /**
24 * Constructs a new {@code HistoryInfoAction}.
25 */
26 public HistoryInfoAction() {
27 super(tr("History"), "dialogs/history",
28 tr("Display history information about OSM ways, nodes, or relations."),
29 Shortcut.registerShortcut("core:historyinfo",
30 tr("History"), KeyEvent.VK_H, Shortcut.CTRL), false);
31 putValue("help", ht("/Action/ObjectHistory"));
32 putValue("toolbar", "action/historyinfo");
33 Main.toolbar.register(this);
34 setEnabled(true);
35 }
36
37 @Override
38 public void actionPerformed(ActionEvent ae) {
39 DataSet set = getCurrentDataSet();
40 if (set != null && !set.getAllSelected().isEmpty()) {
41 HistoryBrowserDialogManager.getInstance().showHistory(set.getAllSelected());
42 } else {
43 HistoryObjectIDDialog dialog = new HistoryObjectIDDialog();
44 if (dialog.showDialog().getValue() == dialog.getContinueButtonIndex()) {
45 HistoryBrowserDialogManager.getInstance().showHistory(dialog.getOsmIds());
46 }
47 }
48 }
49
50 /**
51 * Dialog allowing to choose object id if no one is selected.
52 * @since 6448
53 */
54 public static class HistoryObjectIDDialog extends OsmIdSelectionDialog {
55
56 /**
57 * Constructs a new {@code HistoryObjectIDDialog}.
58 */
59 public HistoryObjectIDDialog() {
60 super(Main.parent, tr("Show history"), new String[]{tr("Show history"), tr("Cancel")});
61 setButtonIcons(new String[]{"dialogs/history", "cancel"});
62 init();
63 }
64
65 @Override
66 public void setupDialog() {
67 super.setupDialog();
68 buttons.get(0).setEnabled(!Main.isOffline(OnlineResource.OSM_API));
69 }
70 }
71}
Note: See TracBrowser for help on using the repository browser.