mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 11:12:22 -05:00
Implement OSX DesktopBrowser
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@349 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
ad70032056
commit
c0127ddef5
@ -23,16 +23,25 @@ public final class DesktopBrowser {
|
|||||||
AwtDesktopBrowser.browse(location);
|
AwtDesktopBrowser.browse(location);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
DavGatewayTray.debug("Java 6 Desktop class not available");
|
DavGatewayTray.debug("Java 6 Desktop class not available");
|
||||||
// failover : try SWT
|
// failover for MacOSX
|
||||||
try {
|
if (System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
|
||||||
// trigger ClassNotFoundException
|
try {
|
||||||
ClassLoader classloader = AboutFrame.class.getClassLoader();
|
OSXDesktopBrowser.browse(location);
|
||||||
classloader.loadClass("org.eclipse.swt.program.Program");
|
} catch (Exception e2) {
|
||||||
SwtDesktopBrowser.browse(location);
|
DavGatewayTray.error("Unable to open link", e2);
|
||||||
} catch (ClassNotFoundException e2) {
|
}
|
||||||
DavGatewayTray.error("Open link not supported (tried AWT Desktop and SWT Program");
|
} else {
|
||||||
} catch (Exception e2) {
|
// failover : try SWT
|
||||||
DavGatewayTray.error("Unable to open link", e2);
|
try {
|
||||||
|
// trigger ClassNotFoundException
|
||||||
|
ClassLoader classloader = AboutFrame.class.getClassLoader();
|
||||||
|
classloader.loadClass("org.eclipse.swt.program.Program");
|
||||||
|
SwtDesktopBrowser.browse(location);
|
||||||
|
} catch (ClassNotFoundException e2) {
|
||||||
|
DavGatewayTray.error("Open link not supported (tried AWT Desktop and SWT Program");
|
||||||
|
} catch (Exception e2) {
|
||||||
|
DavGatewayTray.error("Unable to open link", e2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
DavGatewayTray.error("Unable to open link", e);
|
DavGatewayTray.error("Unable to open link", e);
|
||||||
|
16
src/java/davmail/ui/OSXDesktopBrowser.java
Normal file
16
src/java/davmail/ui/OSXDesktopBrowser.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package davmail.ui;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Failover: Runtime.exec open URL
|
||||||
|
*/
|
||||||
|
public class OSXDesktopBrowser {
|
||||||
|
private OSXDesktopBrowser() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void browse(URI location) throws IOException {
|
||||||
|
Runtime.getRuntime().exec("open "+location.toString());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user