- Timestamp:
- 2009-05-11T17:33:36+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java
r1523 r1586 8 8 import java.util.Collection; 9 9 import java.util.LinkedList; 10 import java.util.regex.Pattern; 10 11 11 12 import javax.swing.JOptionPane; … … 29 30 } 30 31 32 /** 33 * replies the base URL for browsing the the history of an OSM primitive 34 * 35 * @return the base URL, i.e. http://api.openstreetmap.org/browse 36 */ 37 protected String getBaseURL() { 38 String baseUrl = Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api"); 39 Pattern pattern = Pattern.compile("/api/?$"); 40 String ret = pattern.matcher(baseUrl).replaceAll("/browse"); 41 if (ret.equals(baseUrl)) { 42 System.out.println("WARNING: unexpected format of API base URL. Redirection to history page for OSM primitive will probably fail. API base URL is: " + baseUrl); 43 } 44 return ret; 45 } 46 31 47 public void actionPerformed(ActionEvent e) { 32 final Collection<Object> sel = new LinkedList<Object>(); 48 final Collection<Object> sel = new LinkedList<Object>(); 49 final String baseUrl = getBaseURL(); 33 50 new AbstractVisitor() { 34 51 public void visit(Node n) { 35 52 if(n.id <= 0) return; 36 OpenBrowser.displayUrl( "http://www.openstreetmap.org/browse/node/" + n.id + "/history");53 OpenBrowser.displayUrl(baseUrl + "/node/" + n.id + "/history"); 37 54 sel.add(n); 38 55 } … … 40 57 public void visit(Way w) { 41 58 if(w.id <= 0) return; 42 OpenBrowser.displayUrl( "http://www.openstreetmap.org/browse/way/" + w.id + "/history");59 OpenBrowser.displayUrl(baseUrl + "/way/" + w.id + "/history"); 43 60 sel.add(w); 44 61 } … … 46 63 public void visit(Relation e) { 47 64 if(e.id <= 0) return; 48 OpenBrowser.displayUrl( "http://www.openstreetmap.org/browse/relation/" + e.id + "/history");65 OpenBrowser.displayUrl(baseUrl + "/relation/" + e.id + "/history"); 49 66 sel.add(e); 50 67 }
Note:
See TracChangeset
for help on using the changeset viewer.