You are here

Starting to play with Eclipse RCP - 1

logoIntroduction

I have had in mind to spend some time playing with Eclipse RCP for quite a long time now. What do I mean, with playing? Well, developing a production grade application for my preferred domains, Machine to machine (M2M) or Internet of Things (IoT), so that I really get a grasp of RCP. I now have his opportunity. So, let's start!

This article, and next ones, will contain various notes I write down while going forward with this new project. It's not meant as being a tutorial, as I do not know RCP yet Smile

I'll use Eclipse Rich Client Platform book, by Jeff McAffer, Jean-Michel Lemieux and Chris Aniszczyk, as main training source. Just to make it a little bit more challenging, I decided not to use the Eclipse version they recommand (Galileo SR2), but Kepler...

Help provided with Eclipse RCP is useful as well (see Help > Help Contents > Plug-in Development Environment Guide and Platform Plug-in Developer Guide).

Target

My target: an application that can receive and display in real time data received from remote mobile agents (an embedded device inside a vehicle, a smartphone carried by a runner, etc.) I developped, installed and maintained such systems for about 14 years, during a previous professional life. So, involved paradigms are not new for me. But Eclipse RCP technology is...

Environment

Unless otherwise stated, development environment is 64-bit Linux Mint 14 (Nadia), a distribution derived from Ubuntu 12.10 (Quantal Quetzal). I use the MATE version of Nadia.

Installation

I install latest Eclipse version, at time of writing: Eclipse for RCP and RAP Developers, Kepler SR1 (4.3.1 - 64-bit version):

  • check MD5 checksum
  • extract the content of the archive, and move resulting directory to ~/eclipseKeplerRCP (I have several other Eclipse installations)
  • add an entry to Mint menu
  • start Eclipse, creating workspace workspaceKeplerRCP
  • if necessary, update preferences to declare a proxy
  • perform an update

As I use subversion, I add subversive, as described in this article (in my Linux Mint 14, svn version is 1.7.5).

Before going further, I select the Plug-in Development perspective.

Hello World - configuration

As explained by the book, I first create a target, storing its definition into the workspace:

  • create the HelloWorld project: File > New > Project... > General > Project
  • create the HelloWorld target target definition: File > New > Target Definition, selecting the project for parent folder, and Nothing for initialization. Use HelloWorldTarget.target for filename.

I then download the 4.3 Delta Pack from hereOnce downloaded:

  • create the folder delta.pack in the target project, and import the delta pack: right click on folder name, and Import... > General > Archive File
  • in the target definition, click on Add... button, select Directory, and click on Next. Then, clicking on Variables..., add ${workspace_loc} to Location. Then, add path to delta.pack/eclipse/plugins folder, resulting in: ${workspace_loc}/HelloWorld/delta.pack/eclipse/plugins. Click on Finish.

Adding RCP SDK as a software site is done as follows:

  • using Add... button again, choose Software site this time. In the Add content window , add Kepler site if not present yet (URL: http://download.eclipse.org/releases/kepler).
  • uncheck Group by Category, type RCP as filter text, and check Eclipse RCP SDK.
  • uncheck Include required software.
  • click on Finish.

HelloWorld - skeleton

To create a simple skeleton:

  • File > New > Plug-in Project
  • com.monblocnotes.helloworld for Project name. Click on Next.
  • uncheck Generate an activator, and select Yes radio button in the Rich Client Application area. Click on Next.
  • select Hello RCP template. Click on Next.
  • Hello RCP for Application window title. Leave Add branding unchecked. Click on Finish.

That's it. In the Package Explorer view, we now have the com.monblocnotes.helloworld project. It contains a plugin.xml file. Opening it displays a plug-in editor window. Clicking on Launch an Eclipse application in the Overview tab starts our HelloWorld application.

Five java files have been generated:

  • Application.java: implements IApplication. Creates a Display, and starts an Eclipse Workbench.
  • ApplicationWorkbenchAdvisor.java: tells the Workbench how to behave.
  • ApplicationWorkbenchWindowAdvisor.java: tells how to render application windows.
  • ApplicationActionBarAdvisor.java: creates and positions actions.
  • Perspective.java: implements IPerspectiveFactory.

HelloWorld - product

Before being able to package my HelloWorld application, I have to define a product configuration:

  • File > New > Product Configuration
  • use com.monblocnotes.helloworld for parent folder.
  • helloworld.product for File name.
  • select Use a launch configuration. com.monblocnotes.helloworld.application should be displayed (created by our previous launch, after skeleton creation).
  • click on Finish.

The new product configuration is displayed in an editor window. A product definition must now be created:

  • click on New...
  • set Product Name to Hello RCP. Product Application presented by default is the right one: com.monblocnotes.helloworld.application.
  • click on Finish.
  • on the Launching tab, set Launcher Name to helloRCP.
  • save.

HelloWorld - packaging

As we didn't add any "external" files to the project (splash image, icons, etc.), we don't have to modify the default binary build. So, simply:

  •  right-click on helloworld.product, and select Export... > Plug-in Development > Eclipse product. Click on Next.
  • set Root directory to helloRCP1.0.
  • select a directory for Destination. A subdirectory named helloRCP1.0 will be created there.
  • click on Finish.

That's all folks! The helloRCP (launcher name defined in previous step) file that was created in helloRCP1.0 subdirectory launches the application.

The size of the whole helloRCP1.0 folder tree is 27.7 MB.

Summarizing

A target describes the platform you are developing for.

A product is a stand-alone program built with Eclipse. It includes all code and plug-ins.


Next article: installing uDig RCP SDK.