From 39cb0798ed3f74c12e2729c337ecafeec7ae46c0 Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 24 Aug 2010 21:47:32 +0000 Subject: [PATCH] Disable SWT on Java 7 git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1384 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/ui/tray/DavGatewayTray.java | 23 +++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/java/davmail/ui/tray/DavGatewayTray.java b/src/java/davmail/ui/tray/DavGatewayTray.java index e0f40fba..8800130a 100644 --- a/src/java/davmail/ui/tray/DavGatewayTray.java +++ b/src/java/davmail/ui/tray/DavGatewayTray.java @@ -225,16 +225,19 @@ public final class DavGatewayTray { */ public static void init() { if (!Settings.getBooleanProperty("davmail.server")) { - ClassLoader classloader = DavGatewayTray.class.getClassLoader(); - // first try to load SWT - try { - // trigger ClassNotFoundException - classloader.loadClass("org.eclipse.swt.SWT"); - // SWT available, create tray - davGatewayTray = new SwtGatewayTray(); - davGatewayTray.init(); - } catch (ClassNotFoundException e) { - DavGatewayTray.info(new BundleMessage("LOG_SWT_NOT_AVAILABLE")); + String javaVersion = System.getProperty("java.specification.version"); + // first try to load SWT before with Java before 1.7 + if ("1.7".compareTo(System.getProperty("java.specification.version")) > 0) { + ClassLoader classloader = DavGatewayTray.class.getClassLoader(); + try { + // trigger ClassNotFoundException + classloader.loadClass("org.eclipse.swt.SWT"); + // SWT available, create tray + davGatewayTray = new SwtGatewayTray(); + davGatewayTray.init(); + } catch (ClassNotFoundException e) { + DavGatewayTray.info(new BundleMessage("LOG_SWT_NOT_AVAILABLE")); + } } // try java6 tray support if (davGatewayTray == null) {