Cleaned up checks if javaFX/swt is loaded. Added SWT to build process

(removed pre-compiled jars)
This commit is contained in:
nathan 2016-09-23 13:19:33 +02:00
parent 3d8459ecc3
commit 619edcb3fe
2 changed files with 0 additions and 30 deletions

View File

@ -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.");
}
}
}

View File

@ -19,25 +19,9 @@ package dorkbox.systemTray.util;
* Utility methods for SWT.
* <p>
* SWT system tray types are just GTK trays.
* <p>
* 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)
* <p>
* 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()