Changeset 6299 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2013-10-06T17:26:37+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java
r6248 r6299 29 29 30 30 /** 31 * Displays an external URI using platform associated software. 32 * A web resource will launch platform's browser, an audio file URI will launch audio player, etc. 33 * @param uri The URI to display 31 34 * @return <code>null</code> for success or a string in case of an error. 32 35 * @throws IllegalStateException thrown if no platform is set to which opening the URL can be dispatched, … … 34 37 */ 35 38 public static String displayUrl(URI uri) { 39 CheckParameterUtil.ensureParameterNotNull(uri, "uri"); 36 40 if (Main.applet) { 37 41 try { … … 43 47 } 44 48 } 49 50 Main.info(tr("Opening URL: {0}", uri)); 45 51 46 52 if (Desktop.isDesktopSupported()) { 47 53 try { 48 try { 54 if (Main.platform instanceof PlatformHookWindows) { 55 // Desktop API works fine under Windows, so we don't try any fallback in case of I/O exceptions because it's not API's fault 49 56 Desktop.getDesktop().browse(uri); 50 } catch (IOException e) { 51 // Workaround for KDE (Desktop API is severely flawed) 52 // see http://bugs.sun.com/view_bug.do?bug_id=6486393 53 Main.warn("Desktop class failed. Platform dependent fall back for open url in browser."); 54 displayUrlFallback(uri); 57 } else { 58 // This is not the case with some Linux environments (see below), and not sure about Mac OS X, so we need to handle API failure 59 try { 60 Desktop.getDesktop().browse(uri); 61 } catch (IOException e) { 62 // Workaround for KDE (Desktop API is severely flawed) 63 // see https://bugs.openjdk.java.net/browse/JDK-6486393 64 Main.warn("Desktop class failed. Platform dependent fall back for open url in browser."); 65 displayUrlFallback(uri); 66 } 55 67 } 56 68 } catch (Exception e) { 57 e.printStackTrace();69 Main.warn(e); 58 70 return e.getMessage(); 59 71 } … … 69 81 } 70 82 83 /** 84 * Displays an external URL using platform associated software. 85 * A web resource will launch platform's browser, an audio file URL will launch audio player, etc. 86 * @param url The URL to display 87 * @return <code>null</code> for success or a string in case of an error. 88 * @throws IllegalStateException thrown if no platform is set to which opening the URL can be dispatched, 89 * {@link Main#platform} 90 */ 71 91 public static String displayUrl(String url) { 72 92 try {
Note:
See TracChangeset
for help on using the changeset viewer.
