@Override
	public ListingField getField(ProxyObj<?> proxy, int varWidth) {
		Object obj = proxy.getObject();
		if (!enabled || obj == null || !(obj instanceof Variable)) {
			return null;
		}

		Variable var = (Variable) obj;
		List<Reference> xrefs = new ArrayList<>();
		List<Reference> offcuts = new ArrayList<>();
		XReferenceUtils.getVariableRefs(var, xrefs, offcuts, maxXRefs);

		if (xrefs.size() + offcuts.size() == 0) {
			return null;
		}

		Function func = var.getFunction();
		Program program = func.getProgram();

		// Note: These should always be false since the only references
		//       to stack vars are from inside one functions and memory block.
		displayLocalNamespace = false; //provider.isDisplayFunctionName();
		displayBlockName = false; //provider.isDisplayBlockName();

		int totalXrefs = xrefs.size() + offcuts.size();
		boolean tooMany = totalXrefs > maxXRefs;

		AttributedString delimiter = new AttributedString(delim, Colors.FOREGROUND, getMetrics());

		FieldElement[] elements = new FieldElement[tooMany ? maxXRefs : totalXrefs];
		int count = 0;

		for (; count < xrefs.size() && count < elements.length; count++) {
			Reference reference = xrefs.get(count);
			String prefix = getPrefix(program, reference, func);
			AttributedString as = new AttributedString(reference.getFromAddress().toString(prefix),
				XrefColors.DEFAULT, getMetrics());
			if (displayRefType) {
				as = createRefTypeAttributedString(reference, as);
			}
			if (count < totalXrefs - 1) {
				as = new CompositeAttributedString(new AttributedString[] { as, delimiter });
			}
			else {
				// This added to prevent a situation where resizing field to a particular size, resulted in layout of references to be strange
				char[] charSpaces = new char[delimiter.length()];
				Arrays.fill(charSpaces, ' ');
				AttributedString spaces =
					new AttributedString(new String(charSpaces), XrefColors.DEFAULT, getMetrics());
				as = new CompositeAttributedString(new AttributedString[] { as, spaces });
			}
			elements[count] = new TextFieldElement(as, count, 0);
		}

		for (int i = 0; i < offcuts.size() && count < elements.length; i++, count++) {
			Reference ref = offcuts.get(i);
			String prefix = getPrefix(program, ref, func);
			AttributedString as = new AttributedString(ref.getFromAddress().toString(prefix),
				XrefColors.OFFCUT, getMetrics());
			if (displayRefType) {
				as = createRefTypeAttributedString(ref, as);
			}
			if (count < totalXrefs - 1) {
				as = new CompositeAttributedString(new AttributedString[] { as, delimiter });
			}
			else {
				// This added to prevent a situation where resizing field to a particular size, resulted in layout of references to be strange
				char[] charSpaces = new char[delimiter.length()];
				Arrays.fill(charSpaces, ' ');
				AttributedString spaces =
					new AttributedString(new String(charSpaces), XrefColors.OFFCUT, getMetrics());
				as = new CompositeAttributedString(new AttributedString[] { as, spaces });
			}
			elements[count] = new TextFieldElement(as, count, 0);
		}

		if (tooMany) {
			AttributedString as = new AttributedString("[more]", XrefColors.DEFAULT, getMetrics());
			elements[count - 1] = new TextFieldElement(as, count - 1, 0);
		}

		return ListingTextField.createPackedTextField(this, proxy, elements, startX + varWidth,
			width, maxXRefs, hlProvider);
	}
Constructor
@param model the model that the field belongs to.
@param hlProvider the HighlightProvider.
@param displayOptions the Options for display properties.
@param fieldOptions the Options for field specific properties.
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/VariableXRefFieldFactory.java