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

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

		if (selectionPaths.length == 0) {
			return false;
		}

		for (TreePath path : selectionPaths) {
			GTreeNode node = (GTreeNode) path.getLastPathComponent();
			if (node.isLeaf()) {
				return false;
			}
		}
		return true;
	}
This action handles recursively expanding the selected nodes in the dataTypes tree.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/ExpandAllAction.java