Class Index | File Index

Classes


Class orion.commands.CommandService

CommandService can render commands appropriate for a particular scope and DOM element.
Defined in: </shared/eclipse/e4/orion/I201303111541/plugins/org.eclipse.orion.client.ui/web/orion/commands.js>.

Class Summary
Constructor Attributes Constructor Name and Description
 
Constructs a new command service with the given options.
Method Summary
Method Attributes Method Name and Description
 
addCommand(command)
Add a command to the command service.
 
addCommandGroup(scopeId, groupId, position, title, parentPath, emptyGroupMessage)
Registers a command group and specifies visual information about the group.
 
Close any active parameter collector.
 
Collect the parameters specified in the given command invocation.
 
Returns whether this service has been configured to collect command parameters
 
destroy(parent)
Destroy all DOM nodes and any other resources used by rendered commands.
 
findCommand(commandId)
 
Add a dom node appropriate for using a separator between different groups of commands.
 
Return the default selection service that is being used when commands should apply against a selection.
 
openParameterCollector(node, fillFunction, onClose)
Open a parameter collector suitable for collecting information about a command.
 
Process the provided URL to determine whether any commands should be invoked.
 
registerCommandContribution(scopeId, commandId, position, parentPath, bindingOnly, keyBinding, urlBinding)
Register a command contribution, which identifies how a command appears on a page and how it is invoked.
 
registerSelectionService(scopeId, selectionService)
Register a selection service that should be used for certain command scopes.
 
renderCommands(scopeId, parent, items, handler, renderType, userData, domNodeWrapperList)
Render the commands that are appropriate for the given scope.
 
runCommand(commandId, the, the, parameters)
Run the command with the specified commandId.
 
setParameterCollector(parameterCollector)
Provide an object that can collect parameters for a given "tool" command.
 
showKeyBindings(targetNode)
Show the keybindings that are registered with the command service inside the specified domNode.
Class Detail
orion.commands.CommandService(options)
Constructs a new command service with the given options.
Parameters:
{Object} options
The command options object which includes the service registry and optional selection service.
Method Detail
addCommand(command)
Add a command to the command service. Nothing will be shown in the UI until this command is referenced in a contribution.
Parameters:
command
{Command} the command being added.

addCommandGroup(scopeId, groupId, position, title, parentPath, emptyGroupMessage)
Registers a command group and specifies visual information about the group.
Parameters:
{String} scopeId
The id of a DOM element in which the group should be visible. Required. When commands are rendered for a particular element, the group will be shown only if its scopeId matches the id being rendered.
{String} groupId
The id of the group, must be unique. May be used for a dom node id of the element representing the group
{Number} position
The relative position of the group within its parent. Required.
{String} title Optional
The title of the group, optional
{String} parentPath Optional
The path of parent groups, separated by '/'. For example, a path of "group1Id/group2Id" indicates that the group belongs as a child of group2Id, which is itself a child of group1Id. Optional.
{String} emptyGroupMessage Optional
A message to show if the group is empty and the user activates the UI element representing the group. Optional. If not specified, then the group UI element won't be shown when it is empty.

closeParameterCollector()
Close any active parameter collector. This method should be used to deactivate a parameter collector that was opened with openParameterCollector. Commands that describe their required parameters do not need to use this method because the command framework will open and close parameter collectors as needed and call the command callback with the values of those parameters.

collectParameters(the)
Collect the parameters specified in the given command invocation. If parameters are collected successfully, invoke the command's callback. This method is used by clients who want to control the timing of parameter collection. For example, if a command must be executed before it can be determined what parameters are known, the client can try the command in the callback and then call this function if parameters are needed. In this case, clients typically configure the parameters description options with "options.clientWillCollect" set to true. orion.commands.ParametersDescription
Parameters:
{orion.commands.CommandInvocation} the
current invocation of the command

collectsParameters()
Returns whether this service has been configured to collect command parameters
Returns:
whether or not this service is configured to collect parameters.

destroy(parent)
Destroy all DOM nodes and any other resources used by rendered commands. This call does not remove the commands from the command registry. Clients typically call this function to empty a command area when a client wants to render the commands again due to some change in state.
Parameters:
{String|DOMElement} parent
The id or DOM node that should be emptied.

findCommand(commandId)
Parameters:
commandId

generateSeparatorImage(parent)
Add a dom node appropriate for using a separator between different groups of commands. This function is useful when a page is precisely arranging groups of commands (in a table or contiguous spans) and needs to use the same separator that the command service would use when rendering different groups of commands.
Parameters:
parent

