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/I201202282230/plugins/org.eclipse.orion.client.core/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(the, scope, topic)
Add a command at a particular scope.
 
addCommandGroup(groupId, position, title, parentPath, scopeId)
Registers a command group and specifies visual information about the group.
 
Close any active parameter collector.
 
Returns whether this service has been configured to collect command parameters
 
findCommand(commandId)
 
Add a dom node appropriate for using a separator between different groups of commands.
 
Return the selection service that is being used when commands should apply against a selection.
 
openParameterCollector(node, fillFunction)
Open a parameter collector suitable for collecting information about a command.
 
Process the provided URL to determine whether any commands should be invoked.
 
registerCommandContribution(commandId, position, scopeId, parentPath, bindingOnly, keyBinding, urlBinding)
Register a command contribution, which identifies how a command appears on a page and how it is invoked.
 
renderCommands(parent, scope, items, handler, renderType, forceText, userData, activeCommandClass, inactiveCommandClass)
Render the commands that are appropriate for the given scope.
 
runCommand(commandId)
Run the command with the specified commandId.
 
setParameterCollector(parameterCollector)
Provide an object that can collect parameters for a given "tool" command.
 
Show the keybindings that are registered with the command service inside the specified domNode.
 
whenHidden(domElementOrId, onHide)
Registers a function that should be called when the specified DOM element is hidden.
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(the, scope, topic)
Add a command at a particular scope.
Parameters:
{Command} the
command being added.
{String} scope
The scope to which the command applies. "global" commands apply across the page, "dom" level commands apply only when the specified dom element is rendering commands, and "object" scope applies to particular objects being displayed in widgets such as lists or trees.
{String} topic
(optional). A topic describing the command that can be used to assemble lists of commands that relate to each other.

addCommandGroup(groupId, position, title, parentPath, scopeId)
Registers a command group and specifies visual information about the group.
Parameters:
{String} groupId
The id of the group, must be unique. Also used for dom node id
{Number} position
The relative position of the group within its parent, optional.
{String} title
The title of the group, optional
{String} parentPath
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} scopeId
The id of a DOM element related to the command's scope. Optional. For example, if the scope is "dom" level, the scopeId describes which dom id to which this command should be added

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.

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

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 selection service that is being used when commands should apply against a selection.

openParameterCollector(node, fillFunction)
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

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(commandId, position, scopeId, parentPath, bindingOnly, keyBinding, urlBinding)
Register a command contribution, which identifies how a command appears on a page and how it is invoked.
Parameters:
{String} commandId
the id of the command
{Number} position
the relative position of the command within its parent
{String} scopeId
The id related to the scope. Depending on the scope, this might be the id of the page or of a dom element.
{String} parentPath
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
if true, then the command is never rendered, but the key or URL binding is hooked.
{orion.commands.CommandKeyBinding} keyBinding
a keyBinding for the command. Optional.
{orion.commands.URLBinding} urlBinding
a url binding for the command. Optional.

renderCommands(parent, scope, items, handler, renderType, forceText, userData, activeCommandClass, inactiveCommandClass)
Render the commands that are appropriate for the given scope.
Parameters:
{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.
{String} scope
The scope to which the command applies. "dom" level commands apply only when a specified dom element is rendering commands. "object" scope applies to particular objects/items displayed in widgets such as list or trees. "global" commands always apply.
{Object} items
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 button-like image or text element in the dom. "menu" will render a push button menu containing the commands.
{Boolean} forceText
When true, always use text and not the icon when showing the command, regardless of the specified renderType.
{Object} userData
Optional user data that should be attached to generated command callbacks
{String} activeCommandClass
(optional) class to use when a command becomes active by focus or hover
{String} inactiveCommandClass
(optional) class to use when a command becomes inactive by lost focus or blur

runCommand(commandId)
Run the command with the specified commandId.
Parameters:
{String} commandId
the id of the command to run. Note: The current implementation will only run the command if a URL binding 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(the)
Show the keybindings that are registered with the command service inside the specified domNode.
Parameters:
{DOMElement} the
dom node where the key bindings should be shown.

whenHidden(domElementOrId, onHide)
Registers a function that should be called when the specified DOM element is hidden.
Parameters:
{String|DOMElement} domElementOrId
the element containing the rendered commands. This should be a DOM element in which commands are being rendered.
{Function} onHide
a function to be called when the dom element is hidden

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Feb 28 2012 22:34:46 GMT-0500 (EST)