Skip to main content

skip to main content

developerWorks  >  Open source  >

Develop eRCP applications with Eclipse

Move rich applications down to your gizmos with Eclipse V3.2

developerWorks
Document options

Document options requiring JavaScript are not displayed

Sample code


Rate this page

Help us improve this content


Level: Intermediate

Uriel Liu (liukl@tw.ibm.com), Software Engineer, IBM 
Michael MS Cheng (mscheng@tw.ibm.com), Software Engineer, IBM Software Development Lab

05 Dec 2006

This article shows how to use Eclipse to develop embedded Rich Client Platform (eRCP) applications. Detailed steps guide you through setup, development style, deployment, and debugging of an eRCP application programming cycle.

Background

The eRCP came about as a way to apply the advancements of the Eclipse Rich Client Platform (RCP) to embedded devices. Topics covered:

  • Setup development environment
  • eRCP application building blocks
  • How to generate logs for debugging
  • Deploy to real devices
  • Major difference between RCP and eRCP applications


Back to top


Setup development environment

Install development tools on Windows development machine

The minimum eRCP development environment consists of the following components:

  • Eclipse SDK
  • A supported JRE (V1.4.2)
  • eRCP runtime
    • As for today's milestone build (V1.0 GA), eRCP supports three platforms:
      • Windows® Mobile 2003/Windows Mobile 5
      • Windows Desktop (Win32)
      • Nokia Series 80
    • We will use the first two. Download the eRCP milestone package for Windows marked Mx, where x is the milestone number

For small devices, there is a different specification of the Java™ platform called Java 2 Micro Edition (J2ME). We'll use a Foundation Profile implementation part of the IBM® Workplace Client Technology: Micro Edition for Windows.

  • Lotus® Expeditor
    • Download a trial version of IBM Lotus Expeditor toolkit.
      Editor's note: When this article was written in 2006, the authors recommended readers download WebSphere® Studio Device Developer. This product has since been withdrawn. IBM now offers Lotus Expeditor as a tool for RCP and eRCP development.
Why you need J2ME Foundation Profile for Win32
You already have JRE V1.4.2 for Win32 in place, and you may be wondering what the Foundation Profile is for. Without using same profile during development, you run the risk of using classes that are not available in selected the J2ME profile. So you're likely to have a perfectly running application on the desktop, but it keeps throwing ClassNotFoundExceptions when running on the device. It's recommended to use Foundation Profile in development and device environments.

In summary, you need the following software:

  • Eclipse V3.2 and JRE V1.4.2
  • J2ME Foundation Profile for Win32 and Windows Mobile 2003/Windows Mobile 5
  • eRCP runtimes for Win32 and Windows Mobile 2003/Windows Mobile 5

Make sure you read the installation section for step-by-step instructions.

Configure Eclipse on the development machine

  1. Run EclipseHome%\eclipse.exe
  2. Switch the target platform -- We need to change the default target platform to build and run against the correct libraries. Click Window > Preferences, expand Plug-in Development, and click Target Platform. Enter the location of eRCP (i.e., eRCP-v20060609-1423\win32\eRCP) and click Apply, then OK.

Figure 1. Switch target platform
Switch target platform
  1. Switch to the Plug-in Development perspective (via the tab on upper right of the IDE).

Set up workspace for development on Foundation Profile

  1. Click Window > Preferences, then select Java > Installed JREs
  2. Click Add to add a new JRE:

    In JRE type, choose Standard VM
    In JRE name, provide an appropriate name, such as Foundation 1.0
    In JRE home directory, point to a standard J2SE JVM
    Select all listed JRE system libraries, then click Remove to remove all default JRE system libraries
    Click Add External JARs ... to point to installed Foundation Profile libraries, as shown in Figure 2.
    • %WSDDhome%\wsdd5.0\ive-2.2\lib\charconv.zip
    • %WSDDhome%\wsdd5.0\ive-2.2\lib\jclFoundation10\classes.zip
    • %WSDDhome%\wsdd5.0\ive-2.2\lib\jclFoundation10\locale.zip
    • %WSDDhome%\wsdd5.0\ive-2.2\lib\jclFoundation10\map.zip

