@@ -336,14 +336,12 @@ public int compare(String o1, String o2) {
336
336
337
337
class DownloadTask extends SwingWorker <Object , Object > {
338
338
ProgressIndicator progress ;
339
- JProgressBar progressBar ;
340
339
Boolean isPlatform ;
341
340
JLabel status ;
342
341
343
342
DownloadTask (JProgressBar progressBar , Boolean isPlatform ,JLabel status ) {
344
343
super ();
345
344
progress = new ConsoleProgressIndicator ();
346
- this .progressBar = progressBar ;
347
345
this .isPlatform = isPlatform ;
348
346
this .status = status ;
349
347
}
@@ -388,11 +386,15 @@ protected Object doInBackground() throws Exception {
388
386
for (RemotePackage p : remotes ) {
389
387
Installer installer = SdkInstallerUtil .findBestInstallerFactory (p , mHandler )
390
388
.createInstaller (p , mRepoManager , downloader , mHandler .getFileOp ());
391
- status .setText ("Downloading..." );
392
- if (!(installer .prepare (progress ) && installer .complete (progress ))) {
393
- // there was an error, abort.
394
- throw new SdkManagerCli .CommandFailedException ();
395
- }
389
+ status .setText ("Downloading. . ." );
390
+ if ((installer .prepare (progress ))) {
391
+ if (isPlatform ) statusPlatform .setText ("Unzipping. . ." );
392
+ else status .setText ("Unzipping" );
393
+ if (!installer .complete (progress )) {
394
+ // there was an error, abort.
395
+ throw new SdkManagerCli .CommandFailedException ();
396
+ }
397
+ } else throw new SdkManagerCli .CommandFailedException ();
396
398
}
397
399
} else {
398
400
progress .logWarning ("Unable to compute a complete list of dependencies." );
@@ -405,17 +407,16 @@ protected Object doInBackground() throws Exception {
405
407
@ Override
406
408
protected void done () {
407
409
super .done ();
408
-
409
410
try {
410
411
get ();
411
412
actionButton .setEnabled (false );
412
413
tabs .setEnabled (true );
413
414
status .setText ("Refreshing packages..." );
414
415
statusPlatform .setText ("Refreshing packages..." );
415
416
416
- //reset the progress bar to indeterminate for querying
417
- progressBar . setIndeterminate ( false );
418
- progressBarPlatform . setIndeterminate ( false );
417
+ //reset Buttons
418
+ actionButton . setText ( "Update" );
419
+ actionButtonPlatform . setText ( "Install" );
419
420
420
421
//start querying again
421
422
queryTask = new QueryTask ();
@@ -430,7 +431,6 @@ protected void done() {
430
431
e .printStackTrace ();
431
432
} finally {
432
433
downloadTaskRunning = false ;
433
- this .progressBar .setIndeterminate (false );
434
434
}
435
435
}
436
436
@@ -501,6 +501,8 @@ public void run() {
501
501
} catch (InterruptedException e ) { }
502
502
bar .setValue ((int ) (downloadTask .progress .getFraction () * 100 ));
503
503
}
504
+ bar .setValue (0 );
505
+ bar .setIndeterminate (true );
504
506
}
505
507
};
506
508
update .start ();
0 commit comments