protected boolean setComponentDataType(int rowIndex, Object dataTypeObject)
			throws UsrException {

		boolean success = viewDTM.withTransaction("Set Datatype", () -> {
			DataType previousDt = null;
			int previousLength = 0;
			String dtName = "";
			DataTypeComponent element = getComponent(rowIndex);
			if (element != null) {
				previousDt = element.getDataType();
				previousLength = element.getLength();
				dtName = previousDt.getDisplayName();
			}
			DataType newDt = null;
			int newLength;
			if (dataTypeObject instanceof DataTypeInstance dti) {
				newDt = dti.getDataType();
				newLength = dti.getLength();
			}
			else if (dataTypeObject instanceof DataType dt) {
				newDt = dt;
				newLength = newDt.getLength();
			}
			else if (dataTypeObject instanceof String dtString) {
				if (dtString.equals(dtName)) {
					return false;
				}
				newDt = DataTypeHelper.parseDataType(rowIndex, dtString, this, originalDTM,
					provider.dtmService);
				newLength = newDt.getLength();
			}
			if (newDt == null) {
				return false; // Was nothing and is nothing.
			}

			if (DataTypeComponent.usesZeroLengthComponent(newDt)) {
				newLength = 0;
			}

			newDt = newDt.clone(viewDTM);
			newLength = newDt.getLength();

			checkIsAllowableDataType(newDt);

			if (newLength < 0) {
				// prefer previous size first
				int suggestedLength = (previousLength <= 0) ? lastNumBytes : previousLength;
				DataTypeInstance sizedDataType = DataTypeHelper.getSizedDataType(provider, newDt,
					suggestedLength, getMaxReplaceLength(rowIndex));
				if (sizedDataType == null) {
					return false;
				}
				newLength = sizedDataType.getLength();
				if (newLength <= 0) {
					throw new UsrException("Can't currently add this data type.");
				}
				newDt = sizedDataType.getDataType();
			}

			if ((previousDt != null) && newDt.isEquivalent(previousDt) &&
				newLength == previousLength) {
				return false;
			}

			int maxLength = getMaxReplaceLength(rowIndex);
			if (maxLength > 0 && newLength > maxLength) {
				throw new UsrException(newDt.getDisplayName() + " doesn't fit within " + maxLength +
					" bytes, need " + newLength + " bytes");
			}

			// Set component datatype and length on view composite
			setComponentDataTypeInstance(rowIndex, newDt, newLength);
			return true;
		});

		if (success) {
			notifyCompositeChanged();
		}
		return success;
	}
Sets the data type for the component at the indicated rowIndex.
@param rowIndex the row index of the component
@param dataTypeObject a String or a DataType
@return true if changed
@throws UsrException if the type cannot be used
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeEditorModel.java