private TypeDef findPreexistingTypeDef(Program program) throws InvalidDataTypeException {
		DataTypeManager dtm = program.getDataTypeManager();
		DataType dt = dtm.getDataType(userPath, userName);
		if (dt == null) {
			return null;
		}
		if (!(dt instanceof TypeDef)) {
			throw new InvalidDataTypeException("Data-type " + userName + " already exists");
		}
		TypeDef res = (TypeDef) dt;
		if (!(res.getDataType() instanceof Pointer)) {
			throw new InvalidDataTypeException(
				"Data-type " + userName + " already exists and is not a pointer TypeDef");
		}
		DataType baseType = ((Pointer) res.getDataType()).getDataType();
		if (!userDataType.getName().equals(baseType.getName()) ||
			!userDataType.getCategoryPath().equals(baseType.getCategoryPath())) {
			throw new InvalidDataTypeException(
				"Data-type " + userName + " already exists and has a different base");
		}
		return res;
	}
Assuming the dialog has filled in the desired name and category of the relative pointer, as 
well as the baseType, search for a preexisting TypeDef data-type that matches the name. 
If no TypeDef is found return null.  If a TypeDef is found but it is not a pointer to
the baseType, throw an exception. Otherwise return the TypeDef.
@param program is the Program in which to search
@return the matching TypeDef or null
@throws InvalidDataTypeException if a mismatched TypeDef already exists
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/CreatePointerRelative.java