void (List<? extends XDebuggerTreeNode> nodes) { ThreadingAssertions.assertEventDispatchThread(); List<? extends XDebuggerTreeNode> ordinaryWatches = ContainerUtil.filter(nodes, node -> !(node instanceof InlineWatchNode)); List<? extends XDebuggerTreeNode> inlineWatches = ContainerUtil.filter(nodes, node -> node instanceof InlineWatchNode); if (!inlineWatches.isEmpty()) { removeInlineNodes(inlineWatches, true); } if (ordinaryWatches.isEmpty()) return; List<? extends WatchNode> children = myRootNode.getWatchChildren(); int minIndex = Integer.MAX_VALUE; List<XDebuggerTreeNode> toRemove = new ArrayList<>(); for (XDebuggerTreeNode node : ordinaryWatches) { int index = children.indexOf(node); if (index != -1) { toRemove.add(node); minIndex = Math.min(minIndex, index); } } myRootNode.removeChildren(toRemove); List<? extends WatchNode> newChildren = myRootNode.getWatchChildren(); if (!newChildren.isEmpty()) { WatchNode node = newChildren.get(Math.min(minIndex, newChildren.size() - 1)); TreeUtil.selectNode(getTree(), node); } updateSessionData(); }