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

		FieldFactory[] unusedFactories = formatModel.getUnusedFactories();
		for (FieldFactory unusedFieldFactory : unusedFactories) {
			if (unusedFieldFactory == myFieldFactory) {
				return true;
			}
		}
		return false;
	}
The action for adding a Field to the current format.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/format/actions/AddFieldAction.java