@Override
	public DataType replaceDataType(DataType existingViewDt, DataType replacementDt,
			boolean updateCategoryPath) throws DataTypeDependencyException {

		if (existingViewDt.getDataTypeManager() != this) {
			throw new IllegalArgumentException("datatype is not from this manager");
		}

		if (existingViewDt instanceof DatabaseObject) {
			dataTypeIDMap.remove(getID(existingViewDt));
		}

		DataType newResolvedDt =
			super.replaceDataType(existingViewDt, replacementDt, updateCategoryPath);

		if (newResolvedDt instanceof DatabaseObject &&
			replacementDt.getDataTypeManager() == originalDTM) {
			long originalId = originalDTM.getID(replacementDt);
			long myId = getID(newResolvedDt);
			dataTypeIDMap.put(myId, originalId);
		}

		return newResolvedDt;
	}
Get the {@link DataTypeManager} associated with the original composite datatype being edited.
@return original datatype manager
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/CompositeViewerDataTypeManager.java