@Override
	public boolean isAddAllowed(int currentIndex, DataType dataType) {

		if (currentIndex < 0 || currentIndex >= getRowCount()) {
			return false;
		}

		try {

			checkIsAllowableDataType(dataType);
		}
		catch (InvalidDataTypeException e) {
			return false;
		}

		DataTypeComponent comp = getComponent(currentIndex);
		DataType compDt = comp.getDataType();
		boolean existingPointer = (compDt instanceof Pointer);
		boolean isPointer = (dataType instanceof Pointer) || existingPointer;
		int newLength = dataType.getLength();
		// NOTE : Allow the generic pointer, but don't allow -1 length data
		//        types (i.e. string) except on pointers.
		if (!isPointer && (newLength <= 0)) {
			return false;
		}
		if (existingPointer) {
			newLength = compDt.getLength();
		}
		int offset = comp.getOffset();
		int maxBytes = viewComposite.getMaxLength(offset);
		if (newLength > maxBytes) {
			return false;
		}
		return true;
	}
Returns whether or not addition of the specified component is allowed
at the specified index. the addition could be an insert or replace as
determined by the state of the edit model.

@param currentIndex index of the component in the structure.
@param dataType the data type to be inserted.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java