July 23, 2007

An extension is not an extension point

I'm currently working for a customer in an RCP project. There is a lot of work to be done and we are around a dozen of programmers actively contributing. A couple of weeks ago we had a strange problem.
One of the core plugins of the app defines an extension point which is actively used by other components. At some point these extensions were not loaded anymore. After quite some time of guessing we found that there was a new plugin using the extension point. But instead of defining an extension the developer (not really familiar with the Eclipse extension mechanism) had defined an extension point. He named it exactly as the existing one and used the original schema file by referencing it from the original core plugin. I was somewhat surprised that the framework did not complain about this duplication, but the main lesson to learn is certainly that there is some basic RCP mechanisms every developer should be familiar with before contributing.

July 22, 2007

Actions with text in EclipseRCP

I'm using EclipseRCP for more than three years now, and I must say they've come a long way. I still really enjoy it, and with all the upcoming projects there's always new things to discover.
Standard functionality (like hooking buttons into the GUI) is next to trivial (as it should be) but sometimes things get a little bit more complicated when you want your application to look different than the Eclipse IDE.
A simple example, I like toolbar buttons to have a text next to the image. A little read shows that you can achieve this by setting the toolbar style in your actionbar advisor, and then defining your (global) actions there. Things get a bit more involved when you start using editors, and you want your editor actions (contributed via the IEditorActionBarContributor interface) to look the same as the global ones. You can still set the ActionContributionItem.MODE_FORCE_TEXT mode on your toolbar item, but there is no way to change the text alignment (I like the text to be below the image). Digging into the eclipse code I found that the toolbar used for the editor actions is created using the IActionBarPresentationFactory interface. A default one is used if you don't define your own presentation factory (extending AbstractPresentationFactory) which implements IActionBarPresentationFactory. So I created my own presentation (basically delegating to WorkbenchPresentationFactory) and let it extend IActionBarPresentationFactory.
It works, but uses internal API. So if anybody knows a better way to do that, drop me a line.

July 20, 2007

Ten minutes time

It really only takes ten minutes to hook up a blog. Don't know why it took me so long to get here.
Anyway, I finally made it. I'll start blogging about my daily coding experiences here, probably more or less for myself. But, hey, might be something in it for you too.

About Me

codes for a living and also in his freetime, probably for lack of a real hobby. ;-)