Changeset 7434 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/plugin
- Timestamp:
- 2014-08-20T03:07:15+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r7021 r7434 50 50 import org.openstreetmap.josm.gui.widgets.JosmTextField; 51 51 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 52 import org.openstreetmap.josm.io.OfflineAccessException; 53 import org.openstreetmap.josm.io.OnlineResource; 52 54 import org.openstreetmap.josm.plugins.PluginDownloadTask; 53 55 import org.openstreetmap.josm.plugins.PluginInformation; … … 114 116 return sb.toString(); 115 117 } 116 118 117 119 /** 118 120 * Notifies user about result of a finished plugin download task. … … 313 315 } 314 316 317 private static Collection<String> getOnlinePluginSites() { 318 Collection<String> pluginSites = new ArrayList<>(Main.pref.getPluginSites()); 319 for (Iterator<String> it = pluginSites.iterator(); it.hasNext();) { 320 try { 321 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(it.next(), Main.getJOSMWebsite()); 322 } catch (OfflineAccessException ex) { 323 Main.warn(ex.getMessage()); 324 it.remove(); 325 } 326 } 327 return pluginSites; 328 } 329 315 330 /** 316 331 * The action for downloading the list of available plugins 317 *318 332 */ 319 333 class DownloadAvailablePluginsAction extends AbstractAction { … … 327 341 @Override 328 342 public void actionPerformed(ActionEvent e) { 329 final ReadRemotePluginInformationTask task = new ReadRemotePluginInformationTask(Main.pref.getPluginSites()); 343 Collection<String> pluginSites = getOnlinePluginSites(); 344 if (pluginSites.isEmpty()) { 345 return; 346 } 347 final ReadRemotePluginInformationTask task = new ReadRemotePluginInformationTask(pluginSites); 330 348 Runnable continuation = new Runnable() { 331 349 @Override … … 345 363 Main.worker.submit(continuation); 346 364 } 347 } 348 349 /** 350 * The action for downloading the list of available plugins351 * 365 366 } 367 368 /** 369 * The action for updating the list of selected plugins 352 370 */ 353 371 class UpdateSelectedPluginsAction extends AbstractAction { … … 387 405 ); 388 406 // the async task for downloading plugin information 389 final ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask( Main.pref.getPluginSites());407 final ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(getOnlinePluginSites()); 390 408 391 409 // to be run asynchronously after the plugin download
Note:
See TracChangeset
for help on using the changeset viewer.