@Override
	protected void actionPerformed(ListingActionContext context) {
		ProgramLocation loc = context.getLocation();

		if ((loc instanceof FunctionSignatureFieldLocation) || (loc instanceof VariableLocation)) {

			Function function = functionPlugin.getFunction(context);
			if ((function != null) && (!function.hasVarArgs())) {
				Command<Program> command = new SetFunctionVarArgsCommand(function, true);

				PluginTool tool = functionPlugin.getTool();
				Program program = context.getProgram();

				if (!tool.execute(command, program)) {
					tool.setStatusInfo("Unable to add function varArgs on " + "function: " +
						function.getName());
				}
			}
		}
	}
Action that changes a Function so that it has VarArgs (a variable argument list).
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AddVarArgsAction.java