I'm trying to save jface TreeViewer expansion state to refresh it after calling setInput() method. I tried getExpandedElements, setExpandedElements, getExpandedTreePaths, setExpandedTreePaths methods of TreeViewer bu it doesn't work.
Object[] expandedElements = viewer.getExpandedElements();
TreePath[] expandedTreePaths = viewer.getExpandedTreePaths();
viewer.setInput();
viewer.setExpandedElements(expandedElements);
viewer.setExpandedTreePaths(expandedTreePaths);