static RefType[] getAllowedRefTypes(Program program, Reference ref) {
		Address toAddr = ref.getToAddress();
		if (toAddr.isStackAddress()) {
			return RefTypeFactory.getStackRefTypes();
		}
		if (toAddr.isRegisterAddress()) {
			return RefTypeFactory.getDataRefTypes();
		}
		if (toAddr.isMemoryAddress()) {
			if (program.getAddressFactory().getDefaultAddressSpace() == toAddr.getAddressSpace() ||
				isComputedFlow(program, ref)) {
				return RefTypeFactory.getMemoryRefTypes();
			}
			return RefTypeFactory.getDataRefTypes();
		}
		if (toAddr.isExternalAddress()) {
			return RefTypeFactory.getExternalRefTypes();
		}
		throw new IllegalArgumentException("Unsupported reference");
	}
Returns the row number containing the specified reference or -1 if not
found.

@param ref reference to find
@return the row
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/references/EditReferencesModel.java