final boolean expanded = grp.getExpanded();
final boolean visible = grp.getVisible();
final boolean filterChanged = !objectEquals(filter, lastFilter);
+ final ISymbolGroup symbolGroup = (ISymbolGroup) grp.getData(SymbolLibraryKeys.KEY_GROUP);
+ final boolean filterMatchesGroup = filter != null && filter.select(viewer, null, symbolGroup);
// Find out how much data would be shown with the new filter.
- viewer.setFilter(filter);
+ viewer.setFilter(filterMatchesGroup ? null : filter);
Object[] elements = viewer.getFilteredElements();
- ISymbolGroup symbolGroup = (ISymbolGroup) grp.getData(SymbolLibraryKeys.KEY_GROUP);
- boolean filterMatchesGroup = filter != null && filter.select(viewer, null, symbolGroup);
boolean shouldBeVisible = !groupFiltered && (elements.length > 0 || filterMatchesGroup);
boolean shouldBeExpanded = shouldBeVisible && (filter != null || userExpanded);
-// System.out.format("%40s: visible/should be = %5s %5s, expanded/user expanded/should be = %5s %5s %5s\n",
+// System.out.format("%40s: filterMatchesGroup(%s) = %s, visible/should be = %5s %5s, expanded/user expanded/should be = %5s %5s %5s\n",
// grp.getText(),
+// symbolGroup.getName(),
+// String.valueOf(filterMatchesGroup),
// String.valueOf(visible),
// String.valueOf(shouldBeVisible),
// String.valueOf(expanded),