I have an Outline view in my application which is updated by an editor.
At the moment each time the editor is updated the Outline view is redrawn.
The problem is that each time a redraw event occurs all nodes of the Tree implementation are expanded, too. I would rather prefer that unfolded Tree nodes stay unfolded if a redraw event occurs. I tried to use:
Object[] expanded = contentOutlineViewer.getExpandedElements();
and after
viewer.setExpandedElements(elements);
but that didn't works with expanded or folded tree nodes
Here is my base implementation:
public void outlineInputChanged(ClassModel classModelOld, ClassModel classModelNew) {
if (contentOutlineViewer != null) {
TreeViewer viewer = contentOutlineViewer;
if (viewer != null) {
Control control = viewer.getControl();
if (control != null && !control.isDisposed()) {
control.setRedraw(false);
viewer.setInput(classModelNew);
viewer.expandAll();
control.setRedraw(true);
}
}
}
Is there any solution to store the expanded and folded tree elements and restore them after a redraw event?
Any help is appreciated.