Changeset 4578 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2011-11-05T23:28:16+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java
r3524 r4578 8 8 import java.net.MalformedURLException; 9 9 import java.net.URI; 10 import java.net.URL;11 10 12 11 import javax.swing.JApplet; … … 23 22 public class OpenBrowser { 24 23 24 private static void displayUrlFallback(URI uri) throws IOException { 25 if (Main.platform == null) 26 throw new IllegalStateException(tr("Failed to open URL. There is currently no platform set. Please set a platform first.")); 27 Main.platform.openUrl(uri.toString()); 28 } 29 25 30 /** 26 31 * @return <code>null</code> for success or a string in case of an error. … … 41 46 if (Desktop.isDesktopSupported()) { 42 47 try { 43 Desktop.getDesktop().browse(uri); 48 try { 49 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 System.err.println("Warning: Desktop class failed. Platform dependent fall back for open url in browser."); 54 displayUrlFallback(uri); 55 } 44 56 } catch (Exception e) { 45 57 e.printStackTrace(); … … 47 59 } 48 60 } else { 49 System.err.println("Warning: Desktop class is not supported. Platform dependent fall back for open url in browser.");50 51 if (Main.platform == null)52 throw new IllegalStateException(tr("Failed to open URL. There is currently no platform set. Please set a platform first."));53 61 try { 54 Main.platform.openUrl(uri.toString()); 62 System.err.println("Warning: Desktop class is not supported. Platform dependent fall back for open url in browser."); 63 displayUrlFallback(uri); 55 64 } catch (IOException e) { 56 65 return e.getMessage();
Note:
See TracChangeset
for help on using the changeset viewer.