Skip to main content
Jump to: navigation, search

RCP to RAP Migration Example

Revision as of 12:21, 15 June 2007 by (Talk | contribs) (Migration)

Under heavy developement

This little tutorial will give you a little introduction in how to migrate a existing RCP application to an "ajaxified" RAP application. As RAP is a subset of the existing RCP infrastructure and trough it's nature a little but different, we will show you what you need to adapt in your application to run it as web application and why you need to do these changes.

But let's start with a little example which you maybe already know - RCP Mail Example

Installing RAP

Is this needed in this tutorial? Not sure how this is done for M4 cause of the namespace problems (updatesite/target/CVS?)

Setup of the example RCP application

New Project wizard

We will use the RCP Mail Example provided by the PDE team to show you the details of such a migration. To create the RCP Mail example, click on File | New | Project... and select Plug-in Project. We will give it the name "org.eclipse.rap.demo.mail" but you can also choose your own. Click on Next > to modify the existing plug-in settings. Be sure to have the This plug-in will make contributions to the UI checkbox checked and that you Would like to create a rich client application (see screenshot "New Project Wizard"). On the next page select the "RCP Mail Template" and click the Finish button.

Clicking on the "Launch an Eclipse application" link of your Plugin Manifest Editor which opened immediately after project creation should result in an RCP application the one shown in "RCP Mail Example".

RCP Mail Example


The first step is to replace the dependency to org.eclipse.ui of RCP in your org.eclipse.rap.demo.mail project. To do this, open the Manifest Editor (click on the plugin.xml or MANIFEST.MF file in your project) and switch to the "Dependencies" tab. Remove the org.eclipse.ui plugin from the list and add the org.eclipse.rap.ui.workbench plugin as a new dependency.

As the nature of RAP requires a little but different startup of the application, just delete the extension of org.eclipse.core.runtime.applications on your "Extensions" tab. If you like, you can also remove the according from your project.

To define a new entrypoint, add a new extension for the org.eclipse.rap.ui.workbench.entrypoint extension point. As paramater we will define "default" that our mail example is the default application in the running enviroment later on.

As class you can create a new one which implements the IEntryPoint interface. Look at the following code how we could implement it:

package org.eclipse.rap.demo.mail;

import org.eclipse.swt.lifecycle.IEntryPoint;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;

public class MailApplication implements IEntryPoint {

	public Display createUI() {
		Display display = PlatformUI.createDisplay();
				new ApplicationWorkbenchAdvisor());
		return display;

As RAP does not support blocking dialogs (think of the client-server concept), we have an additional parameter in the open method of our dialogs. This is helpful to perform certain actions after the dialog is closed. As the additional paramter will be called after the close event, it's named "ICallback". In our current application we don't need to define a callback for the dialogs and just pass null. These are the locations where we need to add the additional paramter:


MessageDialog.openInformation(window.getShell(), "Open", "Open Message Dialog!", null);


MessageDialog.openError(window.getShell(), "Error", "Error opening view:" + e.getMessage(), null);


MessageDialog.openInformation(getSite().getShell(), "Not Implemented", "Imagine the address book or a new message being created now.", null);

One last thing is to do: We currently don't support to open more than one workbench window we will just comment out this feature in the mail example. Here are the lines we don't need:

ApplicationActionBarAdvisor (lines 32, 54, 55, 74)


private IWorkbenchAction newWindowAction;

newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);



Run the mail demo

Back to the top