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

			String errMsg = null;

			// sync program so we don't get a deadlock --
			// an event gets generated because of the add module.
			synchronized (program) {
				ProgramDnDTree tree = context.getTree();
				String name = tree.getNewFragmentName();
				String treeName = tree.getTreeName();
				ProgramNode node = context.getSingleSelectedNode();
				CreateFragmentCmd cmd = new CreateFragmentCmd(treeName, name, node.getName());
				if (tree.getTool().execute(cmd, program)) {
					ProgramFragment f = program.getListing().getFragment(treeName, name);
					initiateCellEditor(tree, node, f);
				}
				else {
					errMsg = cmd.getStatusMsg();
				}
			}
			if (errMsg != null) {
				Msg.showError(this, null, "Create Fragment Failed", errMsg);
			}
		}
	}
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