From: jsimomaa Date: Thu, 4 Jan 2018 11:24:45 +0000 (+0200) Subject: Fixing duplicate entries from SCL search result page X-Git-Tag: v1.43.0~136^2~634 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F50%2F1350%2F4;p=simantics%2Fplatform.git Fixing duplicate entries from SCL search result page refs #7683 Change-Id: Ie57502323d18be7106f1264688b2a500bc37465d --- diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java index 86b3ea4a3..f38d8d539 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/search/SCLSearchResultPage.java @@ -1,15 +1,17 @@ package org.simantics.scl.ui.search; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider; import org.eclipse.jface.viewers.DecorationContext; -import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; import org.eclipse.jface.viewers.IColorProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ILabelProviderListener; @@ -21,7 +23,6 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; import org.eclipse.search.ui.text.AbstractTextSearchResult; import org.eclipse.search.ui.text.AbstractTextSearchViewPage; import org.eclipse.search.ui.text.Match; @@ -31,7 +32,6 @@ import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.simantics.scl.compiler.errors.Locations; import org.simantics.scl.compiler.module.debug.SymbolReference; -import org.simantics.scl.ui.editor2.OpenDeclaration; import org.simantics.scl.ui.editor2.OpenSCLDefinition; public class SCLSearchResultPage extends AbstractTextSearchViewPage { @@ -145,6 +145,17 @@ public class SCLSearchResultPage extends AbstractTextSearchViewPage { Set toRemove= new HashSet<>(); Set toUpdate= new HashSet<>(); Map> toAdd= new HashMap<>(); + + // TODO: Clear this for now at this point but probably this has some + // side-effects once nested children can be shown, never? + for (Entry> e : fChildrenMap.entrySet()) { + Collection refs = (Collection) e.getValue(); + refs.forEach(r -> { + remove(toRemove, toUpdate, r); + }); + } + + for (int i= 0; i < updatedElements.length; i++) { if (getPage().getDisplayedMatchCount(updatedElements[i]) > 0) insert(toAdd, toUpdate, updatedElements[i]);