I've been a zone leader with DZone since 2008, and I'm crazy about community. Every day I get to work with the best that JavaScript, HTML5, Android and iOS has to offer, creating apps that truly make at difference, as principal front-end architect at Avego. James is a DZone Zone Leader and has posted 638 posts at DZone. You can read more from them at their website. View Full User Profile

Riena - A New Adventure In Eclipse

  • submit to reddit

Creating a UI Using Riena

Now that we have installed the Riena UI Wizard, we can see some example code quickly. Here's a step by step to get to one of the Riena project templates: 

  • Create a new Plug-in Project, but make sure to base it on Eclipse 3.4
  • Check "This plug-in will make contributions to the UI" and select Yes to create a rich client application
  • You will get four different Riena options in the template list. Here we'll select Riena Mail Template

Once you click Finish you will be presented with your Riena mail project. Let's take a quick look at how the application looks, before we start to investigate the code.

To run the application, simply open the plugin.xml and chooose Launch an Eclipse Application

The following is the screen that you will be presented with - I'm sure you'll agree it's pretty slick, and different to any RCP application that you probably developed so far. 

A Different User Interface

The following are the key points in the plugin definition that make Riena UIs different to standard RCP UIs.

  •  In the plugin manifest, you'll see that as well as including org.eclipse.ui, there is also a dependency on org.eclipse.riena.client

    Require-Bundle: org.eclipse.ui,

  • The main class of the Riena application is created as an org.eclipse.core.runtime.applications extension in the plugin.xml 

    We will look at this class in more detail shortly.
  • An instance of org.eclipse.riena.navigation.ui.swt.views.SubApplicationView is created as a perspective. This will be called later from the main Application class.


Everything else is as in any standard RCP application. The views, menus and handlers are all written as normal. So, let's take a closer look at the Application class. 

The class extends org.eclipse.riena.navigation.ui.swt.application.SwtApplication. The key part of this class is the overridden createModel method. 


protected IApplicationNode createModel() {
ApplicationNode app = new ApplicationNode("Riena Mail"); //NON-NLS-1

ISubApplicationNode subApp = new SubApplicationNode("Your Mail"); //NON-NLS-1
WorkareaManager.getInstance().registerDefinition(subApp, "rcp.mail.perspective"); //NON-NLS-1

IModuleGroupNode groupMailboxes = new ModuleGroupNode(new NavigationNodeId(Application.ID_GROUP_MBOXES));

IModuleNode moduleAccount1 = new ModuleNode("me@this.com"); //NON-NLS-1
return app;

The ApplicationNode is represented by the entire application's shell, while the current tab that is open is an ISubApplicationNode. The best way to illustrate this is to add a new node, which we'll name "Search".

	ISubApplicationNode searchApp  = new SubApplicationNode("Search"); //NON-NLS-1

As I haven't associated a perpective with the sub application, all this will do right now is contribute a tab.

Adding Content To The Search Tab

To add some simple UI content into the search tab, we can take the following short cut:

  • In plugin.xml, copy the Riena Perspective and create your own perspective. Just change the name and id of this new perspective. Note, we still use the same class.
    name="Search Perspective">
    Now we we click on our Search tab, we will see an empty view. As you would expect, the menu and toolbar items remain the same when you click into the Search tab.
  • Next we need to provide a ViewPart for the Search tab. Again, let's take the quick way out of this and copy the existing view, changing a few of the parameters.

    The view class itself extends ViewPart as in any standard RCP application. All we'll do in this class is define the ID as a constant and create some content for the view in the createPartControl method.
  • Modify the Application class to include this new view as follows

    //create a group node for the search content
    IModuleGroupNode searchGroupNode = new ModuleGroupNode();

    //create a module note for searching
    IModuleNode searchScreen = new ModuleNode("Search Screen"); //NON-NLS-1
    createSubMobule("Search", searchScreen, SearchView.ID); //NON-NLS-1
    First we create a group node to act as a container for our Search screen. Then we provide an IModuleNode. This will create a navigation item on the left hand side. We then add the SearchView as the submodule for this navigation node

    I would be interested to find out if there's any way of avoiding having those nodes appear on the left hand side.

    The createSubMobule method is provided along with the example, so I won't go into it here.

Here's the resulting screen. As you can see, putting together the pieces for a UI in Riena is pretty easy.

A Custom Look & Feel For Your Application

So far we have seen that a Riena UI can look dramatically different a standard RCP UI. The final UI aspect that I will go through here is how to change the Look & Feel of the application. 

First, you will need to create a theme, by implementing the ILnfTheme from Riena. This allows you to add custom colors, fonts, images and settings. An easier way to do this is to extend the RienaDefaultTheme, as this will have all the necessary parts set up.

For this example we'll just change the background colour of submodules, and the coolbar

public class NewTheme extends RienaDefaultTheme {

public void addCustomColors(Map<String, ILnfResource> table) {

new ColorLnfResource(186, 193, 225));
new ColorLnfResource(186, 193, 225));


Next, create a class to extend RienaDefaultLnf that can instantiate this new theme 

public NewLnf()
setTheme(new NewTheme());

protected String getLnfId()
return "newLnf";

In the constructor of the Application, just call the LnfManager to make the change to the look and feel of the entire application 


public Application()
LnfManager.setLnf(new NewLnf());

We now have a complete change in our entire UI. I really like this look and feel concept in Riena, which is not that far from the Swing concept. 

Article Resources: 


Christopher Brind replied on Tue, 2009/03/31 - 3:51am

Great stuff.  Wasn't aware of Rienna, but I am definatlely putting this on my hot list.  Thanks for the info.

Tom Meier replied on Tue, 2009/03/31 - 6:33am

Nice article, James. Rienna looks quite nice and looks like it's making life for us RCP developers a lot easier. However I think there's one big disadvantage to Rienna: Again we're relying on a different framework for multiple application layers such as services and UI. On the other hand an all-in-one solution such as seems to be good enough for small to mid-sized applications. I'm curious as to see whether this framework finds its place among all the other frameworks in the Java world.

Nevertheless a great article and surely looks like you spent a bit of time here :) Keep up the good work!


