Skip to content

Commit a548ba3

Browse files
FutureTask is now used instead of JavaFX task.
1 parent 812c4bd commit a548ba3

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

kit/src/test/java/com/oracle/javafx/scenebuilder/kit/fxom/FXOMDocumentTest.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import java.io.IOException;
4141
import java.net.URL;
4242
import java.util.concurrent.Callable;
43+
import java.util.concurrent.FutureTask;
4344

4445
import org.junit.Before;
4546
import org.junit.Test;
@@ -48,7 +49,6 @@
4849
import com.oracle.javafx.scenebuilder.kit.JfxInitializer;
4950

5051
import javafx.application.Platform;
51-
import javafx.concurrent.Task;
5252
import javafx.fxml.FXMLLoader;
5353

5454
public class FXOMDocumentTest {
@@ -169,13 +169,12 @@ public void that_missing_imports_during_defines_resolution_cause_exception() thr
169169
}
170170

171171
private <T> T waitFor(Callable<T> callable) throws Exception {
172-
Task<T> task = new Task<T>() {
173-
@Override
174-
protected T call() throws Exception {
175-
return callable.call();
176-
}
177-
};
178-
Platform.runLater(()->task.run());
179-
return task.get();
172+
FutureTask<T> task = new FutureTask<T>(callable);
173+
if (Platform.isFxApplicationThread()) {
174+
return callable.call();
175+
} else {
176+
Platform.runLater(()->task.run());
177+
return task.get();
178+
}
180179
}
181180
}

0 commit comments

Comments
 (0)