1 | //License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.actions;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
5 |
|
---|
6 | import java.awt.event.ActionEvent;
|
---|
7 | import java.awt.event.KeyEvent;
|
---|
8 |
|
---|
9 | import org.openstreetmap.josm.Main;
|
---|
10 | import org.openstreetmap.josm.data.osm.Relation;
|
---|
11 | import org.openstreetmap.josm.data.osm.Node;
|
---|
12 | import org.openstreetmap.josm.data.osm.OsmPrimitive;
|
---|
13 | import org.openstreetmap.josm.data.osm.Way;
|
---|
14 | import org.openstreetmap.josm.data.osm.visitor.Visitor;
|
---|
15 | import org.openstreetmap.josm.tools.OpenBrowser;
|
---|
16 | import org.openstreetmap.josm.tools.Shortcut;
|
---|
17 |
|
---|
18 | public class HistoryInfoAction extends JosmAction {
|
---|
19 |
|
---|
20 | public HistoryInfoAction() {
|
---|
21 | super(tr("OSM History Information"), "about",tr("Display history information about OSM ways or nodes."),
|
---|
22 | Shortcut.registerShortcut("core:history", tr("OSM History Information"), KeyEvent.VK_H, Shortcut.GROUP_HOTKEY), true);
|
---|
23 | }
|
---|
24 |
|
---|
25 | public void actionPerformed(ActionEvent e) {
|
---|
26 | new Visitor() {
|
---|
27 | public void visit(Node n) {
|
---|
28 | OpenBrowser.displayUrl("http://www.openstreetmap.org/browse/node/" + n.id + "/history");
|
---|
29 | }
|
---|
30 |
|
---|
31 | public void visit(Way w) {
|
---|
32 | OpenBrowser.displayUrl("http://www.openstreetmap.org/browse/way/" + w.id + "/history");
|
---|
33 | }
|
---|
34 |
|
---|
35 | public void visit(Relation e) {
|
---|
36 | OpenBrowser.displayUrl("http://www.openstreetmap.org/browse/relation/" + e.id + "/history");
|
---|
37 | }
|
---|
38 |
|
---|
39 | public void visitAll() {
|
---|
40 | for (OsmPrimitive osm : Main.ds.getSelected())
|
---|
41 | osm.visit(this);
|
---|
42 | }
|
---|
43 | }.visitAll();
|
---|
44 |
|
---|
45 | }
|
---|
46 |
|
---|
47 | }
|
---|