Skip to main content
Jump to: navigation, search

Orion/Documentation/Developer Guide/Plugging into the navigator

Overview of contributing services to the Navigator

The Navigator page provides a view for users to browse and manipulate files in their workspace. The Navigator defines some services to allow plug-ins to contribute commands to this view.


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:

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:

The URL of an icon to associate with the command
The command text show to the user
The command id
A boolean attribute specifying whether the command supports only a single selected item or multiple items
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 text shown to the user when they hover on the command
Optional. An array of Validation Properties used to determine if the selected object should offer this command.


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: "",
   name: "Google Search",
   id: "sample.commands.sample4",
   forceSingleItem: true,
   uriTemplate: "{Name}",
   tooltip: "Link to google search for this file name"

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.


The orion.navigate.openWith service is used to associate a registered editor (see orion.edit.editor) with a registered content type (see orion.core.contenttype). Once this association has been made, the editor will be presented as a choice in the "Open With" menu beside files of that content type.

By default, the Orion client UI provides an editor with ID orion.editor, to be used for editing source code. You can refer to this editor ID when you want to associate a new content type with the Orion Editor.

Service methods

None. This service is purely declarative.

Service attributes

Implementations of orion.navigate.openWith must define the following attributes:

String The ID of the editor we want to associate. This must match exactly the editor's ID as given in orion.edit.editor.
String[] An array of one or more content type IDs that will be associated with the editor.


Here is a sample plug-in that associates the Orion Editor with the "text.markdown" content type. This example assumes that the "text.markdown" type has been previously registered with the orion.core.contenttype service.

 var provider = new eclipse.PluginProvider();
 provider.registerServiceProvider("orion.navigate.openWith", {},
   {  id: "orion.editor",
      contentType: ["text.markdown"]

When this plug-in is installed, the user will see the Orion Editor as an available target in the Open With Navigator menu beside files of the Markdown content type:



The content type service tells Orion about a new kind of file. The content types contributed to this service don't have any direct effect on the Orion UI, but they can be referred to by other services that need to associate themselves with a particular kind of file. For an example, see orion.navigate.openWith.

The Orion client UI defines a bunch of content types by default: see webEditingPlugin.html in the client UI code.

Service attributes

An Array containing one or more content types to register. Each element of the array defines a new content type, and must have this shape:
String The unique identifier of the content type. This is a simple hierarchical name and should start with a category like "text" or "image".
String The user-readable name of the content type.
String[] Optional. Array of file extensions characterizing this content type. (Extensions are given without the leading "." character).
String[] Optional. Array of filenames characterizing this content type. Use this when a type does not have a characteristic file extension, but rather a filename. (For example, "Makefile", "README", "passwd").
String Optional. If this content type is a subtype of another, this gives the parent content type's ID.
String Optional. URL of an image to display beside files of this type (for example, in the Orion navigator).

Service methods

None. This service is purely declarative.


This example code contributes contributes a new content type for Perl files. A Perl file extends from "text.plain" and has the extension .pl.

 provider.registerServiceProvider("orion.core.contenttype", {}, {
   contentTypes: [{  id: "text.perl",
                     name: "Perl",
                     extension: ["pl"],
                     "extends": "text.plain"
                  }] });

The example code below contributes a new content type for Ant build files. An Ant build file is a special kind of XML file that always has the name "build.xml".

 provider.registerServiceProvider("orion.core.contenttype", {}, {
   contentTypes: [{  id: "text.ant",
                     name: "Ant build file",
                     filename: ["build.xml"],
                     "extends": "text.xml"
                  }] });

Back to the top