in src/main/java/idea/plugin/psiviewer/view/PsiViewerPanel.java [112:137]
private void resetTree()
{
_tree.getSelectionModel().removeTreeSelectionListener(_treeSelectionListener);
Enumeration expandedDescendants = null;
TreePath path = null;
if (_model.getRoot() != null)
{
expandedDescendants = _tree.getExpandedDescendants(new TreePath(_model.getRoot()));
path = _tree.getSelectionModel().getSelectionPath();
}
_model = new PsiViewerTreeModel(_projectComponent);
_model.setRoot(getRootElement());
_tree.setModel(_model);
if (expandedDescendants != null)
while (expandedDescendants.hasMoreElements())
{
TreePath treePath = (TreePath) expandedDescendants.nextElement();
_tree.expandPath(treePath);
}
_tree.setSelectionPath(path);
_tree.scrollPathToVisible(path);
_tree.getSelectionModel().addTreeSelectionListener(_treeSelectionListener);
}