private boolean isDeleteEnabled(ProgramTreeActionContext context) {

		TreePath[] paths = context.getSelectionPaths();
		if (paths == null) {
			return false;
		}

		for (TreePath element : paths) {
			ProgramNode node = (ProgramNode) element.getLastPathComponent();
			if (node.isFragment()) {
				ProgramFragment f = node.getFragment();

				if (f.isEmpty() || (!f.isEmpty() && node.getFragment().getNumParents() > 1)) {
					return true;
				}
			}
			else {
				ProgramModule m = node.getModule();
				if (m.getNumChildren() == 0 || m.getNumParents() > 1) {
					return true;
				}
			}
		}

		return false;
	}
Update the view list if the given path is an ancestor of any of the paths currently 
in the view; remove the descendant and add the ancestor path. 
@param tree the tree
@param path path the check against the view list
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/programtree/ProgramTreeActionManager.java