@Test
	public void testCopyPasteActionEnabled() throws Exception {

		ProgramNode node = (ProgramNode) root.getChildAt(0);
		setSelectionPath(node);
		assertTrue(copyAction.isEnabled());
		performTreeAction(copyAction);

		setSelectionPath(root);

		// fragment is already in root
		assertFalse(pasteAction.isEnabled());

		// cannot paste fragment to another fragment
		node = (ProgramNode) root.getChildAt(1);
		setSelectionPath(root);
		assertFalse(pasteAction.isEnabled());

		expandNode(root);

		// destination folder is a descendant of the copied folder
		node = (ProgramNode) root.getChildAt(9);
		setSelectionPath(node);
		assertTrue(copyAction.isEnabled());

		performTreeAction(copyAction);
		ProgramNode[] nodes = findNodes("C");
		setSelectionPath(nodes[0]);

		assertFalse(pasteAction.isEnabled());

		// fragment is already in the destination folder
		tx(program, () -> {
			ProgramFragment f = program.getListing().getFragment("Main Tree", "USER32.DLL");
			ProgramModule funcModule = program.getListing().getModule("Main Tree", "Functions");
			funcModule.add(f);
		});

		node = (ProgramNode) root.getChildAt(6);// Functions

		ProgramNode fnode = (ProgramNode) node.getChildAt(3);

		// select USER32.DLL
		setSelectionPath(fnode);
		performTreeAction(copyAction);
		// select DLLs
		node = (ProgramNode) root.getChildAt(6);
		setSelectionPath(node);
		assertFalse(pasteAction.isEnabled());

		//cannot copy root
		setSelectionPath(root);
		assertFalse(copyAction.isEnabled());
	}
Tests for cut/copy/paste in the Program tree.
Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/programtree/ProgramTreePlugin2Test.java