private boolean pasteFragment(ProgramDnDTree tree, ProgramNode nodeToPaste,
			ProgramModule targetModule, ProgramFragment fragment)
			throws NotFoundException, DuplicateGroupException {
		boolean pasteOK = false;

		if (targetModule.contains(fragment)) {
			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(fragment);
			pasteOK = true;
		}
		return pasteOK;
	}
Paste the fragment at the given module.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/PasteManager.java