private void merge(ProgramTreeActionContext context) {
		synchronized (root) {

			CompoundCmd<Program> cmd = new CompoundCmd<>("Merge with Parent");
			ProgramDnDTree tree = context.getTree();
			String treeName = tree.getTreeName();
			TreePath[] paths = context.getSelectionPaths();
			for (TreePath path : paths) {

				ProgramNode node = (ProgramNode) path.getLastPathComponent();
				tree.removeSelectionPath(path);
				ProgramNode parentNode = (ProgramNode) node.getParent();
				if (node.isModule() && parentNode != null) {
					cmd.add(new MergeFolderCmd(treeName, node.getName(), parentNode.getName()));
				}
			}

			PluginTool tool = plugin.getTool();
			if (!tool.execute(cmd, program)) {
				tool.setStatusInfo(cmd.getStatusMsg());
			}
		}
	}
Merge a module with its parent. The module is deleted if it has
no other parents; called by the action listener on a menu.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeActionManager.java