From a818c615395cd5991feef83dba8da4c4045de0e1 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Sat, 18 Mar 2017 15:33:33 +0200 Subject: [PATCH] Symbol filter changed to show whole group when filter matches group name refs #7098 Change-Id: I3c3fa87b711f3791787e59207a0e50e479a13152 --- .../symbollibrary/ui/SymbolLibraryComposite.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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), -- 2.47.1