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

Last change on this file since 6798 was 6449, checked in by Don-vip, 10 years ago

see #3626 - fix history of selected primitives

  • Property svn:eol-style set to native
File size: 2.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions;
3
4import java.awt.event.ActionEvent;
5import java.awt.event.KeyEvent;
6
7import org.openstreetmap.josm.Main;
8import org.openstreetmap.josm.data.osm.DataSet;
9import org.openstreetmap.josm.gui.dialogs.OsmIdSelectionDialog;
10import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
11import org.openstreetmap.josm.tools.Shortcut;
12
13import static org.openstreetmap.josm.tools.I18n.tr;
14import static org.openstreetmap.josm.gui.help.HelpUtil.ht;
15
16/**
17 * Display history information about OSM ways, nodes, or relations.
18 * @since 968
19 */
20public class HistoryInfoAction extends JosmAction {
21
22 /**
23 * Constructs a new {@code HistoryInfoAction}.
24 */
25 public HistoryInfoAction() {
26 super(tr("History"), "about",
27 tr("Display history information about OSM ways, nodes, or relations."),
28 Shortcut.registerShortcut("core:historyinfo",
29 tr("History"), KeyEvent.VK_H, Shortcut.CTRL), false);
30 putValue("help", ht("/Action/ObjectHistory"));
31 putValue("toolbar", "action/historyinfo");
32 Main.toolbar.register(this);
33 setEnabled(true);
34 }
35
36 @Override
37 public void actionPerformed(ActionEvent ae) {
38 DataSet set = getCurrentDataSet();
39 if (set != null && !set.getAllSelected().isEmpty()) {
40 HistoryBrowserDialogManager.getInstance().showHistory(set.getAllSelected());
41 } else {
42 HistoryObjectIDDialog dialog = new HistoryObjectIDDialog();
43 if (dialog.showDialog().getValue() == dialog.getContinueButtonIndex()) {
44 HistoryBrowserDialogManager.getInstance().showHistory(dialog.getOsmIds());
45 }
46 }
47 }
48
49 /**
50 * Dialog allowing to choose object id if no one is selected.
51 * @since 6448
52 */
53 public static class HistoryObjectIDDialog extends OsmIdSelectionDialog {
54
55 /**
56 * Constructs a new {@code HistoryObjectIDDialog}.
57 */
58 public HistoryObjectIDDialog() {
59 super(Main.parent, tr("Show history"), new String[]{tr("Show history"), tr("Cancel")});
60 setButtonIcons(new String[]{"dialogs/history.png", "cancel.png"});
61 init();
62 }
63 }
64}
Note: See TracBrowser for help on using the repository browser.