Getting started with Eclipse 4 applications on RAP
In this blog post I’ll introduce you to using Eclipse 4 on RAP. Eclipse 4 on RAP means the use of Eclipse 4 API’s without the 3.x compat layer. Eclipse 3.x API users can simply stick to the plain vanilla 2.3 release of RAP. If you want to take advantage of the new Eclipse 4 programming model with services, injection and Pojo workbench elements read on to learn how to deploy Eclipse 4 based apps on the web using RAP 2.3 and the new RAP e4 incubator project.
RAP e4 incubator project
Since Eclipse 4.0 was released there was a steady and growing interest in combining Eclipse 4 based applications with RAP. The core e4 platform improved (and is improving) from release to release and now with Luna the Eclipse 4 application platform is in a shape that a RAP implementation can be provided with a reasonable implementation and maintenance effort.
EclipseSource sponsored us to help creating a RAP Eclipse 4 port. Our goal for Luna is to provide an RAP-p2-Target platform which e4 application developers can use to get their applications deployed. And here we are.
This target platform is provided by a RAP Incubator project named “RAP e4”, which we plan to graduate with the next major RAP release. It encompasses:
- A complete p2 target platform including Equinox, RAP 2.3, Platform and RAP e4 bundles
- An optional tooling plugin for your Eclipse IDE to bootstrap a RAP e4 application
Most of the bundles contained in the p2 target are the same as the ones provided by the upstream projects but because there are still some API gaps between RAP and SWT (e.g. StyledText, Graphics API and Mouse API) we had to fork 4 platform bundles:
We’ll work with the platform team in the Eclipse Mars release timeframe to modify them in a way that we can consume them unmodified.
Which parts of Eclipse 4 are supported
Eclipse 4 applications are built using 3 core technologies
- The application model
- The DI-Container
The application model and the DI-Container are fully supported by RAP e4, including things like the event bus (IEventBroker), ExtendedObjectSuppliers (@UIEventTopic, @Preference) and the new and shiny runtime language change support.
We decided to not support the Eclipse 4 CSS-Engine for now, because RAP already has a much more feature rich CSS/Theme system. It can take advantage of the CSS rendering of browsers and is not constrained by native controls.
I’ll explain in a follow up blog post how we managed to support them without modifying the upstream projects but replacing the default ones through RAP-specific implementations.
Where can you get RAP e4?
First and most important you can grab the sources from the following incubator repository at http://git.eclipse.org/c/rap/incubator/org.eclipse.rap.incubator.e4.git/ but most of you probably want a target platform and a nice wizard to bootstrap an application.
So the following is a short guide how to bootstrap your first “RAP on e4” application.
Setup your IDE
- Grab at least Eclipse 4.4M6 from http://download.eclipse.org/eclipse/downloads/
- Install the lastest RAP-Tooling from the http://download.eclipse.org/releases/luna update-site
- Install the lastest RAP-e4-Tooling from http://download.eclipse.org/rt/rap/incubator/nightly/e4/tooling/site
Create an application
- Download the target-platform as a zip file from http://download.eclipse.org/rt/rap/incubator/nightly/e4/target/site_assembly.zip
- Create a new target platform setting (Preferences > Plug-in Development >Target Platform) using the zip you downloaded – in case you use the p2 option make sure to uncheck “include required software”. The downloaded platform is self-contained and all dependencies are resolved
- Use the New “Plug-in Project” wizard with the following options:
- This plug-in will make contributions to the UI (checked)
- Would you like to create a 3.x rich client application (“No” checked)
- “RAP e4 application” Template selected
We’ve put up those information also on a wiki-page describing the setup at https://wiki.eclipse.org/RAP/E4 so if you come to this post later on and the steps don’t work please consult the wiki page.
Finally some small example applications demonstrating e4 on RAP. The first application is part of the git repo and we use it to test various Eclipse 4 features.
This video shows an e4 demo app enabled for iPad/Android devices I wrote for a customer show case