@Override
	/**
	 * Only shows up if all selected nodes are collapsable.
	 */
	public boolean isEnabledForContext(ActionContext context) {
		if (!(context instanceof DataTypesActionContext)) {
			updatePopupMenu(false);
			return false;
		}

		Object contextObject = context.getContextObject();
		GTree gtree = (GTree) contextObject;
		TreePath[] selectionPaths = gtree.getSelectionPaths();

		if (selectionPaths.length == 0) {
			updatePopupMenu(false); // Collapse All when nothing is selected
		}
		else if (selectionPaths.length == 1) {
			updatePopupMenu(true); // collapse single node with children
		}
		else {
			updatePopupMenu(false); // Collapse All when multiple nodes
		}

		return true;
	}
This action handles recursively collapsing nodes in the dataTypes tree.  If invoked from the
local toolbar icon, it collapses all nodes in the tree.  If invoked from the popup, it only
collapses the selected nodes.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/CollapseAllArchivesAction.java