Changeset 9611 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
- Timestamp:
- 2016-01-24T15:06:37+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r9078 r9611 83 83 activePlugins.addAll(Main.pref.getCollection("plugins", activePlugins)); 84 84 for (PluginInformation pi: availablePlugins) { 85 if (selectedPluginsMap.get(pi) == null) { 86 if (activePlugins.contains(pi.name)) { 87 selectedPluginsMap.put(pi, Boolean.TRUE); 88 } 85 if (selectedPluginsMap.get(pi) == null && activePlugins.contains(pi.name)) { 86 selectedPluginsMap.put(pi, Boolean.TRUE); 89 87 } 90 88 } … … 94 92 95 93 protected void updateAvailablePlugin(PluginInformation other) { 96 if (other == null) return; 97 PluginInformation pi = getPluginInformation(other.name); 98 if (pi == null) { 99 availablePlugins.add(other); 100 return; 101 } 102 pi.updateFromPluginSite(other); 94 if (other != null) { 95 PluginInformation pi = getPluginInformation(other.name); 96 if (pi == null) { 97 availablePlugins.add(other); 98 return; 99 } 100 pi.updateFromPluginSite(other); 101 } 103 102 } 104 103 … … 216 215 */ 217 216 public void clearPendingPlugins(Collection<PluginInformation> plugins) { 218 if (plugins == null || plugins.isEmpty()) return; 219 for (PluginInformation pi: plugins) { 220 pendingDownloads.remove(pi.name); 217 if (plugins != null) { 218 for (PluginInformation pi: plugins) { 219 pendingDownloads.remove(pi.name); 220 } 221 221 } 222 222 } … … 264 264 public boolean isSelectedPlugin(String name) { 265 265 PluginInformation pi = getPluginInformation(name); 266 if (pi == null ) return false;267 if (selectedPluginsMap.get(pi) == null)return false;266 if (pi == null || selectedPluginsMap.get(pi) == null) 267 return false; 268 268 return selectedPluginsMap.get(pi); 269 269 } … … 273 273 * the set of activated plugins. 274 274 * 275 * @return the set of newly deactivated plugins275 * @return the set of newly activated plugins 276 276 */ 277 277 public List<PluginInformation> getNewlyActivatedPlugins() { … … 289 289 /** 290 290 * Replies the set of plugins which have been removed by the user from 291 * the set of activated plugins.291 * the set of deactivated plugins. 292 292 * 293 293 * @return the set of newly deactivated plugins … … 349 349 */ 350 350 public void refreshLocalPluginVersion(Collection<PluginInformation> plugins) { 351 if (plugins == null) return; 352 for (PluginInformation pi : plugins) { 353 File downloadedPluginFile = PluginHandler.findUpdatedJar(pi.name); 354 if (downloadedPluginFile == null) { 355 continue; 356 } 357 try { 358 PluginInformation newinfo = new PluginInformation(downloadedPluginFile, pi.name); 359 PluginInformation oldinfo = getPluginInformation(pi.name); 360 if (oldinfo == null) { 361 // should not happen 351 if (plugins != null) { 352 for (PluginInformation pi : plugins) { 353 File downloadedPluginFile = PluginHandler.findUpdatedJar(pi.name); 354 if (downloadedPluginFile == null) { 362 355 continue; 363 356 } 364 oldinfo.updateLocalInfo(newinfo); 365 } catch (PluginException e) { 366 Main.error(e); 357 try { 358 PluginInformation newinfo = new PluginInformation(downloadedPluginFile, pi.name); 359 PluginInformation oldinfo = getPluginInformation(pi.name); 360 if (oldinfo != null) { 361 oldinfo.updateLocalInfo(newinfo); 362 } 363 } catch (PluginException e) { 364 Main.error(e); 365 } 367 366 } 368 367 }
Note:
See TracChangeset
for help on using the changeset viewer.