void (@NotNull TreePath pathFrom, @NotNull Collection<? super UsageState> states) { ThreadingAssertions.assertEventDispatchThread(); if (!myTree.isExpanded(pathFrom)) { return; } DefaultMutableTreeNode node = (DefaultMutableTreeNode)pathFrom.getLastPathComponent(); int childCount = node.getChildCount(); for (int idx = 0; idx < childCount; idx++) { TreeNode child = node.getChildAt(idx); if (child instanceof UsageNode) { Usage usage = ((UsageNode)child).getUsage(); states.add(new UsageState(usage, myTree.getSelectionModel().isPathSelected(pathFrom.pathByAddingChild(child)))); } else { captureUsagesExpandState(pathFrom.pathByAddingChild(child), states); } } }