private Function getFunction(ActionContext context) {

		if (context instanceof ListingActionContext) {
			//
			// Unusual Code: We know that the ListingActionContext is a FunctionSupplierContext. 
			// We also know that this context does not report the current function as specifically
			// as we would like.  So, handle this case ourselves.  The fall-through case will allow
			// this plugin to work in other places like the Decompiler or the Functions window.
			//
			return getFunction(currentLocation);
		}

		if (context instanceof FunctionSupplierContext functionContext) {
			if (functionContext.hasFunctions()) {
				Set<Function> functions = functionContext.getFunctions();
				return CollectionUtils.any(functions);
			}
		}

		ComponentProvider provider = context.getComponentProvider();
		if (!(provider instanceof CallTreeProvider)) {
			return null; // only use the current location when in our provider
		}

		return getFunction(currentLocation);
	}
Assuming a function <b>foo</b>, this plugin will show:
 1) all callers of <b>foo</b> 
 2) all functions which reference <b>foo</b>
 3) all callees of <b>foo</b>
 4) all functions referenced by <b>foo</b>.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/calltree/CallTreePlugin.java