@Override
	public boolean isEnabledForContext(ActionContext context) {
		if (hasIncompleteFieldEntry()) {
			return false;
		}
		boolean enabled = false;
		if (model.viewComposite instanceof Structure) {
			boolean isContiguousSelection = model.getSelection().getNumRanges() == 1;
			DataType undefinedDt =
				model.viewComposite.isPackingEnabled() ? Undefined1DataType.dataType
						: DataType.DEFAULT;
			enabled = isContiguousSelection &&
				model.isInsertAllowed(model.getMinIndexSelected(), undefinedDt);
		}
		return enabled;
	}
Action for use in the structure data type editor.
This action has help associated with it.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/InsertUndefinedAction.java