private Address getAddress(ActionContext context) {
		Object contextObject = context.getContextObject();
		if (MarkerLocation.class.isAssignableFrom(contextObject.getClass())) {
			return ((MarkerLocation) contextObject).getAddr();
		}
		else if (context instanceof ListingActionContext) {
			return ((ListingActionContext) context).getAddress();
		}
		return null;
	}
Method called when the action is invoked.

@param ActionEvent details regarding the invocation of this action
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/bookmark/AddBookmarkAction.java