@@ -328,10 +328,11 @@ private boolean startSketch(final Device device) {
328328 }
329329
330330
331- private Device waitForDevice (final Future <Device > deviceFuture ,
332- final IndeterminateProgressMonitor monitor ) throws MonitorCanceled {
331+ private Device waitForDevice (Future <Device > deviceFuture , RunnerListener listener ) throws MonitorCanceled {
332+ // final IndeterminateProgressMonitor monitor)
333333 for (int i = 0 ; i < 120 ; i ++) {
334- if (monitor .isCanceled ()) {
334+ // if (monitor.isCanceled()) {
335+ if (listener .isHalted ()) {
335336 deviceFuture .cancel (true );
336337 throw new MonitorCanceled ();
337338 }
@@ -360,13 +361,13 @@ private Device waitForDevice(final Future<Device> deviceFuture,
360361 private void runSketchOnDevice (final Future <Device > deviceFuture ,
361362 final String target ,
362363 RunnerListener listener ) throws MonitorCanceled {
363- final IndeterminateProgressMonitor monitor =
364- new IndeterminateProgressMonitor (this ,
365- "Building and launching..." ,
366- "Creating project..." );
364+ // final IndeterminateProgressMonitor monitor =
365+ // new IndeterminateProgressMonitor(this,
366+ // "Building and launching...",
367+ // "Creating project...");
367368
368369 listener .startIndeterminate ();
369- listener .statusNotice ("Building and launching ..." );
370+ listener .statusNotice ("Creating project ..." );
370371
371372 build = new AndroidBuild (sketch , amode .getSDK ());
372373 try {
@@ -380,10 +381,11 @@ private void runSketchOnDevice(final Future<Device> deviceFuture,
380381 statusError (e );
381382 }
382383 try {
383- if (monitor .isCanceled ()) {
384- throw new MonitorCanceled ();
385- }
386- monitor .setNote ("Building..." );
384+ // if (monitor.isCanceled()) {
385+ // throw new MonitorCanceled();
386+ // }
387+ // monitor.setNote("Building...");
388+ listener .statusNotice ("Building..." );
387389 try {
388390 if (!build .antBuild (target )) {
389391 return ;
@@ -392,31 +394,36 @@ private void runSketchOnDevice(final Future<Device> deviceFuture,
392394 statusError (se );
393395 }
394396
395- if (monitor .isCanceled ()) {
396- throw new MonitorCanceled ();
397- }
398- monitor .setNote ("Waiting for device to become available..." );
399- final Device device = waitForDevice (deviceFuture , monitor );
397+ // if (monitor.isCanceled()) {
398+ // throw new MonitorCanceled();
399+ // }
400+ // monitor.setNote("Waiting for device to become available...");
401+ listener .statusNotice ("Waiting for device to become available..." );
402+ // final Device device = waitForDevice(deviceFuture, monitor);
403+ final Device device = waitForDevice (deviceFuture , listener );
400404 if (device == null || !device .isAlive ()) {
401405 statusError ("Device killed or disconnected." );
402406 return ;
403407 }
404408
405409 device .addListener (this );
406410
407- if (monitor .isCanceled ()) {
411+ if (listener .isHalted ()) {
412+ // if (monitor.isCanceled()) {
408413 throw new MonitorCanceled ();
409414 }
410- monitor .setNote ("Installing sketch on " + device .getId ());
415+ // monitor.setNote("Installing sketch on " + device.getId());
416+ statusNotice ("Installing sketch on " + device .getId ());
411417 if (!device .installApp (build .getPathForAPK (target ), this )) {
412418 statusError ("Device killed or disconnected." );
413419 return ;
414420 }
415421
416- if (monitor .isCanceled ()) {
417- throw new MonitorCanceled ();
418- }
419- monitor .setNote ("Starting sketch on " + device .getId ());
422+ // if (monitor.isCanceled()) {
423+ // throw new MonitorCanceled();
424+ // }
425+ // monitor.setNote("Starting sketch on " + device.getId());
426+ listener .statusNotice ("Starting sketch on " + device .getId ());
420427 if (startSketch (device )) {
421428 statusNotice ("Sketch launched on the "
422429 + (device .isEmulator () ? "emulator" : "phone" ) + "." );
@@ -429,7 +436,8 @@ private void runSketchOnDevice(final Future<Device> deviceFuture,
429436 build .cleanup ();
430437 }
431438 } finally {
432- monitor .close ();
439+ // monitor.close();
440+ listener .stopIndeterminate ();
433441 }
434442 }
435443
0 commit comments