private boolean reorderChildren(ProgramNode destNode, ProgramNode dropNode,
			int relativeMousePos) {

		boolean didReorder = false;

		int index = 0;
		ProgramNode parentNode = (ProgramNode) destNode.getParent();
		ProgramModule dropParentModule = dropNode.getParentModule();
		ProgramModule targetModule = destNode.getModule();

		if (parentNode.equals(dropNode.getParent())) {
			didReorder = true;
			targetModule = parentNode.getModule();
			int myIndex = parentNode.getIndex(dropNode);

			index = parentNode.getIndex(destNode);
			if (relativeMousePos < 0 && myIndex < index) {
				--index;
			}
			else if (relativeMousePos > 0 && myIndex > index) {
				++index;
			}
			Group group = dropNode.getGroup();
			ReorderModuleCmd cmd = new ReorderModuleCmd(tree.getTreeName(), targetModule.getName(),
				group.getName(), index);

			if (tree.getTool().execute(cmd, tree.getProgram())) {
				tree.reorder(group, dropParentModule, index);
				ProgramNode child = (ProgramNode) parentNode.getChildAt(index);
				addToSelection(child);
			}
			else {
				Msg.showError(this, tree, "Error Moving Child", cmd.getStatusMsg());
			}
		}
		return didReorder;
	}
Reorder children with the same module.
@return true if reordering was done; false if no changes
were made
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ReorderManager.java