getSelectionService()
Return the default selection service that is being used when commands should apply against a selection.

openParameterCollector(node, fillFunction, onClose)
Open a parameter collector suitable for collecting information about a command. Once a collector is created, the specified function is used to fill it with information needed by the command. This method is used for commands that cannot rely on a simple parameter description to collect parameters. Commands that describe their required parameters do not need to use this method because the command framework will open and close parameter collectors as needed and call the command callback with the values of those parameters.
Parameters:
{DOMElement} node
the dom node that is displaying the command, or a node in the parameter collector area
{Function} fillFunction
a function that will fill the parameter area
{Function} onClose
a function that will be called when the user closes the collector

processURL(url)
Process the provided URL to determine whether any commands should be invoked. Note that we never invoke a command callback by URL, only its parameter collector. If a parameter collector is not specified, commands in the URL will be ignored.
Parameters:
{String} url
a url that may contain URL bindings.

registerCommandContribution(scopeId, commandId, position, parentPath, bindingOnly, keyBinding, urlBinding)
Register a command contribution, which identifies how a command appears on a page and how it is invoked.
Parameters:
{String} scopeId
The id describing the scope of the command. Required. This scope id is used when rendering commands.
{String} commandId
the id of the command. Required.
{Number} position
the relative position of the command within its parent. Required.
{String} parentPath Optional, Default: null
the path of any parent groups, separated by '/'. For example, a path of "group1Id/group2Id/command" indicates that the command belongs as a child of group2Id, which is itself a child of group1Id. Optional.
{boolean} bindingOnly Optional, Default: false
if true, then the command is never rendered, but the key or URL binding is hooked.
{orion.commands.CommandKeyBinding} keyBinding Optional
a keyBinding for the command. Optional.
{orion.commands.URLBinding} urlBinding Optional
a url binding for the command. Optional.

registerSelectionService(scopeId, selectionService)
Register a selection service that should be used for certain command scopes.
Parameters:
{String} scopeId
The id describing the scope for which this selection service applies. Required. Only contributions made to this scope will use the selection service.
{orion.selection.Selection} selectionService
the selection service for the scope.

renderCommands(scopeId, parent, items, handler, renderType, userData, domNodeWrapperList)
Render the commands that are appropriate for the given scope.
Parameters:
{String} scopeId
The id describing the scope for which we are rendering commands. Required. Only contributions made to this scope will be rendered.
{DOMElement} parent
The element in which commands should be rendered. If commands have been previously rendered into this element, it is up to the caller to empty any previously generated content.
{Object} items Optional
An item or array of items to which the command applies. Optional. If not items are specified and a selection service was specified at creation time, then the selection service will be used to determine which items are involved.
{Object} handler
The object that should perform the command
{String} renderType
The style in which the command should be rendered. "tool" will render a tool image in the dom. "button" will render a text button. "menu" will render menu items.
{Object} userData Optional
Optional user data that should be attached to generated command callbacks
{Array} domNodeWrapperList Optional
Optional an array used to record any DOM nodes that are rendered during this call. If an array is provided, then as commands are rendered, an object will be created to represent the command's node. The object will always have the property "domNode" which contains the node created for the command. If the command is rendered using other means (toolkit widget) then the optional property "widget" should contain the toolkit object that represents the specified dom node.

runCommand(commandId, the, the, parameters)
Run the command with the specified commandId.
Parameters:
{String} commandId
the id of the command to run.
{Object} the
item on which the command should run.
{Object} the
handler for the command.
{orion.commands.ParametersDescription} parameters
used on this invocation. Optional. Note: The current implementation will only run the command if a URL binding has been specified, or if an item to run the command against has been specified.

setParameterCollector(parameterCollector)
Provide an object that can collect parameters for a given "tool" command. When a command that describes its required parameters is shown in a toolbar (as an image, button, or link), clicking the command will invoke any registered parameterCollector before calling the command's callback. This hook allows a page to define a standard way for collecting required parameters that is appropriate for the page architecture. If no parameterCollector is specified, then the command callback will be responsible for collecting parameters.
Parameters:
{Object} parameterCollector
a collector which implements open(commandNode, id, fillFunction), close(commandNode), getFillFunction(commandInvocation), and collectParameters(commandInvocation).

showKeyBindings(targetNode)
Show the keybindings that are registered with the command service inside the specified domNode.
Parameters:
targetNode
{DOMElement} the dom node where the key bindings should be shown.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Mar 11 2013 15:45:19 GMT-0400 (EDT)