@Override
	public boolean isValidContext(ActionContext context) {
		if (!(context.getContextObject() instanceof FieldHeaderLocation)) {
			return false;
		}

		FieldHeaderLocation loc = (FieldHeaderLocation) context.getContextObject();
		FieldFormatModel modelAtLocation = loc.getModel();
		return (modelAtLocation == formatModel);
	}
The action for adding a Field to the current format.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/format/actions/AddFieldAction.java