Ticket #1546: diff.txt

File diff.txt, 3.3 KB (added by anonymous, 18 years ago)
Line 
1Index: src/org/openstreetmap/josm/actions/HistoryInfoAction.java
2===================================================================
3--- src/org/openstreetmap/josm/actions/HistoryInfoAction.java (Revision 0)
4+++ src/org/openstreetmap/josm/actions/HistoryInfoAction.java (Revision 0)
5@@ -0,0 +1,48 @@
6+//License: GPL. Copyright 2007 by Immanuel Scholz and others
7+package org.openstreetmap.josm.actions;
8+
9+import static org.openstreetmap.josm.tools.I18n.tr;
10+
11+import java.awt.event.ActionEvent;
12+import java.awt.event.KeyEvent;
13+import java.util.Collection;
14+import java.util.Collections;
15+import java.util.LinkedList;
16+
17+import org.openstreetmap.josm.Main;
18+import org.openstreetmap.josm.data.osm.Relation;
19+import org.openstreetmap.josm.data.osm.Node;
20+import org.openstreetmap.josm.data.osm.OsmPrimitive;
21+import org.openstreetmap.josm.data.osm.Way;
22+import org.openstreetmap.josm.data.osm.visitor.Visitor;
23+import org.openstreetmap.josm.tools.OpenBrowser;
24+
25+public class HistoryInfoAction extends JosmAction {
26+
27+ public HistoryInfoAction() {
28+ super(tr("OSM History Information"), "about",tr("Display history information about OSM ways or nodes."), KeyEvent.VK_H, KeyEvent.SHIFT_DOWN_MASK, true);
29+ }
30+
31+ public void actionPerformed(ActionEvent e) {
32+ new Visitor() {
33+ public void visit(Node n) {
34+ OpenBrowser.displayUrl("http://www.openstreetmap.org/browse/node/" + n.id + "/history");
35+ }
36+
37+ public void visit(Way w) {
38+ OpenBrowser.displayUrl("http://www.openstreetmap.org/browse/way/" + w.id + "/history");
39+ }
40+
41+ public void visit(Relation e) {
42+ OpenBrowser.displayUrl("http://www.openstreetmap.org/browse/relation/" + e.id + "/history");
43+ }
44+
45+ public void visitAll() {
46+ for (OsmPrimitive osm : Main.ds.getSelected())
47+ osm.visit(this);
48+ }
49+ }.visitAll();
50+
51+ }
52+
53+}
54Index: src/org/openstreetmap/josm/gui/MainMenu.java
55===================================================================
56--- src/org/openstreetmap/josm/gui/MainMenu.java (Revision 947)
57+++ src/org/openstreetmap/josm/gui/MainMenu.java (Arbeitskopie)
58@@ -27,6 +27,7 @@
59 import org.openstreetmap.josm.actions.ExitAction;
60 import org.openstreetmap.josm.actions.GpxExportAction;
61 import org.openstreetmap.josm.actions.HelpAction;
62+import org.openstreetmap.josm.actions.HistoryInfoAction;
63 import org.openstreetmap.josm.actions.JoinNodeWayAction;
64 import org.openstreetmap.josm.actions.JosmAction;
65 import org.openstreetmap.josm.actions.MergeNodesAction;
66@@ -116,6 +117,7 @@
67 /* Help menu */
68 public final HelpAction help = new HelpAction();
69 public final JosmAction about = new AboutAction();
70+ public final HistoryInfoAction historyinfo = new HistoryInfoAction();
71
72 public final JMenu fileMenu = new JMenu(tr("File"));
73 public final JMenu editMenu = new JMenu(tr("Edit"));
74@@ -268,6 +270,8 @@
75 //current.setAccelerator(help.shortCut);
76 current = helpMenu.add(about);
77 current.setAccelerator(about.shortCut);
78+ current = helpMenu.add(historyinfo);
79+ current.setAccelerator(historyinfo.shortCut);
80 add(helpMenu);
81 }
82 }