]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Symbol filter changed to show whole group when filter matches group name 65/365/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 18 Mar 2017 13:33:33 +0000 (15:33 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 18 Mar 2017 13:33:33 +0000 (15:33 +0200)
refs #7098

Change-Id: I3c3fa87b711f3791787e59207a0e50e479a13152

bundles/org.simantics.diagram/src/org/simantics/diagram/symbollibrary/ui/SymbolLibraryComposite.java

index 7d172318bf1b8561c009f2ef55086e62ee7037fc..4ec3258a7822554f228ccbf0ddd83af6b8dce909 100644 (file)
@@ -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),