Helios: How to Prepare Your Eclipse for RCP/Plugin Development

Some RCP-newbies are having difficulties to correctly setup their environment for RCP/Plugin development. Most of them are familiar with Eclipse but not using the Eclipse for RCP/RAP developers package. The problem is sneaky because everything is working except that you don’t get proposals when adding child to the extension. See the following video.

How to fix that? You have to install Eclipse RCP Plug-in Developer Resources from Helios repository and this video shows you how.

Now you can develop the RCP application as you like.

Guava: Using ListenableFuture

Google Guava has many interesting classes which we can use on our application. The ones from collection package have been already used by many developers and this blog has tutorial on how to use the computing map.

I want to move to the other package. This one is com.google.common.util.concurrent, specifically I want to introduce ListenableFuture. The documentation of the class is as follow:

This interface defines a future that has listeners attached to it, which is useful for asynchronous workflows. Each listener has an associated executor, and is invoked using this executor once the Future’s computation is Future#isDone() complete}. The listener will be executed even if it is added after the computation is complete.

Consider following example. If we have task T1, T2, and T3. T2 can only be done when T1 is finished and T3 can only be done once T2 is ended. The diagram below shows the dependency.

The easiest solution without any concurrency is of course to just run each task one after another. But consider that we have 5 set of these operation. Without thread we can end up with serial solution depicted by the following picture.

ListenableFuture made it easy to create the concurrent version of the solution.

This is a code example of this solution which will print “1”, then pause for a second before printing “2”, and another stop for 1 second before finally printing “3”. Note that ListenableFutureTask extends ListenableFuture.

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.google.common.util.concurrent.ListenableFutureTask;

public class TestListenableFuture {

	static class SimpleTask extends
			ListenableFutureTask<Void> {
		SimpleTask(final String message) {
			super(new Callable<Void>() {

				public Void call() throws Exception {
					return null;

	public static void main(String[] args) {
		ListenableFutureTask<Void> task1 =
			new SimpleTask("1");
		ListenableFutureTask<Void> task2 =
			new SimpleTask("2");
		ListenableFutureTask<Void> task3 =
			new SimpleTask("3");

		ExecutorService exec =
		task1.addListener(task2, exec);
		task2.addListener(task3, exec);

		try {
		} catch (InterruptedException e) {

Pretty easy, isn’t it? And we can probably extend this solution to create a full workflow framework solution.

UPDATE: Remember that the API is still in Beta version. I’ll try to update it once the release version is released

Introduction to Eclipse Command

Command in Eclipse represents task. Anything can be a task. In the example in the picture above, I used ‘delete’ as example. A command can have several handlers, which are active on different conditions. In the previous example, I used three handlers which active depend on the type of the object.

Commands can be triggered from one or more place(s). We can define a menu that call a command or define a context menu for that. We can also bind a keyboard shortcut to call a command and we can as well programmatically call a command from our code. And that’s just some examples.

Command, architecturally, is representation of controller. Using command should made it easy for developer to get a big picture of what an application does. Just list all the command and that should be it.

You can find more about command in these links.

What is Eclipse-RCP-based Application?

To get the answer of that question, we need to take a look at the global architecture of an Eclipse-RCP-based application. This picture below can summarize the information.

SWT is Standard Widget Toolkit for Java. Developed by IBM and later by Eclipse Foundation, the purpose of SWT is to give native performance and look to Java application. SWT is implemented using JNI and so is not write-once-run-anywhere-library (WORA). This mean that each OS need specific SWT distribution.

JFaces is a layer above SWT which provides more convenience classes for generic application. JFaces is a WORA library.

OSGi is a standard developed by consortium with the same name to provide Java environment that is more dynamic. The goal is extensible, loosely-coupled applications with modules behind it.

Equinox is Eclipse implementation of OSGi.

Eclipse Core and Eclipse UI are classes that form the platform of Eclipse. All Eclipse-RCP-based applications will use this classes. Among other things, it provides extension framework, command framework (and somewhat-deprecated Action framework), and basic application-window management.