Extended Presentation API

December 18, 2008 | 2 min Read

If you want to make a custom look&feel for an RCP or RAP application you have no choice other than to write a new Presentation. But if you’ve already worked with the Presentation API, I would bet that you’re not too happy with it. The only option the API gives you is to make StackPresentations, but what about other components like the ToolBar or MenuBar? There is an internal Interface called IActionBarPresentationFactory. You can implement it and you’ll have the opportunity to change the look&feel of the ToolBar, the View ToolBar, the CoolBar and the ToolBar’s Contribution items. Great. This is a lot more but it’s an internal - use it at your own risk.

Now that we have the PresentationFactory and the IActionBarPresentationFactory, we have a lot we can customize. But, there are still some components missing like the MenuBar and the view’s menu. You have no other choice except to hack these, but this isn’t really a choice, is it? ;)

If you want to customize a RAP application you need to do more than customize these components. You probably want to position these in different places and introduce additional components like a header and a footer. You can do this right now using the WorkbenchWindowAdvisor#createWindowContents(Shell shell) method. But this is not the Eclipse way. If you use the WorkbenchWindowAdvisor to change the look&feel of your application you’ll get a fixed coupling between the application code and the presentation code. So wouldn’t it be great to have these separated, ie. in different bundles?

Another issue that comes with RAP applications is the branding. You can define different servlets, which are coupled with a theme and an entrypoint. But there is no opportunity to couple a servlet with Presentation.

So, I wrote an extended Presentation API for RAP, which covers the things mentioned above. The API is still in prototype, but I hope we can release it in RAP 1.2. (Maybe this is interesting for RCP, too?)

I also implemented a demo using the new API which you can see in the screenshot below. I’m the first to admit that it doesn’t look really nice yet but it does show you the possibilities for the new API. The whole presentation is implemented in a separate bundle and just coupled with the application using the servlet.

If you have comments or ideas for additional components , please email me or feel free to comment on this post.