orion.edit.outliner | ||
---|---|---|
![]() |
![]() |
|
orion.edit.model | orion.edit.validator |
An orion.edit.outliner service provides an overview of a file being edited. The overview is given as a tree, which the Orion UI renders in the left-hand pane alongside the file you are editing. Items in the tree can be links that take you to the appropriate position in the file, or to another URL entirely.
Implementations of orion.edit.outliner must have a getOutline
method that will be called to generate the outline for a resource. Its signature is as follows:
Returns an Array giving the top-level elements to be shown in the outline. Each element of the returned array must have the properties:
Implementations of orion.edit.outliner must define the following attributes:
This example shows an outline provider that runs on .txt files. It finds Mediawiki-style =Section Headings= and generates a flat outline from them. (A more elaborate implementation might also find subsections and include them as children of the top-level sections.)
var provider = new eclipse.PluginProvider(); provider.registerServiceProvider("orion.edit.outliner", { getOutline: function(contents, title) { var outline = []; var lines = contents.split(/\r?\n/); for (var i=0; i < lines.length; i++) { var line = linesi; var match = /^=\s*(.+?)\s*=$/.exec(line); if (match) { outline.push({ label: match1, line: i+1 // lines are numbered from 1 }); } } return outline; } }, { contentType: "text/plain", name: "Headings", id: "orion.outliner.example.headings" }); provider.connect();
![]() |
![]() |
![]() |
orion.edit.model | orion.edit.validator |