private ProgramSelection getSelection(Program program, AddressSetView addressSetView) {
		AddressSet addressSet = new AddressSet();

		CodeUnitIterator iter = program.getListing().getCodeUnits(addressSetView, true);

		while (iter.hasNext()) {
			CodeUnit cu = iter.next();
			Reference[] memRef = cu.getReferencesFrom();
			for (Reference element : memRef) {
				Address addr = element.getToAddress();
				if (addr.isMemoryAddress()) {
					addressSet.addRange(addr, addr);
				}

			}
		}
		return new ProgramSelection(addressSet);
	}
Method called when the action is invoked.
@param ActionEvent details regarding the invocation of this action
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/select/reference/SelectForwardRefsAction.java