private Set<Reference> getVariableRefs(Variable var) {

		Set<Reference> results = new HashSet<>();
		Address addr = var.getMinAddress();
		if (addr == null) {
			return results;
		}

		Program program = var.getFunction().getProgram();
		ReferenceManager refMgr = program.getReferenceManager();
		Reference[] refs = refMgr.getReferencesTo(var);
		for (Reference vref : refs) {
			results.add(vref);
		}
		return results;
	}
A handler to process {@link VariableXRefFieldLocation} clicks
Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/VariableXRefFieldMouseHandler.java