Changeset 3086 in josm for trunk/src/org/openstreetmap/josm/plugins
- Timestamp:
- 2010-03-05T13:13:34+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r3083 r3086 606 606 * Updates the plugins in <code>plugins</code>. 607 607 * 608 * @param parent the parent window for message boxes 608 609 * @param plugins the collection of plugins to update. Must not be null. 609 610 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null. … … 616 617 } 617 618 try { 618 PluginDownloadTask task = new PluginDownloadTask( 619 monitor, 619 monitor.beginTask(""); 620 ExecutorService service = Executors.newSingleThreadExecutor(); 621 622 // try to download the plugin lists 623 // 624 ReadRemotePluginInformationTask task1 = new ReadRemotePluginInformationTask( 625 monitor.createSubTaskMonitor(1,false), 626 Main.pref.getPluginSites() 627 ); 628 Future<?> future = service.submit(task1); 629 try { 630 future.get(); 631 } catch(ExecutionException e) { 632 System.out.println(tr("Warning: failed to download plugin information list")); 633 e.printStackTrace(); 634 // don't abort in case of error, continue with downloading plugins below 635 } catch(InterruptedException e) { 636 System.out.println(tr("Warning: failed to download plugin information list")); 637 e.printStackTrace(); 638 // don't abort in case of error, continue with downloading plugins below 639 } 640 641 // try to update the locally installed plugins 642 // 643 PluginDownloadTask task2 = new PluginDownloadTask( 644 monitor.createSubTaskMonitor(1,false), 620 645 plugins, 621 646 tr("Update plugins") 622 647 ); 623 ExecutorService service = Executors.newSingleThreadExecutor(); 624 Future<?> future = service.submit(task);648 649 future = service.submit(task2); 625 650 try { 626 651 future.get(); 627 652 } catch(ExecutionException e) { 628 653 e.printStackTrace(); 654 alertFailedPluginUpdate(parent, plugins); 655 return; 629 656 } catch(InterruptedException e) { 630 657 e.printStackTrace(); 631 } 632 if (! task.getFailedPlugins().isEmpty()) { 633 alertFailedPluginUpdate(parent, task.getFailedPlugins()); 658 alertFailedPluginUpdate(parent, plugins); 659 return; 660 } 661 // notify user if downloading a locally installed plugin failed 662 // 663 if (! task2.getFailedPlugins().isEmpty()) { 664 alertFailedPluginUpdate(parent, task2.getFailedPlugins()); 634 665 return; 635 666 } -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r3084 r3086 28 28 import org.openstreetmap.josm.data.Version; 29 29 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 30 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 30 31 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 31 32 import org.openstreetmap.josm.io.OsmTransferException; … … 44 45 private List<PluginInformation> availabePlugins; 45 46 46 /** 47 * Creates the task 48 * 49 * @param sites the collection of download sites. Defaults to the empty collection if null. 50 */ 51 public ReadRemotePluginInformationTask(Collection<String> sites) { 52 super(tr("Download plugin list..."), false /* don't ignore exceptions */); 47 protected void init(Collection<String> sites){ 53 48 this.sites = sites; 54 49 if (sites == null) { … … 56 51 } 57 52 availabePlugins = new LinkedList<PluginInformation>(); 58 } 53 54 } 55 /** 56 * Creates the task 57 * 58 * @param sites the collection of download sites. Defaults to the empty collection if null. 59 */ 60 public ReadRemotePluginInformationTask(Collection<String> sites) { 61 super(tr("Download plugin list..."), false /* don't ignore exceptions */); 62 init(sites); 63 } 64 65 /** 66 * Creates the task 67 * 68 * @param monitor the progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null 69 * @param sites the collection of download sites. Defaults to the empty collection if null. 70 */ 71 public ReadRemotePluginInformationTask(ProgressMonitor monitor, Collection<String> sites) { 72 super(tr("Download plugin list..."), monitor == null ? NullProgressMonitor.INSTANCE: monitor, false /* don't ignore exceptions */); 73 init(sites); 74 } 75 59 76 60 77 @Override
Note:
See TracChangeset
for help on using the changeset viewer.