# orion.navigate.command

The `orion.navigate.command` service is used to contribute commands that are relevant to a selected file or folder. When the service is executed, a file object or array of file objects is passed to the service's `run` method. The command can perform some operation on the provided files. If the command is simply linking to another page, a `uriTemplate` can be used to specify the link.

## Service methods

Implementations of `orion.navigate.command` may define the following function:

run(selection)
  Takes the navigator selection as an argument, and runs a command against the selected objects.

This method will only be called when the implementation does not define a `uriTemplate` property.

## Service attributes

Implementations of `orion.navigate.command` may define the following attributes:

image
  The URL of an icon to associate with the command
name
  The command text show to the user
id
  The command id
forceSingleItem
  A boolean attribute specifying whether the command supports only a single selected item or multiple items
uriTemplate
  Optional. A URI Template that defines a link to another page, using variables from the selected object's metadata or validation properties. If this property is specified, then the run service method will never be called.
tooltip
  Tooltip text shown to the user when they hover on the command
validationProperties
  Optional. An array of Validation Properties used to determine if the selected object should offer this command.
showGlobally
  A boolean attribute specifying if this command should be shown on pages other than the navigator. Optional.

## Example

Here is a sample plug-in that contributes a link to a Google search for the selected file's name:

     var provider = new eclipse.PluginProvider({postInstallUrl:"/plugin/list.html"});
     provider.registerServiceProvider("orion.navigate.command", {}, {
       image: "http://www.google.com/favicon.ico",
       name: "Google Search",
       id: "sample.commands.sample4",
       forceSingleItem: true,
       uriTemplate: "http://www.google.com/#q={Name}",
       tooltip: "Link to google search for this file name"
     });
     provider.connect();

When this plug-in is installed, the user will see the google search command in the Navigator menu as follows:

For more examples of contributing Navigator commands see the sample commands plugin.