No icon, no editor

There are many parts of RCP that are a little rough around the edges. That’s to be expected in an open-source framework, and to be honest it’s one of the things I like about RCP. Sure, commercial frameworks are cleaner and packaged more “professionally”, but they have to give up a lot of functionality and dynamism to achieve this.

But once in a while I hit a problem that just makes me go ugh! (and grrrr!). One of the best examples of this is the fact that if you don’t give an editor an icon, your editor won’t show up. If you happen to have logging turned on (and if your launch configuration does not include the -consoleLog parameter, it really should), you’ll at least get a somewhat informative message on startup:

!ENTRY org.eclipse.ui 4 4 2007-04-30 15:37:05.037
!MESSAGE Plugin com.marketcontours.ui.builder, extension org.eclipse.ui.editors
Required attribute 'icon' not defined

But you may not understand the true importance of this message until you try to open your editor. At that point you’ll more than likely get a very unhelpful NullPointerException, as the editor registry will simply return you a null editor.

I probably shouldn’t admit this (being a trainer and all), but I’ve actually had this happen to me repeatedly, and for some reason it always takes me a while to figure out what’s going on. It may have something to do with my failing to believe that omitting an icon could have this kind of effect. Also, in every class I teach, there is at least one student that hits this problem and is completely dumbfounded. I’m going to assume based on this random sample that many beginning RCP developers run into this.

There is already a Bugzilla entry for this defect (it’s actually listed as an enhancement), if you feel like voting for it.

Advertisements

4 Responses to No icon, no editor

  1. Hi Patrick,

    interesting article. The described behavior could be a good example in a discussion on robust and forgiving vs spec-enforcing extension points.

    However, you should consider linking to Bug 65731 instead. Bug 129765 is a duplicate of it :).

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=65731

    Regards,
    Elias.

  2. pjpaulin says:

    Hi Elias,

    I changed the Bugzilla link. Thanks for catching that.

    — Patrick

  3. Kim Horne says:

    This bug is an unfortunate example of something can continue to fall through the cracks release after release. As annoying as it is for those who experience it there are SO MANY more important bugs for us to address that this one never gets any love. I personally own no less than 740 bugs and when the time comes to choose one of these from the bucket to fix the one that impacts the most people in the most visible way is going to get preference to one like this. Sorry. 😦

  4. pjpaulin says:

    Hi Kim,

    Thanks for taking the time to reply. I really appreciate all the work you do on the Eclipse project.

    I understand that this defect isn’t critical, but as a trainer and RCP evangelist I’m sensitive to defects that impact developers just learning the technology. Defects like this (that seem to make no sense) make those evaluating RCP nervous.

    In any case, it’s therapeutic to vent, and hopefully this post will at least save other developers some time when they hit this issue.

    — Patrick

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: