Function getFunction(ListingActionContext context) {
		ProgramLocation loc = context.getLocation();
		Address entry;
		if (loc instanceof FunctionLocation) {
			entry = ((FunctionLocation) loc).getFunctionAddress();
		}
		else {
			entry = context.getAddress();
		}
		if (entry == null) {
			return null;
		}
		return context.getProgram().getListing().getFunctionAt(entry);
	}
Get an iterator over all functions overlapping the current selection.
If there is no selection any functions overlapping the current location.

@param context the context 
@return Iterator over functions
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/FunctionPlugin.java