@Override
	protected boolean isEnabledForContext(ProgramActionContext context) {

		if (context instanceof ListingActionContext) {
			ListingActionContext listingContext = (ListingActionContext) context;
			if (listingContext.hasSelection() || listingContext.getAddress() == null) {
				return false;
			}
			ProgramLocation location = listingContext.getLocation();
			if ((location instanceof FunctionLocation)) {
				return true;
			}
			if (location instanceof OperandFieldLocation) {
				Function function = functionPlugin.getFunctionInOperandField(context.getProgram(),
					(OperandFieldLocation) location);
				return function != null;
			}
		}
		else if (context instanceof ProgramSymbolActionContext) {
			ProgramSymbolActionContext symbolContext = (ProgramSymbolActionContext) context;
			if (symbolContext.getSymbolCount() != 1) {
				return false;
			}
			Symbol s = symbolContext.getFirstSymbol();
			if (s == null || s.getSymbolType() != SymbolType.FUNCTION) {
				return false;
			}
			Function function = (Function) s.getObject();
			return function != null;
		}
		return false;
	}
Method called when the action is invoked.
@param ev details regarding the invocation of this action
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/EditFunctionAction.java