private boolean pasteModule(ProgramDnDTree tree, ProgramNode destNode, ProgramNode nodeToPaste,
			ProgramModule targetModule, ProgramModule module)
			throws NotFoundException, CircularDependencyException, DuplicateGroupException {

		boolean pasteOK = false;

		if (!destNode.wasVisited()) {
			tree.visitNode(destNode);
		}
		if (targetModule.contains(module)) {
			if (targetModule.equals(nodeToPaste.getParentModule())) {
				removeFromClipboard(tree, nodeToPaste);
			}
		}
		else if (actionManager.clipboardContains(nodeToPaste)) {
			targetModule.reparent(nodeToPaste.getName(), nodeToPaste.getParentModule());
			removeFromClipboard(tree, nodeToPaste);
			pasteOK = true;
		}
		else {
			targetModule.add(module);
			pasteOK = true;
		}
		if (pasteOK && tree.isExpanded(destNode.getTreePath())) {
			tree.groupAdded(module); // need to add the
			// group now so that the expansion can be
			// matched
		}
		return pasteOK;
	}
Paste the fragment at the given module.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/PasteManager.java