onShutdown is no longer available when using JPMS, so it was removed. The developer will now have to implement shutdown hooks for SWT/JavaFX
parent
7e2190a6dd
commit
aac1fef12c
|
@ -145,9 +145,4 @@ class JavaFx {
|
||||||
boolean isEventThread() {
|
boolean isEventThread() {
|
||||||
return JavaFxAccess.isEventThread();
|
return JavaFxAccess.isEventThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static
|
|
||||||
void onShutdown(final Runnable runnable) {
|
|
||||||
JavaFxAccess.onShutdown(runnable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,6 @@ package dorkbox.javaFx;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods for JavaFX.
|
* Utility methods for JavaFX.
|
||||||
* <p>
|
|
||||||
* We use reflection for these methods so that we can compile everything under a version of Java that might not have JavaFX.
|
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
class JavaFxAccess {
|
class JavaFxAccess {
|
||||||
|
@ -32,9 +30,4 @@ class JavaFxAccess {
|
||||||
// JAVA 8
|
// JAVA 8
|
||||||
return com.sun.javafx.tk.Toolkit.getToolkit().isFxUserThread();
|
return com.sun.javafx.tk.Toolkit.getToolkit().isFxUserThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static
|
|
||||||
void onShutdown(final Runnable runnable) {
|
|
||||||
com.sun.javafx.tk.Toolkit.getToolkit().addShutdownHook(runnable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,4 @@ class Swt {
|
||||||
boolean isEventThread() {
|
boolean isEventThread() {
|
||||||
return SwtAccess.isEventThread();
|
return SwtAccess.isEventThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static
|
|
||||||
void onShutdown(final Runnable runnable) {
|
|
||||||
SwtAccess.onShutdown(runnable);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,20 +119,4 @@ class SwtAccess {
|
||||||
boolean isEventThread() {
|
boolean isEventThread() {
|
||||||
return Thread.currentThread() == currentDisplayThread;
|
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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 {}
|
Loading…
Reference in New Issue