protected DataTypeComponent replaceComponentRange(int startRowIndex, int endRowIndex,
			DataType datatype, int length) throws UsrException {
		if (isEditingField()) {
			endFieldEditing();
		}

		if (!isShowingUndefinedBytes() && (startRowIndex == getNumComponents())) {
			// Insert if at blank last line.
			return insert(startRowIndex, datatype, length);
		}

		DataTypeComponent oldDtc = getComponent(startRowIndex);
		if (oldDtc == null) {
			throw new AssertException();
		}

		checkIsAllowableDataType(datatype);

		//
		// Note: if the range being replaced is large enough, then the UI could lock-up.  If we
		//       find that is the case, then we can update this method to take in a task monitor
		//       and update the clients accordingly.  For now, it does not seem worth the effort.
		//
		TaskMonitor monitor = TaskMonitor.DUMMY;

		replaceRange(startRowIndex, endRowIndex, datatype, length, monitor);
		DataTypeComponent dtc = getComponent(startRowIndex);

		// Set the field name and comment the same as before
		try {
			dtc.setFieldName(oldDtc.getFieldName());
		}
		catch (DuplicateNameException e) {
			Msg.showError(this, null, "Unexcected Exception", "Exception applying field name", e);
		}
		dtc.setComment(oldDtc.getComment());
		fixSelection();
		selectionChanged();
		return dtc;
	}
Replaces the range of components between the start and end index (inclusive).
The existing field name and comment are retained for the component at startIndex.
The selection is adjusted and change notification occurs.
@param startRowIndex the start index
@param endRowIndex the end index
@param datatype the data type
@param length the length of the range
@return the newly create component
@throws UsrException if there is an exception replacing
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompEditorModel.java