Skip to main content
Jump to: navigation, search

Orion/Documentation/Developer Guide/Plugging into the navigator

< Orion‎ | Documentation‎ | Developer Guide
Revision as of 07:57, 26 March 2012 by Susan (Talk | contribs) (Service attributes)

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 to the drop-down menu next to each file and 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, and optionally return an URL that the user will navigate to when clicking the command.

Service methods

Implementations of orion.navigate.command must define the following function:

Takes the navigator selection as an argument, and returns a URL string.

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
A boolean attribute indicating whether the command returns a link. If this attribute is specified and true, the command will render as a hyperlink and the user will navigate to the URL provided by the run method's return value.
Tooltip text shown to the user when they hover on the command
A JSON object containing key value pairs used to validate the item to which the command should be applied. For example, the expression {"Git":"*", "Directory":"true"} means that the command is valid for items that have a Git property and that have a Directory property whose value is true.


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", {
   run : function(item) {
     return "" + item.Name;
 }, {
   image: "",
   name: "Google Search",
   id: "sample.commands.sample4",
   forceSingleItem: true,
   href: true,
   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