private String addNamespace(Program program, Namespace parentNamespace, String name,
			Address markupAddress) {
		if (parentNamespace == null) {
			return name;
		}

		if (options.showNamespace == ShowNamespace.NEVER) {
			return name;
		}

		if (parentNamespace.getID() == Namespace.GLOBAL_NAMESPACE_ID) {
			return name;
		}

		SymbolTable symbolTable = program.getSymbolTable();
		Namespace toNamespace = symbolTable.getNamespace(markupAddress);
		boolean isLocal = parentNamespace.equals(toNamespace);
		if (isLocal && options.showNamespace == ShowNamespace.NON_LOCAL) {
			// do not show namespace for local labels
			return name;
		}
		else if (!isLocal && options.showNamespace == ShowNamespace.LOCAL) {
			// do not show namespace for non-local labels
			return name;
		}

		String namespaceName = null;
		if (isLocal) {
			namespaceName = options.localPrefixOverride;
		}
		if (namespaceName == null) {
			if (!options.showLibraryInNamespace) {
				namespaceName = NamespaceUtils.getNamespacePathWithoutLibrary(parentNamespace);
			}
			else {
				namespaceName = parentNamespace.getName(true);
			}
		}
		if (namespaceName.length() != 0 && !namespaceName.endsWith(Namespace.DELIMITER)) {
			namespaceName += Namespace.DELIMITER;
		}
		return namespaceName + name;
	}
Get a LabelString object which corresponds to the specified memory
reference from the specified code unit. Format options are considered
when generating label.

@param fromCodeUnit code unit
@param ref memory reference
@return LabelString representation object
Ghidra/Features/Base/src/main/java/ghidra/program/model/listing/CodeUnitFormat.java