Changeset 18694 in josm for trunk/src/org
- Timestamp:
- 2023-03-16T22:09:01+01:00 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r18211 r18694 18 18 import java.util.Collection; 19 19 import java.util.Collections; 20 import java.util.HashSet; 20 21 import java.util.LinkedList; 21 22 import java.util.List; … … 432 433 return; 433 434 } 435 int toUpdateSize; 436 boolean refreshRequired = false; 437 do { 438 toUpdateSize = toUpdate.size(); 439 Set<PluginInformation> enabledPlugins = new HashSet<>(PluginHandler.getPlugins()); 440 enabledPlugins.addAll(toUpdate); 441 Set<PluginInformation> toAdd = new HashSet<>(); 442 for (PluginInformation pi : toUpdate) { 443 if (!PluginHandler.checkRequiredPluginsPreconditions(null, enabledPlugins, pi, false)) { 444 // Time to find the missing plugins... 445 toAdd.addAll(pi.getRequiredPlugins().stream().filter(plugin -> PluginHandler.getPlugin(plugin) == null) 446 .map(plugin -> model.getPluginInformation(plugin)) 447 .collect(Collectors.toSet())); 448 } 449 } 450 toAdd.forEach(plugin -> model.setPluginSelected(plugin.name, true)); 451 refreshRequired |= !toAdd.isEmpty(); // We need to force refresh the checkboxes if we are adding new plugins 452 toAdd.removeIf(plugin -> !plugin.isUpdateRequired()); // Avoid downloading plugins that already exist 453 toUpdate.addAll(toAdd); 454 } while (toUpdateSize != toUpdate.size()); 455 434 456 pluginDownloadTask.setPluginsToDownload(toUpdate); 435 457 MainApplication.worker.submit(pluginDownloadTask); 436 458 MainApplication.worker.submit(pluginDownloadContinuation); 459 if (refreshRequired) { 460 // Needed since we need to recreate the checkboxes to show the enabled dependent plugins that were not previously enabled 461 pnlPluginPreferences.resetDisplayedComponents(); 462 } 463 GuiHelper.runInEDT(pnlPluginPreferences::refreshView); 437 464 }; 438 465
Note:
See TracChangeset
for help on using the changeset viewer.