Skip to main content
Jump to: navigation, search

Difference between revisions of "Orion/Documentation/Developer Guide/Simple plugin example"

(Before you start)
m (Bigger headings)
Line 1: Line 1:
 
This page explains how to write a plugin for Orion. It's intended for developers who want to extend Orion's functionality.
 
This page explains how to write a plugin for Orion. It's intended for developers who want to extend Orion's functionality.
  
=== What's a plugin? ===
+
== What's a plugin? ==
 
A '''plugin''' is basically just an HTML file that knows how to connect to the Orion client. A plugin can be hosted on any web server. Plugins are written in HTML and JavaScript.
 
A '''plugin''' is basically just an HTML file that knows how to connect to the Orion client. A plugin can be hosted on any web server. Plugins are written in HTML and JavaScript.
  
Line 12: Line 12:
 
* Syntax highlighting
 
* Syntax highlighting
  
=== What you need ===
+
== What you need ==
 
Every plugin must include the following JavaScript dependencies:
 
Every plugin must include the following JavaScript dependencies:
 
* '''OpenAjax''': defined in <tt>[http://orionhub.org/openajax/release/all/OpenAjaxManagedHub-all.js OpenAjaxManagedHub-all.js]</tt>
 
* '''OpenAjax''': defined in <tt>[http://orionhub.org/openajax/release/all/OpenAjaxManagedHub-all.js OpenAjaxManagedHub-all.js]</tt>
Line 19: Line 19:
 
  <script src="orion-plugin.js">
 
  <script src="orion-plugin.js">
  
=== Services ===
+
== Services ==
 
TODO
 
TODO
  
=== Examples ===
+
== Examples ==
 
Here are some existing plugins we've written. View the source code to see how they work:
 
Here are some existing plugins we've written. View the source code to see how they work:
 
; http://bokowski.github.com/format-js.html
 
; http://bokowski.github.com/format-js.html
Line 33: Line 33:
 
: Contributes syntax highlighting support for HTML files by using the <tt>ISyntaxHighlight</tt> service type.
 
: Contributes syntax highlighting support for HTML files by using the <tt>ISyntaxHighlight</tt> service type.
  
=== See also ===
+
== See also ==
 
* [[Orion/How Tos/Installing A Plugin Installing a plug-in]]
 
* [[Orion/How Tos/Installing A Plugin Installing a plug-in]]
 
* eclipse.PluginProvider JSdoc
 
* eclipse.PluginProvider JSdoc

Revision as of 16:13, 5 May 2011

This page explains how to write a plugin for Orion. It's intended for developers who want to extend Orion's functionality.

What's a plugin?

A plugin is basically just an HTML file that knows how to connect to the Orion client. A plugin can be hosted on any web server. Plugins are written in HTML and JavaScript.

In order to be useful, a plugin should provide one or more services. When Orion needs a service contributed by a plugin, it loads the plugin inside an IFrame.

Orion currently supports a small set of extension points — service types that plugins can contribute to, in order to customize the client and add more functionality. These include:

  • Commands on the editor toolbar
  • Commands in the navigator view
  • Content assist
  • Syntax highlighting

What you need

Every plugin must include the following JavaScript dependencies:

The easiest way to satisfy these is to get orion-plugin.js, which is a minified file that includes both of them. You can then copy-paste its contents into a <script> tag in your plugin, or load it externally like so:

<script src="orion-plugin.js">

Services

TODO

Examples

Here are some existing plugins we've written. View the source code to see how they work:

http://bokowski.github.com/format-js.html
Contributes a "Beautify JS" button to the editor toolbar by using the editorAction service type.
http://mamacdon.github.com/m6/uglify/uglify-plugin.html
Contributes an "Uglify JS" button to the editor toolbar byusing the editorAction service type.
http://orionhub.org/plugins/sampleCommandsPlugin.html
Contributes several sample actions to the Orion navigator by using the fileCommands service type.
http://orionhub.org/plugins/htmlSyntaxHighlightPlugin.html
Contributes syntax highlighting support for HTML files by using the ISyntaxHighlight service type.

See also

Back to the top