Class orion.commands.Command
A command is an object that describes an action a user can perform, as well as when and
what it should look like when presented in various contexts. Commands are identified by a
unique id.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.ui/web/orion/commands.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.commands.Command(options)
Constructs a new command with the given options.
|
Method Attributes | Method Name and Description |
---|---|
getChoices(items, handler, userData)
Get the appropriate choices using the choiceCallback.
|
|
hasImage()
Return a boolean indicating whether this command has a specific image associated
with it.
|
|
makeChoiceCallback(choice, items)
Make a choice callback appropriate for the given choice and items.
|
|
populateChoicesMenu(parent, items, handler, userData, commandService)
Populate the specified menu with choices using the choiceCallback.
|
- Parameters:
- {Object} options Optional
- The command options object.
- {String} options.id Optional
- the unique id to be used when referring to the command in the command service.
- {String} options.name Optional
- the name to be used when showing the command as text.
- {String} options.tooltip Optional
- the tooltip description to use when explaining the purpose of the command.
- {Function} options.callback Optional
- the callback to call when the command is activated. The callback should either perform the command or return a deferred that represents the asynchronous performance of the command. Optional.
- {Function} options.hrefCallback Optional
- if specified, this callback is used to retrieve a URL that can be used as the location for a command represented as a hyperlink. The callback should return the URL. In this release, the callback may also return a deferred that will eventually return the URL, but this functionality may not be supported in the future. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=341540. Optional.
- {Function} options.choiceCallback Optional
- a callback which retrieves choices that should be shown in a secondary menu from the command itself. Returns a list of choices that supply the name and image to show, and the callback to call when the choice is made. Optional.
- {String} options.imageClass Optional
- a CSS class name suitable for showing a background image. Optional.
- {Boolean} options.addImageClassToElement Optional
- If true, the image class will be added to the element's class list. Otherwise, a span element with the image class is created and appended to the element. Optional.
- {String} options.selectionClass Optional
- a CSS class name to be appended when the command button is selected. Optional.
- {String} options.spriteClass Optional
- an additional CSS class name that can be used to specify a sprite background image. This useful with some sprite generation tools, where imageClass specifies the location in a sprite, and spriteClass describes the sprite itself. Optional.
- {Function} options.visibleWhen Optional
- A callback that returns a boolean to indicate whether the command should be visible given a particular set of items that are selected. Optional, defaults to always visible.
- {orion.commands.ParametersDescription} options.parameters Optional
- A description of parameters that should be collected before invoking the command.
- {Image} options.image Optional
- the image that may be used to represent the callback. A text link will be shown in lieu of an image if no image is supplied. Optional.
- Parameters:
- items
- handler
- userData
- Parameters:
- choice
- items
- Parameters:
- parent
- items
- handler
- userData
- commandService