Extending Eclipse Orion

Yesterday Eclipse E4 team announced Orion - an experimental Eclipse Web IDE. There's plenty of information about the project on Orion wiki.

Orion is a set of JavaScript and HTTP APIs that simplify common development part of rich applications, like file storage, preferences, authentication, dialogs, selection. Since it's coming from Eclipse, Orion is skewed towards IDE development, so from start it also includes text editor with some decent features, like JavaScript syntax highlighting and JSLint integration.
The project may go towards strengthening it's JS IDE feature set, as well as enhancing it's core side - extensibility, client APIs ...or do it all at once. In any case it's going to be fascinating journey!

So how to extend Orion? One can re-implement existing HTTP API in language other than Java; add more HTTP APIs, e.g. for task management, calendar, etc. Same with JavaScript API - it seems fairly easy to add more. Looking at this from classic Eclipse adopter point of view, I tried to add some GUI contribution that brings new functionality to existing Orion - let's say a PHP editor to complement the JS one. Naturally all without leaving Orion. I took following steps:
1. create new Orion bundle with new editor
2. install on Orion server
3. test and improve the contribution

Creating new bundle for Orion
Orion is technically a simple Equinox http server, so it's pretty straightforward. We need MANIFEST.MF with bundle description, plugin.xml that describes what web content should be published and the content itself.

New bundle structure, looking at it from Orion:

META-INF/MANIFEST.MF
Pretty much ,standard Eclipse plugin manifest.



plugin.xml
This one specifies that our bundle contains some static web content under /web directory and that it should be accessible in the container under /simple alias. Straightforward, thanks to Equinox.


Interestingly, at the moment Orion team decided to put all configuration in one bundle, so e.g. webeditor or webide JS code currently doesn't decide on it's own where will it appear, but instead a separate configuration bundle defines that.

Installing bundle into Orion
To install just created bundle, we need to figure out where is it stored and install it. By default Orion stores files in serverworkspace directory in it's home dir. On Mac this happens to be \Eclipse.app\Contents\MacOS\serverworkspace

In order to install bundle, it's best to use equinox osgi console - available in Orion thanks to the fact that it's equinox application. Orion docs mention something about server console, but I'm not entirely sure if this is the same, or some other console.
So first start Orion with osgi console:

./eclipse -console

and then, install the bundle:

osgi> install file:/Users/jacek/Downloads/eclipse-orion/eclipse.app/Contents/MacOS/serverworkspace/A
Bundle id is 75

osgi> start 75

I used absolute path from Orion workspace, to easily make updates later. Surprisingly my project dir is named "A" instead of it's real name. Another interesting thing is that there's no all the well known .project and .settings files. Web developers are going to like it, and I'm wondering where is this information stored currently.

Test and improve the contribution
So now that our bits are installed, let's see them:
http://localhost:8080/sample/index.html and yes! It works!

Curious mind would be interested what was the source of the index.html, that generated such nice "Hello [object Object]" message. I included some Orion Client API to check if it's available and yes, it is! From now on, further documentation can be found at Orion Client API wiki.

The source is following:
After updating the bundle contents - e.g. to turn this sample to real new PHP editor - there's another command required to make Orion see our changes. From osgi console type:

osgi> update org.eclipse.sample


The only thing that I was not able to figure out is how to actually add a link or other UI contribution to code editor, files navigator, or other existing UIs. At the moment user has to manually enter the URL to see my contribution. I'd be happy to hear how to do this, if you happen to know.

Comments

  1. Pretty cool! Let us know if you'd like to become a committer... ;-)

    ReplyDelete
  2. You probably figured this out but...

    "I'm wondering where is this information stored currently."

    In memory - After I restarted, I no longer had access to the files I had created as the same user.

    ReplyDelete
  3. Mark, actually files are saved on disk, so you should see them in workspace after shutting down Orion.
    Workspace state and users information is stored in preferences.On disk they're in /.metadata/.plugins/org.eclipse.e4.webide.server/.settings

    However I have also noticed that if I shutdown orion and then start it again I need to re-create my account to log in, even though my account information seems stored correctly. After re-creating account, my files still exist.

    ReplyDelete
  4. Indeed this is an incredibly exciting development. The screenshots seem to show a bias towards providing a web based IDE for JavaScript development. Looking forward for the updates on web based GUI tools for tasks such as data mapping.

    ReplyDelete

Post a Comment

Popular posts from this blog

Drawing in Graphiti

Trouble signing Apps for OSX Mountain Lion

Spikes in RabbitMQ + NodeJS latency test