From: Tuukka Lehtonen Date: Sat, 18 Mar 2017 13:33:33 +0000 (+0200) Subject: Symbol filter changed to show whole group when filter matches group name X-Git-Tag: v1.28.0~54 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F65%2F365%2F1;p=simantics%2Fplatform.git Symbol filter changed to show whole group when filter matches group name refs #7098 Change-Id: I3c3fa87b711f3791787e59207a0e50e479a13152 --- diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java index 7d172318b..4ec3258a7 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java @@ -987,18 +987,20 @@ public class SymbolLibraryComposite extends Composite { 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),