private Function getFunction(ListingActionContext context) {
		ProgramLocation loc = context.getLocation();
		Address address = context.getAddress();
		if (loc instanceof FunctionLocation functionLocation) {
			address = functionLocation.getFunctionAddress();
		}
		if (address == null) {
			return null;
		}
		return context.getProgram().getListing().getFunctionContaining(address);
	}
Creates a new action with the given name and associated to the given
plugin.
@param plugin the plugin this action is associated with.
@param dtmService the data type manager service that tracks favorites and
data type changes.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/EditStackAction.java