Figure 2. Foundation 1.0 JRE
Foundation 1.0 JRE

Change compiler compliance level

Eclipse V3.2 sets its default compiler compliance to 5.0. eRCP runtimes, however, are built against 1.4. We must set the compliance level to 1.4 in Eclipse IDE manually. Click Window > Preference, then select Java > Compiler. Change the Compiler Compliance Level to 1.4, as shown in Figure 3. Click Apply, then OK.


Figure 3. Compiler compliance setting
Compiler compliance setting



Back to top


eRCP application building blocks

eRCP preserves the major capability it inherited from the RCP dynamic plug-in model. In eRCP, it supports two application models:

Stand-alone eRCP application
One GUI application per JVM; it owns its entire display window.
Workbench plug-in application (eWorkbench)
Applications run simultaneously in a single workbench window that controls where and when applications are displayed. Only one JVM is required.

We'll cover how to build both with Eclipse SDK one after another.



Back to top


eRCP application model

The eRCP application is similar to normal RCP application. Each eRCP application can be considered a single plug-in, which is an OSGi bundle with capability preserving its own display and shell for GUI controls. Eclipse V3.2 provides a useful template for creating a simple plug-in. Let's see how can we hack it a bit to be an eRCP application.

Create a simple plug-in

  • Click File > New > Project to open the New wizard.
  • Select Plug-in Project and click Next.
  • Enter org.eclipse.testercp in the Project Name and click Next.
  • Answer Yes to the question Would you like to create a rich client application?, then click Next.
  • Select Hello RCP template, then click Finish.

Resolve a compilation error

With the above step, you'll find that the plug-in contains compilation error like Figure 4.


Figure 4. Compilation error
Compilation error

  • Remove ApplicationActionBarAdvisor.java, ApplicationWorkbenchAdvisor.java, ApplicationWorkbenchWindowAdvisor.java, and Perspective.java from the project. In this sample, we will use eSWT's display and shell as placeholder for UI controls. No workbench, actions, or perspective will be covered in the sample.
  • Add org.eclipse.ui.plugin and org.eclipse.ui in MANIFEST's Imported Packages, as shown in Figure 5. It makes sure the AbstractUIPlugin, which is extended by org.eclipse.testercp.Activator, gets resolved.

Figure 5. Manual addition to MANIFEST
Manual addition to MANIFEST

Add contribution to UI

An eRCP application maintains its display, shells, and all UI controls and actions. eSWT and eJFace are the major UI components we can use in eRCP/eWorkbench applications. We will use some eSWT code to form a traditional HelloWorld application.

Table 1 lists all the UI packages we can use in eRCP application development.

Table 1. UI packages in eRCP
eSWTeJFace
org.eclipse.swtorg.eclipse.jface
org.eclipse.swt.browserorg.eclipse.jface.action
org.eclipse.swt.dndorg.eclipse.jface.operation
org.eclipse.swt.eventsorg.eclipse.jface.preference
org.eclipse.swt.graphicsorg.eclipse.jface.resource
org.eclipse.swt.internalorg.eclipse.jface.util
org.eclipse.swt.layoutorg.eclipse.jface.viewers
org.eclipse.swt.widgets-
  • Add org.eclipse.swt, org.eclipse.swt.widgets, org.eclipse.jface.resource, org.eclipse.swt.graphics to the Imported Packages of MANIFEST.
  • Modify Application.java a bit to make it like Listing 1. We remove workbench-related code, but create a shell and text to display the hello message.

Listing 1. Hello eRCP
                
package org.eclipse.testercp;

import org.eclipse.core.runtime.IPlatformRunnable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;

/**
 * This class controls all aspects of the application's execution
 */
public class Application implements IPlatformRunnable {

	/* (non-Javadoc)
	 * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
	 */
	public Object run(Object args) throws Exception {
		Display display = PlatformUI.createDisplay();
		Shell shell = new Shell(display, SWT.CLOSE);
		Label label = new Label(shell, SWT.NORMAL);
		label.setText("Hello eRCP!");
		label.setBounds(100, 80, 100, 20);
		shell.setSize(300,200);
		shell.setText("eRCP Application");
		shell.open();
	     while (!shell.isDisposed()) {
	      	if (!display.readAndDispatch())
	      		display.sleep();
	      }
	      display.dispose();
	      return IPlatformRunnable.EXIT_OK;
		
	}
}

