Skip to content

Commit

Permalink
Cherrypick 673a0deab1b798e881edb5e0b0853f9d880fa665
Browse files Browse the repository at this point in the history
' fix for #3230 '
Picked to resolve breaking auto-merging following commit
  • Loading branch information
RoiArthurB committed Feb 10, 2022
1 parent 6d3331b commit c0f1016
Showing 1 changed file with 13 additions and 1 deletion.
Expand Up @@ -156,7 +156,11 @@ private boolean internalSelect(final VirtualContent<?> element, final boolean co

/** The tree viewer. */
CommonViewer treeViewer;


/** List of expanded elements at the start of a search
* used internally to restore the state before search**/
private Object[] expandedElementsBeforeSearch = null;

/** The filter. */
final NamePatternFilter filter = new NamePatternFilter();

Expand Down Expand Up @@ -268,6 +272,9 @@ public IStatus runInUIThread(final IProgressMonitor monitor) {
* Do search.
*/
public void doSearch() {
if(expandedElementsBeforeSearch == null) {
expandedElementsBeforeSearch = treeViewer.getExpandedElements();
}
treeViewer.getControl().setRedraw(false);
filter.reset();
if (!Arrays.asList(treeViewer.getFilters()).contains(filter)) {
Expand All @@ -289,6 +296,11 @@ public void resetSearch() {
} else {
treeViewer.refresh(false);
}
if(expandedElementsBeforeSearch != null) {
treeViewer.collapseAll();
treeViewer.setExpandedElements(expandedElementsBeforeSearch);
expandedElementsBeforeSearch = null;
}
treeViewer.getControl().setRedraw(true);
}

Expand Down

0 comments on commit c0f1016

Please sign in to comment.