@Override
  public void processSessionEvent(@NotNull final SessionEvent event) {
    XStackFrame stackFrame = mySession.getCurrentStackFrame();
    XDebuggerTree tree = myTreePanel.getTree();

    if (event == SessionEvent.BEFORE_RESUME || event == SessionEvent.SETTINGS_CHANGED) {
      if (myTreeRestorer != null) {
        myTreeRestorer.dispose();
      }
      myTreeState = XDebuggerTreeState.saveState(tree);
      if (event == SessionEvent.BEFORE_RESUME) {
        return;
      }
    }

    if (stackFrame != null) {
      tree.setSourcePosition(stackFrame.getSourcePosition());
      myRootNode.updateWatches(stackFrame.getEvaluator());
      if (myTreeState != null) {
        myTreeRestorer = myTreeState.restoreState(tree);
      }
    } else {
      tree.setSourcePosition(null);
      myRootNode.updateWatches(null);
    }
  }
 public XDebuggerTreeRestorer restoreState(@NotNull XDebuggerTree tree) {
   ApplicationManager.getApplication().assertIsDispatchThread();
   XDebuggerTreeRestorer restorer = new XDebuggerTreeRestorer(tree, myLastVisibleNodeRect);
   restorer.restoreChildren(((XDebuggerTreeNode) tree.getTreeModel().getRoot()), myRootInfo);
   return restorer;
 }