Run it

Right-click on the project, click Run As > Eclipse Application, then you'll get your first eRCP application.


Figure 6. eRCP application
eRCP application



Back to top


eWorkbench application model

eWorkbench is a refactoring implementation of generic workbench in RCP. It's a stand-alone application that owns the JVM's GUI thread and manages the launch and display of all eWorkbench applications. eWorkbench can be used as the basis for more advanced workbenches that take advantage of particular hardware features. For example, a mobile phone with multiple displays can display some limited information on the front of the phone and a full/normal view on the larger display. When eWorkbench starts, it searches available applications and provides a list for a user to start. Users can also switch between eWorkbench applications, which are run in a single VM instance. It's accomplished via the OSGi framework bundle management.

Like the previous section, we can still make use of Eclipse's template instead of reinventing the wheel.

Create a simple plug-in

  • Click File > New > Project to open the new wizard.
  • Select Plug-in Project and click Next.
  • Enter org.eclipse.testworkbenchapp in the Project Name field and click Next, then Finish.

Import packages

We still must import needed packages manually to resolve compilation errors and, in addition, add other packages that will be used in later steps. Let's add org.eclipse.jface.resource, org.eclipse.swt, org.eclipse.swt.events, org.eclipse.swt.widgets, org.eclipse.ui.part, and org.eclipse.ui.plugin.


Figure 7. Import packages
Import packages

Define views

Next, we need to create a view for the application. When the workbench launches an application, it brings the view containing the UI of your application to the screen.

  • Open MANIFEST.MF and switch to the Extensions tab, then click Add ....
  • Enter org.eclipse.ui.views in Extension Point filter, then you'll find that Sample Views appears in Available templates. Select the template and click Next, then Finish.
  • Two extensions are added, and we only need to keep org.eclipse.ui.views, so delete org.eclipse.ui.perspectiveExtensions. Also delete Sample Category (category) from the ui.views extension. Figure 8 shows the current list of extensions.

Figure 8. Extensions 1
Import packages

An entry of extension of the view is generated in the plugin.xml. Let's take a look at fields and what information they provide.

id
A unique name that will be used to identify this view.
name
A translatable name that will be used in the UI for this view, this is what will be displayed as the title of the application when it is launched.
class
A fully qualified name of the class that implements org.eclipse.ui.IViewPart. A common practice is to subclass org.eclipse.ui.part.ViewPart to inherit the default functionality.
category
An optional attribute composed of the category IDs separated by '/'. Each referenced category must be declared in a corresponding category element.
icon
A relative name of the icon that will be associated with the view.

For a more complete description for each field, in the Extension view, select org.eclipse.ui.views and click Open extension point description.


Listing 2. plugin.xml
                
   <extension
         point="org.eclipse.ui.views">
      <view
            category="org.eclipse.testworkbenchapp"
            class="org.eclipse.testworkbenchapp.views.SampleView"
            icon="icons/sample.gif"
            id="org.eclipse.testworkbenchapp.views.SampleView"
            name="Sample View"/>
   </extension>     	

A SampleView.java would also be added to your project for you to modify. Again, to make a simple application, delete everything except the createPartControl(Composite parent) and setFocus() in the file. The createPartControl is the meat of the view; it is where we put the codes for our application. Use the composite passed as the parent and put our UIs under it. These controls will be created and shown when the workbench launches the application. In Listing 3, we create a Label and set its text to say "hello."


Listing 3. SampleView.java
                
package sampleapp.views;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.part.*;
import org.eclipse.swt.SWT;

public class SampleView extends ViewPart {

	/**
	 * The constructor.
	 */
	public SampleView() {
	}

	/**
	 * This is a callback that will allow us
	 * to create the viewer and initialize it.
	 */
	public void createPartControl(Composite parent) {
		Label myLabel = new Label(parent, SWT.BORDER|SWT.CENTER);
		myLabel.setText("Hello from SampleView!!!");
	}


