@Override
	public DataTypeComponent add(int rowIndex, DataType dt) throws UsrException {
		String descr = rowIndex < getNumComponents() ? "Replace Component" : "Add Component";
		DataTypeComponent dtc = viewDTM.withTransaction(descr, () -> {
			DataType resolvedDt = viewDTM.resolve(dt, DataTypeConflictHandler.DEFAULT_HANDLER);
			try {
				DataTypeInstance dti = getDropDataType(rowIndex, resolvedDt);
				return add(rowIndex, dti.getDataType(), dti.getLength()); // add or replace
			}
			catch (CancelledException e) {
				return null;
			}
		});

		fixSelection();
//		componentEdited();
		selectionChanged();
		return dtc;
	}
Adds the specified data type at the specified component index. Whether
an insert or replace occurs depends on whether the indicated index is
in a selection and whether in locked or unlocked mode.

@param rowIndex the index of the row where the data type should be added.
@param dt the data type to add

@return true if the component is added, false if it doesn't.
@throws UsrException if add fails
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompEditorModel.java