public void removeWatch(DebuggerTreeNodeImpl node) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    LOG.assertTrue(node.getDescriptor() instanceof WatchItemDescriptor);

    DebuggerTreeNodeImpl root = (DebuggerTreeNodeImpl) getModel().getRoot();
    DebuggerTreeNodeImpl nodeToSelect = (DebuggerTreeNodeImpl) node.getNextSibling();

    getMutableModel().removeNodeFromParent(node);
    treeChanged();

    if (nodeToSelect == null && root.getChildCount() > 0) {
      nodeToSelect = (DebuggerTreeNodeImpl) root.getChildAt(root.getChildCount() - 1);
    }

    if (nodeToSelect != null) {
      setSelectionPath(new TreePath(nodeToSelect.getPath()));
    }
  }
  public DebuggerTreeNodeImpl[] getWatches() {
    DebuggerTreeNodeImpl root = (DebuggerTreeNodeImpl) getModel().getRoot();
    DebuggerTreeNodeImpl[] watches = new DebuggerTreeNodeImpl[root.getChildCount()];

    final Enumeration e = root.children();
    int i = 0;
    while (e.hasMoreElements()) {
      watches[i++] = (DebuggerTreeNodeImpl) e.nextElement();
    }

    return watches;
  }
 public int getWatchCount() {
   DebuggerTreeNodeImpl root = (DebuggerTreeNodeImpl) getModel().getRoot();
   return root != null ? root.getChildCount() : 0;
 }