http://www.richclient2.eu/2007_04_16/customizing-the-ui-in-small-rcp-projects/

The presentation framework provided by Eclipse gives you the possibility to customize the UI and the behavior of graphical elements. A good example for UI-customization is the Lotus Nodes Client “Hannover”. But what do you do If you don’t have the budget, time or the skill set to implement such an excessive UI-customization like the guys from “Hannover”? Especially for small RCP applications with a handful views and the wish that your product should not look like a “typical Eclipse Client” it is probably better to use alternative possibilities to create an individual looking RCP. The following article will give an example how to customize your UI easily without using any special framework or extension-point.

Product branding with Eclipse RCP

Since it is possible to build RCP applications with Eclipse, the possibilities to give your application a more personal touch through the PDE have also increased. Typical elements are for example splash-screens, program-icons or welcome-screens. But in the most cases that is not enough. The customer often has a corporate identity with logos, special colors, fonts,etc. which must be also integrated within the application.

Step 1: Implementing a banner with integrated Toolbar

An often required UI-element is a banner on top of your views with a company logo or the name of your product and a toolbar where the key features of the application are accessible. This is possible if your overwrite the method WorkbenchWindowAdvisor#createWindowContents(Shell shell). Eclipse layouts and creates typical elements of your workbench like the Coolbar, MenuBar and the Statusline. If you overwrite this method you have the freedom to arrange the content of your window but you also have to care for the correct initialization of all UI-elements needed. This step is very effective and your application looks much more personalized (see picture).


Part of the banner with a two-buttons toolbar

Step 2: Implement your own Viewpart-Title Area

The most characteristic element to indicate a “typical Eclipse application” is the look of a viewpart with the curved title and the appended action bar.
With the form enhancements in Eclipse 3.3M5 and the features with custom titles a new and interesting possibility is provided to use this feature also as title in your viewparts. You just have to add the views as standalone views to your perspective layout and implement the title in your viewpart. With the ability to customize the colors (see org.eclipse.ui.forms.FormColors) you can show up views that nobody would associate with a “typical Eclipse application” (see Image).


Viewparts with Form-Headings and Actionbar (on the right: with Subheader)

Step 3: Move your Progress Indicator

This is an optional step, depending on your requirements. In nearly every application you have jobs for background-processes where you need a progress indicator to give the user a feedback about the job-status. The default-location of the progress indicator is on the bottom of your application window outside the page contents. It doesn’t make sense in small applications, that this little, but important widget needs the whole bottom of your workbench-window, especially if you don’t have a status-bar. So why not place the progress-bar somewhere else, e.g. in a viewpart?- In spite of the “Discouraged Access Warning” you can implement the org.eclipse.ui.internal.progress.ProgressRegion wherever you want (see picture).


Progress Region in a viewpart

Example

I have implemented a small RCP application, which uses the mentioned UI-customizations (see picture). Check it out (or download) to see, how easyily an individual UI can be implemented. But remember: The discussed issues can be realized only for a special type of RCPs. If you have to customize your “Next generation IDE” with 100 views and editors, please use the presentation framework.


The example application

Conclusion

There are many ways to customize your Eclipse RCP Application. Based on the special requirements of your personal application you have to choose the best toolkit to reach your goal.
Maybe you also have a simple way to customize your RCP product. Let me know.

Downloads

Download the UI Customization Example as RCP (Source included - 11 Mbyte)
CVS-Checkout (more info)

2 Comments »

  1. Note that overriding the WorkbenchWindowAdvisor#createWindowContents(Shell shell) method has some disadvantages, as discussed in this bug[1].

    [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=73821

    Comment by Kris — 16. April 2007 @ 17:13

  2. And overriding the WorkbenchWindowAdvisor#createWindowContents(Shell shell) does not allow to use “Welcome” view because your banner will be always on top. In this case you should to hide banner manually because eclipse api hides only coolbar.

    Comment by MByte — 17. April 2007 @ 08:37