22
33import com .google .common .eventbus .EventBus ;
44import com .google .common .eventbus .Subscribe ;
5+ import com .sun .javafx .application .PlatformImpl ;
56import edu .wpi .grip .core .*;
67import edu .wpi .grip .core .events .*;
78import edu .wpi .grip .ui .pipeline .input .InputSocketView ;
89import edu .wpi .grip .ui .pipeline .source .SourceView ;
910import edu .wpi .grip .ui .pipeline .source .SourceViewFactory ;
10- import javafx .application .Platform ;
1111import javafx .beans .InvalidationListener ;
1212import javafx .beans .property .ReadOnlyObjectProperty ;
1313import javafx .collections .ObservableList ;
@@ -197,7 +197,7 @@ private ConnectionView findConnectionView(Connection connection) {
197197 * details of adding the connection.
198198 */
199199 private void addConnectionView (Connection connection ) {
200- Platform . runLater (() -> {
200+ PlatformImpl . runAndWait (() -> {
201201 // Before adding a connection control, we have to look up the controls for both sockets in the connection so
202202 // we know where to position it.
203203 final OutputSocketView outputSocketView = findOutputSocketView (connection .getOutputSocket ());
@@ -218,7 +218,7 @@ private void addConnectionView(Connection connection) {
218218 final double x2 = inputSocketBounds .getMinX () + inputSocketBounds .getWidth () / 2.0 ;
219219 final double y2 = inputSocketBounds .getMinY () + inputSocketBounds .getHeight () / 2.0 ;
220220
221- Platform . runLater (() -> {
221+ PlatformImpl . runAndWait (() -> {
222222 connectionView .inputHandleProperty ().setValue (new Point2D (x1 , y1 ));
223223 connectionView .outputHandleProperty ().setValue (new Point2D (x2 , y2 ));
224224 ((ReadOnlyObjectProperty ) observable ).get ();
@@ -236,20 +236,20 @@ private void addConnectionView(Connection connection) {
236236
237237 @ Subscribe
238238 public void onSourceAdded (SourceAddedEvent event ) {
239- Platform . runLater (() ->
239+ PlatformImpl . runAndWait (() ->
240240 this .sources .getChildren ().add (
241241 SourceViewFactory .createSourceControlsView (eventBus , event .getSource ())));
242242 }
243243
244244 @ Subscribe
245245 public void onSourceRemoved (SourceRemovedEvent event ) {
246- Platform . runLater (() -> this .sources .getChildren ().remove (findSourceView (event .getSource ())));
246+ PlatformImpl . runAndWait (() -> this .sources .getChildren ().remove (findSourceView (event .getSource ())));
247247 }
248248
249249 @ Subscribe
250250 public void onStepAdded (StepAddedEvent event ) {
251251 // Add a new control to the pipelineview for the step that was added
252- Platform . runLater (() -> {
252+ PlatformImpl . runAndWait (() -> {
253253 int index = event .getIndex ().or (this .steps .getChildren ().size ());
254254 this .steps .getChildren ().add (index , new StepView (this .eventBus , event .getStep ()));
255255 });
@@ -258,7 +258,7 @@ public void onStepAdded(StepAddedEvent event) {
258258 @ Subscribe
259259 public void onStepRemoved (StepRemovedEvent event ) {
260260 // Remove the control that corresponds with the step that was removed
261- Platform . runLater (() -> {
261+ PlatformImpl . runAndWait (() -> {
262262 final StepView stepView = findStepView (event .getStep ());
263263 this .steps .getChildren ().remove (stepView );
264264 this .eventBus .unregister (stepView );
@@ -267,7 +267,7 @@ public void onStepRemoved(StepRemovedEvent event) {
267267
268268 @ Subscribe
269269 public void onStepMoved (StepMovedEvent event ) {
270- Platform . runLater (() -> {
270+ PlatformImpl . runAndWait (() -> {
271271 final StepView stepView = findStepView (event .getStep ());
272272
273273 final int oldIndex = this .getSteps ().indexOf (stepView );
@@ -283,13 +283,13 @@ public void onStepMoved(StepMovedEvent event) {
283283 @ Subscribe
284284 public void onConnectionAdded (ConnectionAddedEvent event ) {
285285 // Add the new connection view
286- Platform . runLater (() -> this .addConnectionView (event .getConnection ()));
286+ PlatformImpl . runAndWait (() -> this .addConnectionView (event .getConnection ()));
287287 }
288288
289289 @ Subscribe
290290 public void onConnectionRemoved (ConnectionRemovedEvent event ) {
291291 // Remove the control that corresponds with the connection that was removed
292- Platform . runLater (() -> {
292+ PlatformImpl . runAndWait (() -> {
293293 final ConnectionView connectionView = findConnectionView (event .getConnection ());
294294 this .connections .getChildren ().remove (connectionView );
295295 this .eventBus .unregister (connectionView );
0 commit comments