diff --git a/src/dorkbox/javaFx/JavaFx.java b/src/dorkbox/javaFx/JavaFx.java index 277bac1..02aca05 100644 --- a/src/dorkbox/javaFx/JavaFx.java +++ b/src/dorkbox/javaFx/JavaFx.java @@ -145,9 +145,4 @@ class JavaFx { boolean isEventThread() { return JavaFxAccess.isEventThread(); } - - public static - void onShutdown(final Runnable runnable) { - JavaFxAccess.onShutdown(runnable); - } } diff --git a/src/dorkbox/javaFx/JavaFxAccess.java b/src/dorkbox/javaFx/JavaFxAccess.java index 963f327..4a8cd76 100644 --- a/src/dorkbox/javaFx/JavaFxAccess.java +++ b/src/dorkbox/javaFx/JavaFxAccess.java @@ -17,8 +17,6 @@ package dorkbox.javaFx; /** * Utility methods for JavaFX. - *

- * We use reflection for these methods so that we can compile everything under a version of Java that might not have JavaFX. */ public class JavaFxAccess { @@ -32,9 +30,4 @@ class JavaFxAccess { // JAVA 8 return com.sun.javafx.tk.Toolkit.getToolkit().isFxUserThread(); } - - public static - void onShutdown(final Runnable runnable) { - com.sun.javafx.tk.Toolkit.getToolkit().addShutdownHook(runnable); - } } diff --git a/src/dorkbox/swt/Swt.java b/src/dorkbox/swt/Swt.java index ad9524f..e383a93 100644 --- a/src/dorkbox/swt/Swt.java +++ b/src/dorkbox/swt/Swt.java @@ -79,9 +79,4 @@ class Swt { boolean isEventThread() { return SwtAccess.isEventThread(); } - - public static - void onShutdown(final Runnable runnable) { - SwtAccess.onShutdown(runnable); - } } diff --git a/src/dorkbox/swt/SwtAccess.java b/src/dorkbox/swt/SwtAccess.java index 0a236a7..a7ae1bd 100644 --- a/src/dorkbox/swt/SwtAccess.java +++ b/src/dorkbox/swt/SwtAccess.java @@ -119,20 +119,4 @@ class SwtAccess { boolean isEventThread() { return Thread.currentThread() == currentDisplayThread; } - - static - void onShutdown(final Runnable runnable) { - // currentDisplay.getShells() must only be called inside the event thread! - if (isEventThread()) { - SwtAccess.onShutdown(currentDisplay, runnable); - } else { - dispatch(new Runnable() { - @Override - public - void run() { - SwtAccess.onShutdown(currentDisplay, runnable); - } - }); - } - } } diff --git a/src9/dorkbox/javaFx/JavaFxAccess.java b/src9/dorkbox/javaFx/JavaFxAccess.java new file mode 100644 index 0000000..c96cb05 --- /dev/null +++ b/src9/dorkbox/javaFx/JavaFxAccess.java @@ -0,0 +1,33 @@ +/* + * Copyright 2016 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package dorkbox.javaFx; + +/** + * Utility methods for JavaFX. + */ +public +class JavaFxAccess { + static + void dispatch(final Runnable runnable) { + javafx.application.Platform.runLater(runnable); + } + + static + boolean isEventThread() { + // JAVA 9+ + return javafx.application.Platform.isFxApplicationThread(); + } +} diff --git a/src9/dorkbox/swt/EmptyClass.java b/src9/dorkbox/swt/EmptyClass.java new file mode 100644 index 0000000..3075653 --- /dev/null +++ b/src9/dorkbox/swt/EmptyClass.java @@ -0,0 +1,24 @@ +/* + * Copyright 2021 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dorkbox.swt; + +/** + * Required for intellij to not complain regarding `module-info` for a multi-release jar. + * This file is completely ignored by the gradle build process + */ +public +class EmptyClass {}