Commit a548ba3 1 parent 812c4bd commit a548ba3 Copy full SHA for a548ba3
File tree 1 file changed +8
-9
lines changed
kit/src/test/java/com/oracle/javafx/scenebuilder/kit/fxom
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 40
40
import java .io .IOException ;
41
41
import java .net .URL ;
42
42
import java .util .concurrent .Callable ;
43
+ import java .util .concurrent .FutureTask ;
43
44
44
45
import org .junit .Before ;
45
46
import org .junit .Test ;
48
49
import com .oracle .javafx .scenebuilder .kit .JfxInitializer ;
49
50
50
51
import javafx .application .Platform ;
51
- import javafx .concurrent .Task ;
52
52
import javafx .fxml .FXMLLoader ;
53
53
54
54
public class FXOMDocumentTest {
@@ -169,13 +169,12 @@ public void that_missing_imports_during_defines_resolution_cause_exception() thr
169
169
}
170
170
171
171
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
+ }
180
179
}
181
180
}
You can’t perform that action at this time.
0 commit comments