@@ -0,0 +1,3255 @@
+/******************************************************************************%0A *                                                                            *%0A *                    Copyright 2018 Subterranean Security                    *%0A *                                                                            *%0A *  Licensed under the Apache License, Version 2.0 (the %22License%22);           *%0A *  you may not use this file except in compliance with the License.          *%0A *  You may obtain a copy of the License at                                   *%0A *                                                                            *%0A *      http://www.apache.org/licenses/LICENSE-2.0                            *%0A *                                                                            *%0A *  Unless required by applicable law or agreed to in writing, software       *%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,         *%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *%0A *  See the License for the specific language governing permissions and       *%0A *  limitations under the License.                                            *%0A *                                                                            *%0A *****************************************************************************/%0Apackage com.sandpolis.viewer.jfx.common;%0A%0Aimport java.util.concurrent.TimeUnit;%0A%0Aimport io.netty.util.concurrent.AbstractEventExecutor;%0Aimport io.netty.util.concurrent.EventExecutor;%0Aimport io.netty.util.concurrent.Future;%0Aimport javafx.application.Platform;%0A%0A/**%0A * This %7B@link EventExecutor%7D implementation runs tasks on the JavaFX%0A * application thread. The primary motivation is to allow %7B@link Future%7D%0A * listeners to be executed on the GUI update thread.%3Cbr%3E%0A * %3Cbr%3E%0A * Only one instance of this class may be created and should be accessed via%0A * %7B@link #INSTANCE%7D.%0A * %0A * @author cilki%0A * @since 5.0.0%0A */%0Apublic final class FxEventExecutor extends AbstractEventExecutor %7B%0A%09private FxEventExecutor() %7B%0A%09%7D%0A%0A%09public static final FxEventExecutor INSTANCE = new FxEventExecutor();%0A%0A%09@Override%0A%09public boolean isShuttingDown() %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09@Override%0A%09public Future%3C?%3E shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09@Override%0A%09public Future%3C?%3E terminationFuture() %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09@Override%0A%09public boolean isShutdown() %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09@Override%0A%09public boolean isTerminated() %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09@Override%0A%09public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException %7B%0A%09%09throw new UnsupportedOperationException();%0A%09%7D%0A%0A%09@Override%0A%09public boolean inEventLoop(Thread thread) %7B%0A%09%09if (!Thread.currentThread().equals(thread))%0A%09%09%09throw new UnsupportedOperationException(%0A%09%09%09%09%09%22FxEventExecutor supports querying the eventloop status of the current thread only%22);%0A%0A%09%09return Platform.isFxApplicationThread();%0A%09%7D%0A%0A%09@Override%0A%09public void execute(Runnable command) %7B%0A%09%09Platform.runLater(command);%0A%09%7D%0A%0A%09@Override%0A%09public void shutdown() %7B%0A%09%09Platform.exit();%0A%09%7D%0A%0A%7D%0A

Add a JavaFX EventExecutor for Future implementations