@Override
	protected DataTypeAndFields getSelectedType(ActionContext context) {
		if (!(context instanceof DataTypesActionContext)) {
			return null;
		}

		Object contextObject = context.getContextObject();
		GTree gtree = (GTree) contextObject;
		TreePath[] selectionPaths = gtree.getSelectionPaths();
		if (selectionPaths.length != 1) {
			return null;
		}

		GTreeNode node = (GTreeNode) selectionPaths[0].getLastPathComponent();
		if (!(node instanceof DataTypeNode)) {
			return null;
		}
		DataTypeNode dtNode = (DataTypeNode) node;
		DataType dt = dtNode.getDataType();
		if (!(dt instanceof Composite || dt instanceof Enum)) {
			return null;
		}

		String[] fields = null;
		if (dt instanceof Composite) {
			fields = getCompositeFieldNames((Composite) dt);
		}
		else if (dt instanceof Enum) {
			fields = ((Enum) dt).getNames();
		}

		return new DataTypeAndFields(dt, fields);
	}
An action that can be used on a {@link Composite} or {@link Enum} to find references to a field
by name or offset.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/FindReferencesToFieldByNameOrOffsetAction.java