orion.edit.outliner | ||
---|---|---|
![]() |
![]() |
|
orion.edit.validator | Updating this document |
An orion.edit.outliner service provides an overview of a file being edited. The result returned by this service is a tree, which is rendered in the left-hand pane in the Orion editor. Items in the tree can be links that take you to the appropriate point in the file, or to another URL entirely.
Implementations of orion.edit.outliner must define the following function:
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 = lines[i]; var match = /^=\s*(.+?)\s*=$/.exec(line); if (match) { outline.push({ label: match[1], line: i+1 // lines are numbered from 1 }); } } return outline; } }, { pattern: "\.txt$", name: "Headings", id: "orion.outliner.example.headings" }); provider.connect();
![]() |
![]() |
![]() |
orion.edit.validator | Updating this document |