Category Archive for: ‘General’

Dynamic OSGi Session @ OOP 2009


Together with my buddies Martin Lippert and Gerd Wütherich I gave a talk about “patterns and best practices for dynamic OSGi applications” at the OOP conference in Munich. The talk was fun and even Peter Kriens told us afterwards that he learned something :). You can download the presentation here. Most things in the presentation are implemented in my dynamic OSGi demo, take a look at the project home page. Here you find examples of the Whiteboard pattern, the Extender pattern, as well as UI view contribution services using

  • OSGi Declarative Services
  • Spring Dynamic Modules
  • iPOJO
  • Google Guice / Peaberry

Have Fun


Equinox OSGi Applications: Deploying, Building and WebStarting


Recently I created a continuous integration environment for my dynamic Swing OSGi demo. For the headless build I use PDE build and I also created a feature and a main jnlp file to make the application startable using Java WebStart. Here is a screenshot of the current version:


If you have Java 6 installed, you can launch the application through WebStart. In the following weeks I plan to blog about the details of

  • Deploying Equinox applications as binaries
  • Making the application startable using Java WebStart
  • Creating a headless PDE build (including JAR signing and generating of jnlp files)

If you want to have a look at the current sources, you find all information at the project home page.

Stay tuned


p2 tip of the week: How do I get my feature branding back?


You may have noticed that feature brandings disappear if you get rid of all the update manager stuff and just use p2 (version 3.4.1). The solution to get the feature brandings back is quite simple: Deploy org.eclipse.update.configurator with your RCP application. But that’s not quite enough. Since org.eclipse.update.configurator is activated lazily, just invoke a static function, e.g.
ConfiguratorUtils.getCurrentPlatformConfiguration() in the startup phase of your application. Or, if you don’t want to have dependencies to org.eclipse.update.configurator, just call Platform.getBundle(“org.eclipse.update.configurator”).start() (Thx Tom :)). The picture below shows the About dialog with feature brandings of my current MP3 Manager. The application was created during a headless build, using p2 director to create the executable


Have Fun!


Eclipse Databinding + Validation + Decoration


When it comes to databinding, a very common use case is to decorate form fields with little markers that indicate the state of the control. The following example explains how to do this with Eclipse databinding and JFace. Here is a screenshot:

Validation Decoration

The code to create an error decoration for a control is pretty straight forward:

ControlDecoration controlDecoration = new ControlDecoration(
    control, SWT.LEFT | SWT.TOP);
FieldDecoration fieldDecoration = FieldDecorationRegistry

After creating the error decoration, you can implement a databindig validator that checks the condition and hides or shows the decoration accordingly:

class StringRequiredValidator implements IValidator {

    private final String errorText;
    private final ControlDecoration controlDecoration;

