From 619edcb3fe42b5df0cb4d731c2ec1553211080bc Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 23 Sep 2016 13:19:33 +0200 Subject: [PATCH] Cleaned up checks if javaFX/swt is loaded. Added SWT to build process (removed pre-compiled jars) --- src/dorkbox/systemTray/util/JavaFX.java | 14 -------------- src/dorkbox/systemTray/util/Swt.java | 16 ---------------- 2 files changed, 30 deletions(-) diff --git a/src/dorkbox/systemTray/util/JavaFX.java b/src/dorkbox/systemTray/util/JavaFX.java index 2c3f6ec..2ec0493 100644 --- a/src/dorkbox/systemTray/util/JavaFX.java +++ b/src/dorkbox/systemTray/util/JavaFX.java @@ -32,18 +32,6 @@ class JavaFX { private static Method isEventThread; private static Method dispatchMethod; - public static - boolean isLoaded() throws Exception { - // JavaFX Java7,8 is GTK2 only. Java9 can have it be GTK3 if -Djdk.gtk.version=3 is specified - // see http://mail.openjdk.java.net/pipermail/openjfx-dev/2016-May/019100.html - - // this is important to use reflection, because if JavaFX is not being used, calling getToolkit() will initialize it... - java.lang.reflect.Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class); - m.setAccessible(true); - ClassLoader cl = ClassLoader.getSystemClassLoader(); - return (null != m.invoke(cl, "com.sun.javafx.tk.Toolkit")) || (null != m.invoke(cl, "javafx.application.Application")); - } - public static void dispatch(final Runnable runnable) { // javafx.application.Platform.runLater(runnable); @@ -105,6 +93,4 @@ class JavaFX { "version so we may further investigate this issue."); } } - - } diff --git a/src/dorkbox/systemTray/util/Swt.java b/src/dorkbox/systemTray/util/Swt.java index 72be61f..2fd9094 100644 --- a/src/dorkbox/systemTray/util/Swt.java +++ b/src/dorkbox/systemTray/util/Swt.java @@ -19,25 +19,9 @@ package dorkbox.systemTray.util; * Utility methods for SWT. *

* SWT system tray types are just GTK trays. - *

- * Creating custom methods for a class is not possible with reflection - so we compile it AHEAD of time as Java 1.6, and save the bytecode - * (which is then included with the release) - *

- * We **COULD** do some ASM/Bytecode generation, but why bother with even more libraries when it's just as easy to include it pre-compiled. */ public class Swt { - public static - boolean isLoaded() throws Exception { - // maybe we should load the SWT version? (In order for us to work with SWT, BOTH must be GTK2!! - // SWT is GTK2, but if -DSWT_GTK3=1 is specified, it can be GTK3 - - java.lang.reflect.Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class); - m.setAccessible(true); - ClassLoader cl = ClassLoader.getSystemClassLoader(); - return null != m.invoke(cl, "org.eclipse.swt.widgets.Display"); - } - public static void dispatch(final Runnable runnable) { org.eclipse.swt.widgets.Display.getCurrent()