@Override
	public String getOffsetValue(CodeUnit cu) {
		Address addr = cu.getAddress();
		MemoryBlock block = cu.getProgram().getMemory().getBlock(addr);
		String text = "";
		for (MemoryBlockSourceInfo sourceInfo : block.getSourceInfos()) {
			if (sourceInfo.contains(addr)) {
				if (sourceInfo.getFileBytes().isPresent()) {
					FileBytes fileBytes = sourceInfo.getFileBytes().get();
					long offset = sourceInfo.getFileBytesOffset(addr);
					text = String.format(useHex ? "0x%x" : "%d", offset);
					if (showName) {
						text = "%s:%s".formatted(fileBytes.getFilename(), text);
					}
					break;
				}
			}
		}
		return text;
	}
Creates a new {@link FileOffsetFieldFactory}

@param model the {@link FieldFormatModel} that the field belongs to
@param hlProvider the {@link ListingHighlightProvider}
@param displayOptions the {@link Options} for display properties
@param fieldOptions the {@link Options} for field specific properties
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/FileOffsetFieldFactory.java