	/**
	 * Passing the focus request to the viewer's control.
	 */
	public void setFocus() {
	}
}

Define your workbench contribution

The last step of creating a simple application is to add an extension to org.eclipse.ercp.eworkbench.applications.

  • Open MANIFEST.MF and switch to the Extensions tab, then click Add ....
  • Uncheck Show only extension points from the required plug-ins, then select org.eclipse.ercp.eworkbench.applications from the list, then click Finish.
  • Answer No to the popped-up New plug-in dependency dialog.
  • Right-click on the extension and choose New > application. An application tag will be generated in the plugin.xml for this extension point.
  • Change id to org.eclipse.testworkbenchapp.application and change name to Test workbench app in your extension. For singleton, set it to true, which makes sure only one instance of this application could be existing during runtime.
  • Right-click on the application tag and choose New > view. A view tag will be generated under the application tag for you in the plugin.xml.

Figure 9 lists the extensions in our project.


Figure 9. Extensions 2
Extensions

Next, let's take a look at what was added to the plugin.xml from extending org.eclipse.ercp.eworkbench.applications and the meaning of each field in this extension point (see Listing 4).

Tag the application:

id
Unique identifier for this application
name
Human-readable name of this application

Sub-tag views:

normal
Identifier of Normal view. Normal view is the primary view -- it is required for the application to work correctly, by default, the normal view is loaded.
large
Identifier of Large view. Large view is an optional view -- it is loaded when the screen size exceeds 480x640.
status
Identifier of Status view. Status view is an optional view -- it is used in small display screens in a multiple-screen device.

Note that it is very important to change the value of normal in tag view to match the value of the attribute id in extension views. This is essential for the application to run correctly. In this example, we change it to org.eclipse.testworkbenchapp.views.SampleView, as shown in Listing 4.


Listing 4. plugin.xml
                
   <extension
         point="org.eclipse.ui.views">
      <view
            category="org.eclipse.testworkbenchapp"
            class="org.eclipse.testworkbenchapp.views.SampleView"
            icon="icons/sample.gif"
            id="org.eclipse.testworkbenchapp.views.SampleView"
            name="Sample View"/>
   </extension>
   <extension
         point="org.eclipse.ercp.eworkbench.applications">
      <application
            id="org.eclipse.testworkbenchapp.application"
            name="Test workbench app"
            singleton="true">
         <views normal="org.eclipse.testworkbenchapp.views.SampleView"/>
      </application>
   </extension>	   

Run it

Running eWorkbench applications is a bit different from eRCP applications:

  • Click Run > Run ..., double-click Eclipse Application, which creates a new configuration for you.
  • Change Name to your favorite configuration name (for example, eWorkbench application).
  • Switch to the Plug-ins tab, select Choose plug-ins and fragments to launch from the list. Make sure you've selected all the plug-ins inside Target Platform and the eWorkbench plug-in you just created.
  • Click Apply, then Run, which brings up eWorkbench, as shown in Figure 10.
  • Click Test Workbench app, which brings you to the UI controls of the view created above, as shown in Figure 11.

Figure 10. eWorkbench
eWorkbench


Figure 11. A view of eWorkbench application
A view of eWorkbench application

Define your preference

You can add preferences to your application by classes extending PreferencePage. The feature provided by eJFace allows a user to store and retrieve his own preference from the preference store. The preference page is optional. When using it, the method createContents() is where to put your code. Using the composite, it passes to you as a parent of your controls. The workbench will bring up a multipage dialog for the preference pages when users launch your application and click Command > Preference. To utilize the preference store, you need to extend the org.eclipse.ui.preferencePages extension point and provide a few pieces information (see Listing 5).

id
The unique identifier that will represent your preference page.
name
The name of the preference page displayed on the preference page dialog.
class
A name of the fully qualified class that implements org.eclipse.jface.preference.IPreferencePage
category
A path indicating the location of the page in the preference tree. The path may be a parent node ID or a sequence of IDs separated by '/', representing the full path from the root node.

Listing 5. plugin.xml
                
   <extension
         point="org.eclipse.ui.preferencePages">
      <page
            class="org.eclipse.testworkbenchapp.preferences.SamplePreferencePage"
            id="org.eclipse.testworkbenchapp.preferences.SamplePreferencePage"
            name="Sample Preferences"/>
   </extension>

