void matchExpansionState(ProgramNode sourceNode, ProgramNode destNode) {

		if (!sourceNode.getAllowsChildren()) {
			return;
		}
		if (!destNode.wasVisited()) {
			visitNode(destNode);
		}

		if (isExpanded(sourceNode.getTreePath())) {
			expandPath(destNode.getTreePath());
		}

		int nchild = sourceNode.getChildCount();
		for (int i = 0; i < nchild; i++) {
			ProgramNode sNode = (ProgramNode) sourceNode.getChildAt(i);
			if (!sNode.getAllowsChildren()) {
				continue;
			}
			ProgramNode dNode = (ProgramNode) destNode.getChildAt(i);
			if (isExpanded(sNode.getTreePath())) {
				expandPath(dNode.getTreePath());
			}
			matchExpansionState(sNode, dNode);
		}
	}
For all expanded descendants in sourceNode, expand the corresponding
nodes in destNode.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramDnDTree.java