Author Archive for: ‘admin’

Eclipse RCP 3.6.x: Got Headless PDE Build working

In one of my previous posts I had some issues to get the headless 3.6.x PDE build running for a few of my RCP projects. But I quickly got many very helpful comments and now I have the build up and running on Windows Vista/7. I have to admit that the tricks I describe below considered to be hacks rather than a clean solution, but on the other hand it works at least for my RCP applications.

Trick 1: Modify the target 3.6.x platform
Usually I create my target platforms just by unzipping an Eclipse SDK and the corresponding delta pack. But this did not work with 3.6.x, as described in my previous post about PDE build. I got lots of unresolved dependencies. The trick to get rid of many of them is to delete everything from the target platform except the plugins and features directory. If your RCP application is not using p2 related stuff, then there is a good chance that the build will succeed. In my RCP applications I include the feature org.eclipse.equinox.p2.user.ui in my product configurations, that leads to an unresolved dependency to If you see the same in your build, then trick 2 might help.

Trick 2: Manually remove dependency to (if not needed)
If your RCP application just uses p2 for self-updating, then you probably don’t need a dependency to How to remove it manually I described in my blog post “Eclipse RCP p2 self-update with Eclipse 3.6.x“.

With above modifications I got the build running again. Please let me know, if these tricks work on other platforms, too. I explicitly want to thank Alexander, Albert MacSweeny and Frode for their helpful comments in my previous post about PDE build.

Have Fun!

Follow me on Twitter

Eclipse RCP p2 self-update with Eclipse 3.6.x


If you are using the feature org.eclipse.equinox.p2.user.ui in your RCP product to include the p2 update mechanism in your application, or if you just use p2 internally, you might run into some issues with Eclipse 3.6.x. If your update is not working and or you get a log entry “the update checker service is not initialized”, then probably the OSGi bundle org.eclipse.equinox.ds is not started properly. The easiest way to solve this issue is to include org.eclipse.equinox.ds with start level 2 in your product configuration (in the configuration tab, see screenshot below)

Another thing is the newly introduced dependency of the bundle org.eclipse.equinox.p2.ui.sdk to, which depends on org.eclipse.ui.ide… If you just want to use RCP self-updating, here is a recipe how to get rid of this dependency:

  • Import org.eclipse.equinox.p2.ui.sdk as source into your Eclipse IDE
  • Delete dependency to
  • Delete class RevertProfilePageWithCompare
  • Export the bundle
  • Replace the original org.eclipse.equinox.p2.ui.sdk with the newly exported version in your target platform

I would like to thank Alexander (comment in my last post) for the pointer to a p2-dev mailing list entry.

With these 2 tips I got p2 self update for my MP3 Manager running again with Eclipse 3.6.x. I also got the headless PDE build running again and will blog about that later.

Have Fun!

Follow me on Twitter

