@ExportedBean public abstract class Actionable extends AbstractModelObject implements ModelObjectWithContextMenu
ModelObject
that can have additional Action
s.ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem
Constructor and Description |
---|
Actionable() |
Modifier and Type | Method and Description |
---|---|
void |
addAction(Action a)
Adds a new action.
|
ModelObjectWithContextMenu.ContextMenu |
doContextMenu(org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
Generates the context menu.
|
<T extends Action> |
getAction(Class<T> type)
Gets the action (first instance to be found) of a specified type that contributed to this build.
|
Action |
getAction(int index)
Deprecated.
No clear purpose, since subclasses may have overridden
getActions() , and does not consider TransientActionFactory . |
List<Action> |
getActions()
Deprecated.
Normally outside code should not call this method any more.
Use
getAllActions() , or addAction(hudson.model.Action) , or replaceAction(hudson.model.Action) .
May still be called for compatibility reasons from subclasses predating TransientActionFactory . |
<T extends Action> |
getActions(Class<T> type)
Gets all actions of a specified type that contributed to this object.
|
List<? extends Action> |
getAllActions()
Gets all actions, transient or persistent.
|
Object |
getDynamic(String token,
org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
replaceAction(Action a)
Add an action, replacing any existing action of the (exact) same class.
|
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDisplayName
getSearchUrl
@Deprecated public List<Action> getActions()
getAllActions()
, or addAction(hudson.model.Action)
, or replaceAction(hudson.model.Action)
.
May still be called for compatibility reasons from subclasses predating TransientActionFactory
.
A new Action
can be added by addAction(hudson.model.Action)
.
If you are reading the list, rather than modifying it,
use getAllActions()
instead.
This method by default returns only persistent actions
(though some subclasses override it to return an extended unmodifiable list).
@Exported(name="actions") public final List<? extends Action> getAllActions()
getActions()
is supplemented with anything contributed by TransientActionFactory
.public <T extends Action> List<T> getActions(Class<T> type)
type
- The type of action to return.getAction(Class)
public void addAction(Action a)
getActions().add(a)
.public void replaceAction(Action a)
a
- an action to add/replace@Deprecated public Action getAction(int index)
getActions()
, and does not consider TransientActionFactory
.public <T extends Action> T getAction(Class<T> type)
type
- null
if no such actions exist.getActions(Class)
public Object getDynamic(String token, org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception
ModelObjectWithContextMenu
return new ContextMenu().from(this,request,response);
,
which implements the default behaviour. See ModelObjectWithContextMenu.ContextMenu.from(ModelObjectWithContextMenu, StaplerRequest, StaplerResponse)
for more details of what it does. This should suit most implementations.doContextMenu
in interface ModelObjectWithContextMenu
Exception
Copyright © 2014. All rights reserved.