@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);
    }
  }
 private void disposeIfFinished() {
   if (myNode2ParentState.isEmpty() && myNode2State.isEmpty()) {
     if (myLastVisibleNodeRect != null) {
       myTree.scrollRectToVisible(myLastVisibleNodeRect);
     }
     dispose();
   }
 }