Oh No! My headless PDE build failed with Eclipse 3.6.1 :(


Yesterday I decided to update the headless builds for several of my Eclipse RCP based projects to Eclipse 3.6.1. No big deal, I thought. I did this several times in the last years and it took me only minutes. But this time, I can’t get the build running. My platform is Windows 7 32bit and I get the following errors:

[p2.director] An error occurred while collecting items to be installed
[p2.director]  session context was:(profile=profile,
phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
[p2.director]  No repository found containing: osgi.bundle,org.apache.ant,1.7.1.v20100518-1145
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.ant.core,3.2.200.v20100427
[p2.director]  No repository found containing: osgi.bundle,,3.5.100.I20100526-0800
[p2.director]  No repository found containing: osgi.bundle,,3.5.100.I20100526-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.core.filebuffers,3.5.100.v20100520-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.core.variables,3.2.400.v20100505
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.equinox.concurrent,1.0.100.v20100503
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.jface.text,3.6.1.r361_v20100825-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.text,3.5.0.v20100601-1300
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.ui.editors,3.6.1.r361_v20100825-0800
[p2.director]  No repository found containing: osgi.bundle,org.eclipse.ui.ide,3.6.1.M20100825-0800
[p2.director] An error occurred while collecting items to be installed

My RCP application does NOT have any dependencies to the above bundles. I found some hints here and a bug here, but did not find a working solution yet.

Is anybody out there who got a working headless PDE build under Windows using Eclipse 3.6.1?

If so, please let me know, I will update this post if I get it working.


Follow me on Twitter

My upcoming Eclipse 4.0 RCP related Sessions/Tutorials/Trainings

Summer is almost over, I had a great vacation with my family. Now I am looking forward to the upcoming events to talk about e4 (Eclipse 4.0 RCP respectively).

The next event is the JAOO conference at the beginning of October in beautiful Aarhus (Denmark). At JAOO I give a full day tutorial “Developing Rich Clients with Eclipse 4.0”. I like JAOO a lot, this is a conference where I always meet very interesting people and learn new things. If you plan to attend, here is a tip to get 20% discount. Follow me or any other JAOO speaker on Twitter and then use “JAOOspeakerfollower” as promotion code upon registration. Besides the great conference technical content, I really love the tasty food by Chilly John. Have you ever tasted a steak with a chilly/chocolate sauce?

One week later, at October 20th, I give a full day tutorial “Rich Client Entwicklung mit Eclipse 4.0” in Düsseldorf, Germany. This will be full day of e4 related RCP stuff with lot of hands-on experience.

The next event is Eclipse Summit Europe in Ludwigsburg (November 2-4). I will give an e4 tutorial “Anatomy of an e4 Application” together with Lars Vogel, participate in the “Eclipse 4.0 Hackfest” (together with Boris Bokowski, Tom Schindl and Lars Vogel). And I give a little short talk about “Eclipse 4.0: Theming the UI with CSS“. This conference is like a little EclipseCon in Germany. I am pretty exited that Jeff Norris is going to give a key note. The keynote Jeff gave at this year’s EclipseCon was one of the best I have ever seen in my life (and I have seen quite a lot keynotes :)).  Also Gunter Dueck is always fun, very nice to have him as keynote speaker.

Then, from November 15-19, I have a home match at the W-JAX conference in Munich, Germany. Here I talk about “Eclipse 4.0: CSS Styling and Workbench Modeling“. W-JAX in Munich is always great!

So, if you are interested in e4, there’s lots of upcoming events you could attend.

Have Fun!

Follow me on Twitter

CSS Theming for Eclipse RCP 3.x


Eclipse 4.0 brought a great new feature: Theming RCP applications with CSS. Another good news is, this cool feature can also be used with RCP 3.x based applications. The following screen shot shows the RCP Mail Demo, styled with CSS:

How to run the Demo with CSS styling?

  1. Checkout
  2. Import Project Set /releng/org.eclipse.e4.ui.releng/e4.ui.css.psf
  3. Checkout e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.ui.widgets (see bug 322641)
  4. Cleanup org.eclipse.e4.ui.css.swt (see bug 322644)
    => Organize Imports
    => Delete dependencies to org.eclipse.e4.core.*
  5. Start the CSS RCP Mail demo (project org.eclipse.e4.ui.examples.css.rcp)

The demo also provides dynamic theme switching. Here is is little excerpt from the defaul.css styling:

CTabItem, Label, Tree, Text {
 font-family: "Arial";

Shell {
 font-size: 12;

CTabItem, ToolBar, Button, CBanner, CoolBar {
 font-size: 9;
 background-color: white;

CTabFolder, CTabItem {
 background-color: #F0F1F7;

If you would like to play around with the css, just edit the files css/default.css and css/colorful.css in the project org.eclipse.e4.ui.examples.css.rcp. I have submitted a short talk at Eclipse Summit Europe to explain a few more details.

Have Fun!

Follow me on Twitter

Flattr and the Eclipse Community

Yesterday I discovered Flattr, a new micro payment cloud service that went to open beta recently. I have to admit, I really like the idea of Flattr: Spend a fixed amount of real money every month to honor the efforts of others who provide articles, blogs, software, music, video, etc. Let’s say you would like to spend $5 per month (minimum for Europeans is 2€). If you flattr just one thing, the owner will get a great portion of your 5$ (Flattr itself takes a little fee). If you flattr 50 things, every owner will get 1/50 = 10 cent. This does not seem to be much but all flattrs will add up.

In the past, I was just too lazy to donate something to open source projects or authors of great blogs and tutorials (like Tom Schindl, Lars Vogel and others). But now, I can easily recognize their work with just one click!

If you want to get more information about Flattr, just visit and take a tour. If you like it, an account is created very quickly and easily.

If you provide something to the community, especially the Eclipse community, that others find helpful, you could get some recognition for your work by other Flattr users easily.

For example, if you are the owner of an open source project where you put effort in your spare time, just put it as “Software Thing” into Flattr, tag it,  and put a Flattr button on the project web page (Shameless plug: I did this today with my Eclipse/OSGi related OSS projects MP3 Manager and Person Manager).

Or, if you blog, you could easily put Flattr buttons in or at the end of your blog. There are many plug-ins available for WordPress and probably other blogging systems.

In summery: I think Flattr is a great way to recognize people who provide helpful/interesting content and I am looking forward to flattring you if I like the content you provide.

BTW, if you like this blog post, you could flattr it: Just click on the Flattr button below in the original post (If you read this post from Planet Eclipse, just click on the post’s title to open the original post from my web site, then you should see a Flattr button at the end of this post).

Have Fun


Eclipse 4.0 RCP: Selection


One of the objectives of Eclipse 4.0 was to make rich client development easier. One good example is the following use case: One view provides a selection (e.g. using a JFace TableViewer) and another view wants to get notified about a new selection of a domain object to get the chance to react on it.

First the selection provider part. The selection services can be easily injected using dependency injection.

private ESelectionService selectionService;

When using a JFace viewer, the viewer selection has to be forwarded to the selection service:

tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
  public void selectionChanged(SelectionChangedEvent event) {
    IStructuredSelection selection =
       (IStructuredSelection) event.getSelection();

On the consumer side, the domain object is injected using an @Optional and @Named active selection. The following code snipped is part of a details view POJO that uses a WritableValue (Eclipse data binding) as holder for the actual domain object (of type IContact).

public void setSelection(
  @Optional @Named(IServiceConstants.ACTIVE_SELECTION) IContact contact) {
    if (contact != null) {

That’s pretty convenient and concise compared with the code needed in Eclipse 3.x.

Have Fun!

Follow me on Twitter

OSGi 4.2: Extender Pattern and BundleTracker

Today a updated my dynamic OSGi demo (see screenshot below),  in particular: the extender bundle. The extender pattern is a frequently used pattern in the OSGi world. The idea is to extend the semantics of bundles by adding custom manifest headers and react, if bundles with these headers come and go dynamically. Prominent examples for using the extender pattern are service component models like OSGi Declarative Services (DS) or Spring Dynamic Modules (Spring DM). In my demo I wanted to create a simple extender that tracks bundles with the custom manifest header “Action-Contribution” and provide a class that should be registered as a service. Here an example for such a custom manifest header (you find it in the manifest of bundle in the demo):


Before OSGi 4.2 I used Heiko Seeberger’s custom bundle tracker to deal with all workflow and threading issues. But since OSGi 4.2 comes with a convenient BundleTracker now, it is no longer necessary to implement all the plumbing. Here is the complete source code of my little extender:

public class ExtenderBundleTracker extends BundleTracker {

  private final Logger logger = LoggerFactory

  public ExtenderBundleTracker(BundleContext context) {
    super(context, Bundle.ACTIVE, null);

  public Object addingBundle(Bundle bundle, BundleEvent event) {
    String className = (String) bundle.getHeaders().get(
    if (className != null) {
      Class<?> clazz;
      try {
        clazz = bundle.loadClass(className);
        try {
                  clazz.newInstance(), null);
"Extender Action Contribution Service registered for: "
              + clazz.getName());

        } catch (InstantiationException e) {
          logger.error("Could not instantiate " + className, e);
        } catch (IllegalAccessException e) {
          logger.error("Illegal access during instatiation of class "
              + className, e);
      } catch (ClassNotFoundException e) {
        logger.error("Could not find class " + className, e);
    return bundle;

You might wonder, why I did not overload

public void removedBundle(Bundle bundle, BundleEvent event, Object object) {}

to unregister the services. Since I used the context of the active bundle that comes in to register the service, this service is automatically unregisterd when the bundle goes away.

Have Fun

Follow me on Twitter

Eclipse 4.0: Dependency Injection and OSGi Declarative Services


In my last post I explained how easy it is to inject your own objects. For the common use case that you want to specify an interface attribute but want an object being injected I showed a simple solution using a little factory. Another way of doing this is the use of OSGi declarative services (DS). But instead of creating a declarative service that implements the service interface you create a declarative service for a helper object that just registers your implementation class for the needed interface with the ContextInjectionFactory. So, the ContactPresentation code looks like this now:

	private IContactView contactView;

	public ContactPresenter(IContactView contactView) {
		this.contactView = contactView;

The xml for the declarative service is in OSGI-INF/views.xml:

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr=""
   <implementation class="...mvp.views.ContactViewCreationFunction"/>
      <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
   <property name="service.context.key" type="String"

The implementation class provides the interface org.eclipse.e4.core.contexts.IContextFunction and an additional property with the name service.context.key specifies the actual interface that the contact function is going to register. Here is the simple code for the ContactViewCreationFunction:

public class ContactViewCreationFunction extends ContextFunction {
	public Object compute(IEclipseContext context) {
		return ContextInjectionFactory.make(ContactView.class, context);

The only thing the ContactViewCreationFunction does is to bind the ConatcsView class to the context, using the above service.context.key to know the interface. I will check in the code soon, stay tuned…

It’s very important that you don’t forget to add the 2 manifest headers in the

Service-Component: OSGI-INF/views.xml
Bundle-ActivationPolicy: lazy

I would like to thank Tom Schindl for giving me the tip not to forget the lazy Bundle-ActivationPolicy!

Have Fun

Follow me on Twitter

Eclipse 4.0: Inject your OWN Objects


One of the great new features of Eclipse 4.0 is the use of dependency injection (DI). The new architecture does not use Singletons at all, but injects all the necessary objects in a given context. For example, a view is a POJO now and the necessary parent composite is injected:

public class ContactView implements IContactView {

	public ContactView(Composite parent) {

But how could you use DI to inject your own objects? It’s easy and straight forward: Just annotate the object (A) that needs your own object (B) injected with @Inject, either on attribute or on method level. The nice thing about this is that all available injectable objects (e.g. from the context) will automatically injected into (B). As an example, you could create a presenter that is not interested in UI toolkit (e.g. SWT) specific stuff but needs a view (that is interested in the SWT parent composite).

public class ContactPresenter {
	public interface IContactView {

	private IContactView contactView;

	public ContactPresenter(ContactView contactView) {

The flaw in this example is: the presenter gets a concrete ContactView object rather than an IContactView interface injected. The easiest way for getting around this is to introduce a little factory that gets a concrete object injected and returns the desired interface:

public class ContactViewFactory {
	ContactView contactView;

	public IContactView getContactView() {
		return contactView;

Now the presenter just lets the factory be injected and gets the IContactView interface:

	private IContactView contactView;

	public ContactPresenter(ContactViewFactory contactViewFactory) {
		contactView = contactViewFactory.getContactView();

Another way would be to provide an OSGi declarative service that registers a class for a given interface with the ContextInjectionFactory. This is how the services like the selection service are registered. Right now, I could not get this working (inject a ContactView to a needed IContactView), but as soon as I find out why or how, I’ll blog about it.

If you want to check out example code from cvs, take a look at the classes DetailsView and DetailComposite in the e4 contacts demo (host:, repository path: /cvsroot/eclipse, user:anonymous, path to bundle: e4/org.eclipse.e4.ui/examples/org.eclipse.e4.demo.contacts).

Have Fun

Follow me on Twitter

Page 6 of 12« First...«45678»10...Last »