@Override
	public void processEvent(PluginEvent event) {
		if (event instanceof ProgramActivatedPluginEvent) {
			favoritesUpdateManager.updateLater();
		}
	}
The FunctionPlugin allows creation of a function from the current selection.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/FunctionPlugin.java