@Override
	protected boolean isEnabledForContext(ListingActionContext context) {
		if (context.hasSelection() || context.getAddress() == null) {
			return false;
		}
		ProgramLocation loc = context.getLocation();
		if (!isFunction && loc instanceof VariableLocation) {
			Variable variable = ((VariableLocation) loc).getVariable();
			if (variable.getSymbol() == null) {
				return false; // return param has no symbol and can't be renamed
			}
			setPopupMenuPath((variable instanceof Parameter) ? "Parameter" : "Local Variable",
				FunctionPlugin.VARIABLE_MENU_PULLRIGHT, FunctionPlugin.VARIABLE_MENU_SUBGROUP);
			return true;
		}
		else if (isFunction && loc instanceof FunctionSignatureFieldLocation) {
			return true;
		}
		else if (isFunction && loc instanceof OperandFieldLocation) {
			Function function = functionPlugin.getFunctionInOperandField(context.getProgram(),
				(OperandFieldLocation) loc);
			return function != null && !function.isExternal();
		}
		return false;
	}
the plugin associated with this action.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditNameAction.java