James Sugrue replied on Tue, 2009/03/31 - 7:05am in response to: Tom Meier

Thanks Tom

I see what you mean, and it has crossed my mind that this is another approach to the same problem. But I think projects in Eclipse work closely enough, and that there could be some crossover with what Riena does and what ECF provides in remote services.  I'm sure we'll see one recommended approach to remote services soon enough, at least in the Eclipse community 


Slim Ouertani replied on Tue, 2009/03/31 - 11:03am

Great project and article. I started a small developing a small kernel using Hessian and Osgi transparently. So where can I get source code ? :)

James Sugrue replied on Tue, 2009/03/31 - 11:05am in response to: Slim Ouertani

Thanks Slim!

Should appear just at the bottom of the article : http://java.dzone.com/sites/all/files/RienaExample.zip


Denis Robert replied on Tue, 2009/03/31 - 1:32pm

Have you tested your code? There's a reference there to a "org.eclipse.riena.communication.core.factory.Register" class which I can't find anywhere, and certainly not in the "org.eclipse.riena.communication.core" bundle where I'd expect it to be. Or are you using non-release level code?

Elias Volanakis replied on Tue, 2009/03/31 - 2:04pm

Works for me using the Riena 1.1.0.M6 download. HTH, Elias.

Ekkehard Gentz replied on Tue, 2009/03/31 - 2:20pm in response to: Tom Meier

tom, you're not relying to a complete framework if using Riena. You can choose what you like: remote services from Riena ... or ECF or another one UI complete from Riena or only the Ridgets in normal RCP Views. Riena is completely build as an OSGI client-server solution and you can use and combine the bundles as you like it. so you can start perhaps with remoting and your current RCP app or you start using Ridgets to make your life with SWT Widgets and Eclipse Databinding easier. ekke

Slim Ouertani replied on Tue, 2009/03/31 - 5:40pm in response to: James Sugrue

Thanks, but I speak about Riena source code. Is it possible to get it?

James Sugrue replied on Wed, 2009/04/01 - 1:38am in response to: Denis Robert

Hi Denis

 I ran this using Gailileo 3.5M6 and the latest release  of Riena. All fully tested 


James Sugrue replied on Wed, 2009/04/01 - 1:44am in response to: Slim Ouertani

You should be able to get it on the Eclipse CVS repository. It's an RT project so will be under /cvsroot/rt/org.eclipse.riena/

Roman Porotnikov replied on Wed, 2009/04/01 - 4:55am

UI wizard update site URL at Riena wiki: fixed.

Gavin Mogensen replied on Sun, 2009/04/12 - 10:14pm

Nice - thanks for the article

James Ervin replied on Thu, 2009/04/30 - 10:20am

You know this is just like a project I worked on a few years ago, well at least the OSGi service publishing part. It makes me wonder though, how hard would it be to leverage this through Spring DM? Spring DM is meant to do all the stuff about registering the service and getting access to it (all the things you are doing with the BundleContext) and handle it for you, making use of DI. In fact, this is probably so obvious that it is already being done somewhere, I am just not aware of it.

James Sugrue replied on Thu, 2009/05/14 - 2:14am in response to: James Ervin

Interesting point James - it should be possible in Spring DM. I haven't seen it with DM yet.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.