Figure 12 shows the extensions that should be currently in your list.


Figure 12. Extensions
Extensions

Listing 6 shows the sample code for the preference page.


Listing 6. Preference sample
                
package mySample.app.preferences;

import java.io.IOException;

import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;


public class SamplePage extends PreferencePage {

	private static final String COLOR = "preference.Color";
	private static final String FOOD = "preference.Food";
	private static final String DRINK = "preference.Drink";
	private static final String COMEDY = "preference.Color";
	private static final String HORROR = "preference.Food";
	private static final String ACTION = "preference.Drink";
	
	private Text Color, Food, Drink;
	private Button check1, check2, check3;
	
	private PreferenceStore preferenceStore;
	Composite composite;  
	
	protected Control createContents(Composite parent) {
	    composite = new Composite(parent, SWT.NONE);
	    composite.setLayout(new GridLayout(2, false));

	    preferenceStore = new PreferenceStore("mySample.properties");
	    try {
	      preferenceStore.load();
	    } catch (IOException e) {}
	    
	    Label l = new Label(composite, SWT.LEFT);
	    l.setText("Favorite Color:");
	    Color = new Text(composite, SWT.BORDER);
	    Color.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	    Color.setText(preferenceStore.getString(COLOR));

	    new Label(composite, SWT.LEFT).setText("Favorite Food:");
	    Food = new Text(composite, SWT.BORDER);
	    Food.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	    Food.setText(preferenceStore.getString(FOOD));

	    new Label(composite, SWT.LEFT).setText("Favorite Drink:");
	    Drink = new Text(composite, SWT.BORDER);
	    Drink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	    Drink.setText(preferenceStore.getString(DRINK));
	    composite.pack();
		
	    Composite composite2 = new Composite(composite, SWT.NONE);
	    composite2.setLayout(new RowLayout(SWT.VERTICAL));
	    
	    new Label(composite2, SWT.NONE).setText("Favorite movie type");	    
	    
	    check1 = new Button(composite2, SWT.CHECK);
	    check1.setText("Comedy");
	    check1.setSelection(preferenceStore.getBoolean(COMEDY));

	    check2 = new Button(composite2, SWT.CHECK);
	    check2.setText("Horror");
	    check2.setSelection(preferenceStore.getBoolean(HORROR));

	    check3 = new Button(composite2, SWT.CHECK);
	    check3.setText("Action");
	    check3.setSelection(preferenceStore.getBoolean(ACTION));
		
	    return composite;
	}

	public boolean performOk() {
		
		// save values
	    if (Color != null) preferenceStore.setValue(COLOR, Color.getText());
	    if (Food != null) preferenceStore.setValue(FOOD, Food.getText());
	    if (Drink != null) preferenceStore.setValue(DRINK, Drink.getText());
	    if (check1 != null) preferenceStore.setValue(COMEDY, check1.getSelection());
	    if (check2 != null) preferenceStore.setValue(HORROR, check2.getSelection());
	    if (check3 != null) preferenceStore.setValue(ACTION, check3.getSelection());
	    
	    try {
	        preferenceStore.save();
	      } catch (IOException e) {
	        return false;
	      }
	   
	    return true;
    }
	
	public boolean performCancel() {
		return true;
    }

}

To make the code compile correctly, you must import additional packages in your MANIFEST, as shown in Figure 13.


Figure 13. Import packages
Import packages

Notes on preference page

The code from Listing 6 uses PreferenceStore(String) to create or open a PreferenceStore, the argument String should be a unique name for the store. Use PreferenceStore.load() to retrieve data from the store. The code defines unique keys and pair them with values. The code retrieves values with preferenceStore.getString(key) and preferenceStore.getBoolean(key), and set them to appropriate fields. The code writes values in to the PreferenceStore with preferenceStore.setValue(key, value) with a preferenceStore.save() in the performOk(). This is executed when the user clicks Command > OK to dismiss the preference page. You can have more than one preference page by extending more than one org.eclipse.ui.preferencePages, with corresponding implementation in place.

