Function getDestinationFunction() {
		VTSession session = controller.getSession();
		if (session == null) {
			return null;
		}

		Program sourceProgram = session.getDestinationProgram();
		ProgramManager service = destinationTool.getService(ProgramManager.class);
		Program program = service.getCurrentProgram();
		if (sourceProgram != program) {
			return null; // the user has changed programs
		}

		ProgramLocation location = getDestinationLocation();
		if (location == null) {
			return null;
		}

		FunctionManager functionManager = program.getFunctionManager();
		return functionManager.getFunctionContaining(location.getAddress());
	}
Checks whether or not the given tool is currently executing a background
task.

@param tool
           The tool to check.
@return True is the given tool is currently executing a background task;
        False otherwise.
Ghidra/Features/VersionTracking/src/main/java/ghidra/feature/vt/gui/plugin/VTSubToolManager.java