    public StringRequiredValidator(String errorText,
        ControlDecoration controlDecoration) {
        this.errorText = errorText;
        this.controlDecoration = controlDecoration;

    public IStatus validate(Object value) {
        if (value instanceof String) {
            String text = (String) value;
            if (text.trim().length() == 0) {
                return ValidationStatus
        return Status.OK_STATUS;

Now you can bind a model property to a text field with an UpdateStrategy using your validator:

    SWTObservables.observeText(firstNameText, SWT.Modify),
    PojoObservables.observeValue(person, "firstName"),
    new UpdateValueStrategy()
        .setAfterConvertValidator(new StringRequiredValidator(
             "Please enter first name",

If you want to use (existing) validators without handing the control decoration over, you could create a map for controls and their corresponding decorators, and then use an AggregateValidationStatus to control the decorators:

AggregateValidationStatus aggregateValidationStatus
 = new AggregateValidationStatus(

   .addChangeListener(new IChangeListener() {
    public void handleChange(ChangeEvent event) {
      for (Object o : dataBindingContext.getBindings()) {
        Binding binding = (Binding) o;
        IStatus status = (IStatus) binding
        Control control = null;
        if (binding.getTarget() instanceof ISWTObservable) {
          ISWTObservable swtObservable =
             (ISWTObservable) binding.getTarget();
          control = (Control) swtObservable.getWidget();
        ControlDecoration decoration
          = decoratorMap.get(control);
        if (decoration != null) {
          if (status.isOK()) {
          } else {

You can download an Eclipse project with the running examples here: Binding Decoration Examples. I also implemented this in my RCP demo project MP3 Manager.

Have Fun!


I am speaking at EclipseCon

I am very happy that my “Advanced Eclipse Rich Client Platform Tutorial” (together with Ben Pasero), my little “e4 RCP CSS Styling Demo“, and also the tutorial “RCP Mail 2.0: Commands, Common Navigator, and Data Binding” (together with Boris Bokowski, Frank Gerhardt, Francis Upton IV, and Michael Scharf) were accepted at EclipseCon 2009.

I am looking forward to seeing you in Santa Clara!

Have Fun


Dynamic Swing OSGi Demo


I am preparing a few talks about dynamic OSGi applications. To get my hands dirty I started a little demo project to showcase different scenarios. That SWT works very well with OSGi is obvious, since Eclipse RCP is based on OSGi. But there are not many Swing based OSGi applications out there. That’s why I started playing around with the dynamic creation and deletion of Swing GUI.

The demo application shows how to use OSGi Declarative Services (DS) and Spring Dynamic Modules (Spring DM) together with Swing UI (and the Swing Application Framework, JSR 296). The goal of this project is to share best practices when it comes to dynamic OSGi-based applications.

The project home page is There you find a bit of documentation and how to get the sources from svn. The current implementation works well with Equinox, I haven’t tried out other OSGi implementations yet.

I would appreciate if OSGi experts take a look at the source code and help me improving the code base. Here is a screen shot:

Have fun!


e4 + css contacts demo


Based on the work of Tom, Boris, Kevin, Angelo and many others, I started a little e4 demo, playing around with Angelo’s Tk-UI css engine to style SWT. Here is the current result:

e4 contacts demo + css

As you see, many things work nicely, some don’t (yet). From the end user’s point of view it was pretty easy to use the Tk-UI css engine. This is definitely something I will investigate further…

JAOO 2008 Conference


I just returned from JAOO 2008, a developer conference held in Aarhus, Denmark. Jaoo is one of my favorite conferences, and this year it was as great as the years before. My “Advanced Eclipse RCP” tutorial went well and I got very valuable feedback. But one thing bothers me when I give “Advanced” RCP tutorials. There are so many topics that I would consider “advanced” that I have to pick them with regards to the expected audience and the tutorial time. So here is my question: What are the 5 most important advanced RCP topics that you would like to see in an advanced RCP tutorial?

Subversive vs. Subclipse


I am a bit frustrated right now. Last week I installed Eclipse 3.4 and I thought, now it is a good time to give Subversive a try, since it is the “official” subversion client now. I am using Subclipse for years now, and it was working very well and smoothly til today. Here are my experiences using Subversive with Native JavaHL connector (Eclipse 3.4 on Windows Vista together with an existing Subversion repository):

  • I destroyed accidentally the src/* directories of many of my projects in the trunk of my subversion repository. I don’t know what I did wrong, because on the client-side everything looked fine to me (And I did exactly what Subversive recommends about reconnecting svn working copies checked out with another client). I only realized the deletion of the source folders when I wanted to check out the projects from another machine. I googled about that strange behavior and found out that I was not the first one who destroyed the src directories…
  • Then I fixed the repository from a recent tag, and checked out all projects into a clean workspace using Subversive. Now I am having problems with the bin directories. I don’t know why, but Subversive thinks that some of my Java files are in the bin directory on the server, but of course they are not. I got error messages like: 0x00000004: The resource is inaccessible: /com.siemens.ct.mp3m/bin/com/siemens/ct/mp3m/ When I open the synchronize view I also see Java files in the svn repository’s bin sub-directory (which don’t exist in the repository)

Probably I just don’t use Subversive the right way or I should try another connector, but right now, I want to switch back to Subclipse. I am wondering if others have similar experiences using Subversive + native JavaHL and Eclipse 3.4 on Vista. Or, I would appreciate any tips how to make it work like I would expect.

RCP Self Provisioning with P2: It Works!!!


I finally could create the mail demo RCP app using p2 to update itself!
My environment is Windows Vista, Java 6, Eclipse 3.4 RC4.

Here are the steps that describe how I p2-enabled the mail demo:

1. Created the mail demo (project p2-maildemo)

2. Created a product configuration p2-maildemo.product

3. Added 3 plug-ins to both launcher and product configuration (and added required plug-ins)
– org.eclipse.equinox.p2.exemplarysetup
– org.eclipse.equinox.p2.ui.sdk
– org.eclipse.equinox.simpleconfigurator.manipulator

To get the final update work in the installed product, it is also necessary to include the following 3 plug-ins with dependencies in the product configuration:
– org.eclipse.ecf.provider.filetransfer
– org.eclipse.equinox.p2.touchpoint.eclipse
– org.eclipse.equinox.p2.touchpoint.natives

4. Exported the product and the metadata/artifact repositories to c:/java/RCP/p2-maildemo

5. Used the director app to install the mail demo from the repository, with the following Program arguments:
-metadataRepository file:c:/java/RCP/p2-maildemo/repository
-artifactRepository file:c:/java/RCP/p2-maildemo/repository
-installIU p2_maildemo.product
-version 1.0.0
-destination c:/java/RCP/p2-maildemo/install
-profile MaildemoProfile
-bundlepool c:/java/RCP/p2-maildemo/install
-profileProperties org.eclipse.update.install.features=true
-p2.os win32 win32
-p2.arch x86

VM arguments:

6. Started the installed mail demo in c:/java/RCP/p2-maildemo/install

7. Selected Help/Software Updates…: Showed the P2 UI with installed Product in version 1.0.0

So far so good!

Now I wanted to create a new version 1.0.1 of the product and update the installed version 1.0.0:

8. Updated main mail demo plug-in to version 1.0.1

9. Updated product version to 1.0.1

10. Exported the new product version 1.0.1 in the SAME location, to update the metadata/artifact repositories.

The first thing I noticed was that my installed 1.0.0 did not find any update. I thought, when the installation repository contains a new version, this would be seen by my application without any extra configuration.

11. So I added the repository c:/java/RCP/p2-maildemo/repository manually as a new site, and voila, the new version 1.0.1 was displayed and ready for update.

12. When I wanted to install the update, the P2 dialog told me correctly: “RCP Product is already installed, so an update will be performed instead.”

13. And now, when I clicked finish, the update was actually happening, the new version was installed properly!!!

I am so happy that I finally got this to run 🙂

What would be the best practice to create a list of artifacts/metadata repositories in the configuration/.settings/org.eclipse.equinox.p2.metadata.repository.prefs and org.eclipse.equinox.p2.artifacts.repository.prefs to include the real update sites for the product?

Many thanks to everybody who helped me.


Page 9 of 12« First...«7891011»...Last »