Figure 14 shows the sample preference page displayed.


Figure 14. Preference sample
Preference sample



Back to top


How to generate logs for debugging

The RCP platform provides a logging facility to record exceptions, warnings, any service-sensitive events, or for debugging purposes. The same logging facility is also provided in the eRCP platform.

Every plug-in has its own log associated with it. However, all logging information will eventually get aggregated into a platform log file. A plug-in's log could be retrieved through getLog(). Five logging levels are provided by log severity:

  • Status.OK
  • Status.INFO
  • Status.WARNING
  • Status.ERROR
  • Status.CANCAL

Let's make use of the previous eWorkbench application sample to demonstrate how Eclipse logging works.

Add three overloading log methods to the plug-in

Listing 7 creates three overloading log methods in the org.eclipse.testworkbenchapp.Activator plug-in.


Listing 7. Overloading log methods
                
import org.eclipse.core.runtime.Status;
...

public static void log(String msg) {
	log(msg, Status.INFO);
}

public static void log(String msg, int code) {
	log(msg, code, null);
}


public static void log(String msg, int code, Exception e) {
	getDefault().getLog().log(new Status(code, getDefault().getBundle().getSymbolicName(), 
	code, msg, e));
}

The utility class Status plays an important role here. It writes logs into platform logging using five arguments:

severity
The severity -- either OK, ERROR, INFO, WARNING, or CANCEL
pluginId
The unique identifier of the relevant plug-in
code
The plug-in-specific status code, or OK
message
A human-readable message, localized to the current locale
exception
A low-level exception, or null if not applicable

Make use of logging

We modify the performOk() a bit, as shown in Listing 8 to do logging while saving. It logs in a normal save or when an exception happens.


Listing 8. Logging
                
import org.eclipse.core.runtime.Status;
...

	    try {
	        preferenceStore.save();
	        org.eclipse.testworkbenchapp.Activator.log("Saved OK");
	      } catch (IOException e) {
	    	  org.eclipse.testworkbenchapp.Activator.log("Saved Fail",Status.ERROR,e);
	        return false;
	      }

Check the log

The .log file is generated at workspace/.metadata/.log. System.out and System.err won't work if a console is not available. Logging is beneficial in terms of debugging under these circumstances.

The code below shows how the logs are put into the .log file.

!ENTRY org.eclipse.testworkbenchapp 1 1 2006-10-03 16:58:39.584
!MESSAGE Saved OK



Back to top


Deploy to real devices

We have almost covered all important pieces in developing and debugging eRCP applications. In this section, we use a real device: Windows Mobile 2003/Windows Mobile 5, supported devices in eRCP, to demonstrate how the deployment could be easily done. The basic idea for deploying your application is to export it as a deployable plug-in via Eclipse PDE, then copy the plug-in JAR file over the device's eRCP plug-ins folder. With restarting eRCP runtime, you'll find that your application is listed as a new eWorkbench application entry. We won't go over this approach because it's straight-forward, and you can do that on your own. We're going to use a more systematic approach: deployment through update manager.

Create a feature containing the application plug-in

A plug-in can't be installed through update manager without a feature packaged around it. That's why we'll create a feature here. The steps for creating a feature are similar to creating a plug-in, so we will omit the details. Make sure you select org.eclipse.testworkbenchapp in Referenced Plug-ins and Fragments.

Listing 9 describes feature.xml.


Listing 9. org.eclipse.testworkbenchapp.feature feature.xml
                
<feature
      id="org.eclipse.testworkbenchapp.feature"
      label="Test workbench application Feature"
      version="1.0.0">
...
   <plugin
         id="org.eclipse.testworkbenchapp"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>      

Create an update site containing the feature

To install a application through update manager, an update site is required for the user to browse and initiate installation. In addition, installed features could be managed by update manager like updating, disabling, and removing. A user can also view the feature status through update manager's UI.

A user can create an Update Site Project via Eclipse PDE, where they can also set up categories and add features to categories if organizing a site is categorized by the application's purpose (for example, runtime applications, sample applications, documentation, etc.).

