private ArrayList<TreePath> getExpandedPaths(ProgramNode node) {

		ArrayList<TreePath> list = new ArrayList<>();

		int nchild = node.getChildCount();
		for (int i = 0; i < nchild; i++) {
			ProgramNode child = (ProgramNode) node.getChildAt(i);
			TreePath path = child.getTreePath();
			if (isExpanded(path)) {
				list.add(path);
				ArrayList<TreePath> templist = getExpandedPaths(child);
				list.addAll(templist);
			}
		}
		return list;
	}
Get a list of paths that are expanded, starting at node.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramDnDTree.java