@SuppressWarnings("unchecked") // cast is OK, it is data that we are expecting
	void paste(ProgramDnDTree tree, ProgramNode destNode) {

		int transactionID = tree.startTransaction("Paste");
		if (transactionID < 0) {
			return;
		}

		TreePath path = destNode.getTreePath();

		// paste from clipboard at path
		Clipboard systemClipboard = GClipboard.getSystemClipboard();
		Transferable t = systemClipboard.getContents(tree);
		try {
			if (t == null ||
				!t.isDataFlavorSupported(ProgramTreeTransferable.localTreeNodeFlavor)) {
				return;
			}

			tree.setBusyCursor(true);
			lastGroupPasted = null;
			List<ProgramNode> list =
				(List<ProgramNode>) t.getTransferData(ProgramTreeTransferable.localTreeNodeFlavor);
			if (list == null) {
				return;
			}

			for (ProgramNode node : list) {
				if (destNode.getRoot() != node.getRoot()) {
					lastGroupPasted = null;
					break;
				}

				if (!destNode.getName().equals(node.getName())) {
					if (pasteGroup(tree, destNode, node)) {
						if (!(destNode.isFragment() && node.isModule())) {
							// this was not a "flatten module" operation
							// so we can leave the busy cursor set
							// until the domain object event comes in
							lastGroupPasted = node.getName();
						}
					}
				}
			}

			if (lastGroupPasted == null) {
				tree.setBusyCursor(false);
			}

			// do "cut" operations now if there are any
			actionManager.cutClipboardNodes(tree);
			tree.removeSelectionPath(path);
			tree.addSelectionPath(path);
		}
		catch (UnsupportedFlavorException e) {
			// data flavor is not supported
			Msg.showError(this, null, "Paste from Clipboard Failed",
				"Data flavor in clipboard is not supported.", e);
		}
		catch (IOException e) {
			// data is no longer available
			Msg.showError(this, null, "Paste from Clipboard Failed",
				"Data is no longer available for paste operation", e);
		}
		catch (Exception e) {
			Msg.showError(this, null, "Unexpected Exception Pasting",
				"Unexpected exception pasting nodes", e);
		}
		finally {
			tree.endTransaction(transactionID, true);
		}
	}
Manage paste operations for the Program Tree.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/PasteManager.java