Class orion.commands.CommandService
CommandService can render commands appropriate for a particular scope and DOM element.
Defined in: </shared/eclipse/e4/orion/I201107200200/plugins/org.eclipse.orion.client.core/web/orion/commands.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.commands.CommandService(options)
Constructs a new command service with the given options.
|
Method Attributes | Method Name and Description |
---|---|
addCommand(the, scope)
Add a command at a particular scope.
|
|
addCommandGroup(groupId, position, title, parentPath, scopeId)
Registers a command group and specifies visual information about the group.
|
|
Return an image object that is 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.
|
|
registerCommandContribution(the, the, scopeId, the, a, if)
Register a command contribution, which identifies how a command appears
on a page and how it is invoked.
|
|
renderCommands(parent, scope, items, handler, renderType, cssClass, userData, forceText)
Render the commands that are appropriate for the given scope.
|
|
showKeyBindings(the)
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(the, scope)
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.
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
generateSeparatorImage()
Return an image object that is 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.
getSelectionService()
Return the selection service that is being used when commands should apply against a selection.
registerCommandContribution(the, the, scopeId, the, a, if)
Register a command contribution, which identifies how a command appears
on a page and how it is invoked.
- Parameters:
- {String} the
- id of the command
- {Number} 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} 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.
- {orion.commands.CommandKeyBinding} a
- keyBinding for the command. Optional.
- {boolean} if
- true, then the command is never rendered, but the keybinding is hooked.
renderCommands(parent, scope, items, handler, renderType, cssClass, userData, forceText)
Render the commands that are appropriate for the given scope.
- Parameters:
- {DOMElement} parent
- The element in which commands should be rendered.
- {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. "image" will render a button-like image element in the dom. "menu" will render a push button menu containing the commands.
- {String} cssClass
- Optional name of a CSS class that should be added to any rendered commands.
- {Object} userData
- Optional user data that should be attached to generated command callbacks
- {Boolean} forceText
- When true, always use text and not the icon when showing the command, regardless of the specified renderType.
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.