@Override
	public void actionPerformed(ProgramActionContext context) {

		Program program = context.getProgram();

		FunctionManager functionMgr = program.getFunctionManager();
		Function func;
		if (context instanceof ListingActionContext) {
			ListingActionContext listingContext = (ListingActionContext) context;
			func = functionMgr.getFunctionAt(listingContext.getAddress());
		}
		else if (context instanceof ProgramSymbolActionContext) {
			ProgramSymbolActionContext symbolContext = (ProgramSymbolActionContext) context;
			Symbol symbol = symbolContext.getFirstSymbol();
			if (symbol == null) {
				return; // assume symbol removed
			}
			func = (Function) symbol.getObject();
		}
		else {
			throw new RuntimeException("Invalid context for action");
		}

		if (func == null) {
			return;
		}
		Address funcEntry = func.getEntryPoint();

		Function refFunc = func.getThunkedFunction(false);		
		if (refFunc == null) {
			// if not already thunked, fill in a possible value from functions instructions
			Address thunkAddr = CreateThunkFunctionCmd.getThunkedAddr(program, funcEntry, false);
			if (thunkAddr != null) {
				refFunc = functionMgr.getFunctionAt(thunkAddr);
			}
		}		
		Symbol refSymbol = (refFunc == null ? null : refFunc.getSymbol());

		// Prompt for function referenced by thunk
		ThunkReferenceAddressDialog dialog = new ThunkReferenceAddressDialog(funcPlugin.getTool());
		dialog.showDialog(program, funcEntry, refSymbol);
		Symbol referencedSymbol = dialog.getSymbol();
		Address referencedFunctionAddr = dialog.getAddress();

		CreateThunkFunctionCmd cmd;
		if (referencedSymbol != null) {
			cmd = new CreateThunkFunctionCmd(funcEntry, null, referencedSymbol);
		}
		else if (referencedFunctionAddr != null) {
			cmd = new CreateThunkFunctionCmd(funcEntry, null, referencedFunctionAddr);
		}
		else {
			return; // cancelled
		}
		funcPlugin.execute(context.getProgram(), cmd);
	}
Create a new action, to edit a thunk function at the current location
@param plugin  does checking for this action
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditThunkFunctionAction.java