We create a site named org.eclipse.testworkbenchapp.updatesite, with one category -- Test App -- containing the feature created earlier. You can use Build All to have required features and plug-ins generated and put inside your site project.

Listing 10 describes site.xml.


Listing 10. site.xml
                
<site>
   <feature url="features/org.eclipse.testworkbenchapp.feature_1.0.0.jar" 
   id="org.eclipse.testworkbenchapp.feature" version="1.0.0">
      <category name="Test App"/>
   </feature>
   <category-def name="Test App" label="Test App"/>
</site>

Install via update manager

  • Make sure your ActiveSync connection is created with your device plugged onto the cradle.
  • Copy the whole update site folder (which contains two subfolders: features and plug-ins) to \My Documents.
  • Launch eWorkbench and click Application Manager.
  • Click Install New Applications/Features.
  • Click Command > Add Location, which brings you a dialog to choose where to install features, then choose Local and Next.
  • You'll find that it automatically searches the site.xml of the update site we just put in. Click site.xml, then click Finished.
  • Now you have an updated site bookmark. Check the site and click Next.
  • After the searching of the site is complete, expand the tree to browse what features are available in this update site. Check Test workbench application, then click Next.
  • Choose I accept the terms in the license agreemtns, then click Next.
  • Update manager will install the feature for you. Once complete, you will be asked to restart the runtime for the changes to take effect. In terms of eRCP, users have to restart the runtimes manually.

You'll find that your new application is installed in eWorkbench as shown in Figure 15. Figure 16 shows the same UI running on a handheld device. Compare Figure 16 to Figure 11, where the application is running on a desktop.


Figure 15. eWorkbench on device
Preference sample


Figure 16. Test the workbench application on device
Preference sample



Back to top


Differences between RCP and eRCP applications

The eRCP, for the most part, is a subset of the Eclipse RCP component. It includes the core runtime, eSWT, JFace, eUpdate Manager, and eWorkbench just as the nonembedded SWT, JFace, update manager, and workbench that the RCP component has. The difference in the embedded version and the desktop version falls on the limitations of the mobile device vs. desktop computer.

Other than the shortage of storage and processing power on the mobile device, we need to consider the UI and input of the device. The eRCP takes into consideration whether the device has a touch screen or only softkeys; whether it has a keyboard; whether it has a small, large, or both sets of display sizes; and how the device traverses through the list of widgets on a page without being able to click and drag the scroll bar.

On top of the core and extension UI the SWT has, the eSWT also includes a mobile extension that supports the different features of each device. In short, the difference between the RCP and eRCP is that the embedded component inherits most of the API from the RCP, sacrifices certain functions to compromise for the mobile environment, and adds some UIs and APIs specific to the feature of individual mobile devices.

Share this...

digg Digg this story
del.icio.us Post to del.icio.us
Slashdot Slashdot it!



Back to top


Conclusion

We took you through a complete eRCP application development step by step. In addition, we covered debugging and deployment. Two examples describe how to write a stand-alone eRCP application and an eWorkbench application. The update site sample describes how a formal deployment is being applied for the eRCP platform. We provided some points regarding the differences between RCP and eRCP, and how eRCP can target device-specific features.




Back to top


Downloads

DescriptionNameSizeDownload method
eRCP application Sample Codeorg.eclipse.testercp_1.0.0.jar5KBHTTP
eWorkbench application Sample Codeorg.eclipse.testworkbenchapp_1.0.0.jar9KBHTTP
eRCP Sample Featureorg.eclipse.testworkbenchapp.feature_1.0.0.zip1KBHTTP
eRCP Sample Update Siteorg.eclipse.testworkbenchapp.updatesite_1.0.0.zip6KBHTTP
Information about download methods


Resources

Learn

Get products and technologies

Discuss


About the authors

Uriel Liu is a software developer at the IBM China Software Development Lab and works in WED client technology. He is also a committer on the eRCP project.


Michael Cheng

Michael Cheng is a software developer at the IBM China Software Development Lab and works in Lotus Expeditor client technology. He is also a committer on the eRCP project.




Rate this page


Please take a moment to complete this form to help us better serve you.



YesNoDon't know
 


 


12345
Not
useful
Extremely
useful
 


Back to top