- Timestamp:
- 2018-05-21T13:43:38+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r13799 r13802 50 50 */ 51 51 public void filterDisplayedPlugins(PluginInstallation status) { 52 if (status == null) {53 displayedPlugins.clear();54 displayedPlugins.addAll(availablePlugins);55 this.filterStatus = null;56 return;57 }58 displayedPlugins.clear();59 for (PluginInformation pi: availablePlugins) {60 boolean installed = currentActivePlugins.contains(pi.getName());61 if (PluginInstallation.ALL == status62 || (PluginInstallation.INSTALLED == status && installed)63 || (PluginInstallation.AVAILABLE == status && !installed)) {64 displayedPlugins.add(pi);65 }66 }67 52 filterStatus = status; 68 fireStateChanged();53 doFilter(); 69 54 } 70 55 … … 74 59 */ 75 60 public void filterDisplayedPlugins(String filter) { 76 if (filter == null) { 77 displayedPlugins.clear(); 78 displayedPlugins.addAll(availablePlugins); 79 this.filterExpression = null; 80 return; 81 } 61 filterExpression = filter; 62 doFilter(); 63 } 64 65 private void doFilter() { 82 66 displayedPlugins.clear(); 83 67 for (PluginInformation pi: availablePlugins) { 84 if (pi.matches(filter)) { 68 if ((filterStatus == null || matchesInstallationStatus(pi)) 69 && (filterExpression == null || pi.matches(filterExpression))) { 85 70 displayedPlugins.add(pi); 86 71 } 87 72 } 88 filterExpression = filter;89 73 fireStateChanged(); 74 } 75 76 private boolean matchesInstallationStatus(PluginInformation pi) { 77 boolean installed = currentActivePlugins.contains(pi.getName()); 78 return PluginInstallation.ALL == filterStatus 79 || (PluginInstallation.INSTALLED == filterStatus && installed) 80 || (PluginInstallation.AVAILABLE == filterStatus && !installed); 90 81 } 91 82
Note:
See TracChangeset
for help on using the changeset viewer.