Eclipse RCP – exporting for multiple platforms

In case you want to deploy a feature based RCP for more than one platform (with the delta pack): Do not forget to add the org.eclipse.rcp feature either as included feature to one of your features or add it directly to your product configuration. The org.eclipse.rcp feature includes all the platform dependent plug-ins and fragments (like SWT win32). So in case your export doesn't contain the platform dependent files (and fails to launch) verify that this feature is added…

Even if you do deploy to one platform only but do have a feature based RCP you have to add the org.eclipse.rcp feature. Otherwise you have to add all required platform dependent fragments yourself.

Eclipse JCrypTool

Using Eclipse SWT.SEARCH

After reading Prakash G.R. great blog posts (here and here) about the Eclipse search field I have submitted some updates to the algorithm search in JCrypTool. And noticed some additional things which are in my eyes quite important when using SWT.SEARCH.

What happens in JCrypTool when using the algorithm search is that the Algorithm view gets updated in real time, so the search works as a filter. When clicking the x icon the filter should be set to empty, and the view must display all elements again. But the default clear action is to empty only the search field. Fortunately this is as easy to extend as mentioned in Eclipse Javadoc:

Text search = new Text(parent, SWT.SEARCH | SWT.CANCEL);
search.addSelectionListener(new SelectionAdapter() {
 public void widgetDefaultSelected(SelectionEvent e) {
  if (e.detail == SWT.CANCEL) {
    // action when clicking on the x icon

You have to use the widgetDefaultSelected method in case you need to do more than just clearing the user input. Remember that the SWT.CANCEL check is only possible when using SWT.SEARCH | SWT.CANCEL as options for the text field.

The really sad thing is (at least for Windows users), such a stylish text field is only available on Mac, but not on Windows (at least Windows XP does not support it). Since I am a happy Mac user I have no idea about Linux. At least the search text field is shown as a normal text field when it comes to Windows (better than being invisible or unusable at all). So it is necessary to provide an additional clear icon when the operating system does not support the clear action inside the text field. Simply implement the following check after creating the search text field:

if ((search.getStyle() && SWT.CANCEL) == 0) { }

Put all actions and GUI elements for antiquated operating systems in this block and you are done. Since the return code on Mac is different this part won't be executed on Mac systems and therefore only the stylish text field is visible.

Update, 2009-07-19:
With Eclipse 3.5 you should initialize the search text field in this way:

Text search = new Text(parent, SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH);

On Mac this offers an additional search icon in the text field. The Eclipse 3.5 M6 News contain the information, that this style is now available on all platforms. I wasn't able to confirm this with JCrypTool, the only supported platform I'm aware of is the Mac.


Eclipse help and the dynamic help view

Writing help files for an Eclipse RCP is easy. Help content is simply provided as normal html files. And of course it is possible to format the html code using css. The problem now is, that help view and help browser use the same css, but the view is of course much smaller.

To solve this you need to provide a plugin_customization.ini (defined as a product property in your plugin.xml). Provide at least two parameters for your help files here:

topic_css is used for normal help pages, narrow_css only for the help view or help tray.

There are two more parameters available, see the Product customization help page for more information about them.

Another benefit is that all your help pages will look the same. Simply do not integrate any other css style (or make sure you do not overwrite the injected styles) and wait for the help runtime to inject the matching css styles.


Integrating help in an Eclipse Rich Client Platform

Integrating help into an Eclipse RCP does not require a lot of work. Simply use the ActionFactory to add the help menu item to an existing menu in your ApplicationActionBarAdvisor class:

IWorkbenchAction helpAction = ActionFactory.HELP_CONTENTS.create(window); // in makeActions(IWorkbenchWindow window)
register(helpAction); // registration is required
menu.add(helpContentAction); // add it to the desired menu

And voilà, the help menu entry is visible. Click on it, and nothing happens… The reason is easy to guess, the Eclipse help plug-ins are missing. Since the help system changed quite a lot with Eclipse 3.3, the list of required plug-ins differs between the different Eclipse versions. So the following applies to Eclipse 3.4 only.

Some of the required plug-ins are easy to guess:

Doing a dependency check on those (with the Validate Plug-ins button in the run configuration) brings up quite a long list, which really blows up your RCPs’ size. OK, some of them are required by the RCP anyway. While some of the required plug-ins are obvious, others are not:

In case you do have a plug-in based product configuration you can simply add the required plug-ins. In this case make sure that the checkbox for the optional plug-ins is selected before clicking the Add required plug-ins button. Or use your run menu entry to add the required plug-ins for you.

Before launching your RCP again make sure that at least one of your plug-ins does provide some help content. Otherwise the help system will show up empty.

Now that we do have a working help system, let’s open some help pages directly. This may be necessary in an Eclipse Form based editor (like the Plug-in Manifest Editor) where a help icon in the upper right directly accesses the help system.

Simply create a command with a contribution item (or an action if you like the old style) and place the following code in the run method:


de.xmlsicherheit.sample is the plug-in id as defined in the manifest. Do not forget the leading slash! Now a click on the button, icon or whatever you decide to use will open the help system and directly jump to the desired page. The table of contents should expand itself automatically.

That’s it. As you can see, providing help inside a rich client is easy, once you do know which plug-ins are required.

Eclipse Java XML Security Tools

Eye on EclipseCon 2009

EclipseCon 2009 is over, and it has been great! A lot of things to learn, and even more people to meet. This was my first EclipseCon, and it couldn't have been any better!

Monday started with some great tutorials: Building Commercial-Quality Eclipse Plug-ins in the morning and Advanced Eclipse Rich Client Platform in the afternoon. I'm developing Eclipse plug-ins for about five years now, but still discovered some new stuff (and got some ideas about getting P2 working). Since JCrypTool didn't make it to the open source RCP finals, there was no tension for me while attending the Eclipse Community Awards (Apache Directory Studio totally deserved the first place). The PowerPoint karaoke was a lot of fun!

The following days always contained a good mixture of interesting sessions, from e4 over PDE to the Web Tools Platform and various other talks (I'm not going into detail here). And of course some excellent keynotes, of which I enjoyed The Darwin among the IDEs on Thursday the most. Hopefully we will see some of the ideas announced here in the future. Although I have to admit that I am not a fan of developing everything in the browser. The moment one tab crashes all your browser data is gone. Maybe this will change as well as soon as all tabs are using their own processes. But how will two or more browser instances, each with 250 MB, 500 MB or even more memory usage (remember, we are talking about a complete IDE in the browser), affect the system or even work?

Our Web Tools Platform Incubator session took place on Wednesday at 10:10 am. We ended up in the Grand Ballroom B. 31 people attended (thanks to RFID tracking (hopefully not my passport)). I expected some more, but OK, two brand new incubator projects, the community has still to grow around them. The slides from my session Incubating XML Security Tools are available for download on my home page and of course at gPublication (the conversion killed some of the slides, so better use the one on my home page).

As the statistics show, a little more than 1000 people attended EclipseCon this year. I met the people I intended to meet, and many, many more. And I collected some interesting ideas for XML Security Tools enhancements, which I will look at in detail in the next weeks. So stay tuned.

XML Security Tools

Yet another XML Security Tools build

A new XML Security Tools build (I20090315175418) is available for download: This version contains a lot of changes and several bug fixes: Signature/ Encryption is now possible over selections or XPath expressions again (there has been a nasty bug which resulted into a WRONG_DOCUMENT_ERR). All quick functionality is working, including the support for the latest keystore extensions that have been added to XML Security Tools a little while ago.

And the integration into the rest of the Web Tools Platform was extended. XML Security is no longer a separate category in the preferences: it is now a child entry in the XML category. The same happened to the XML Signatures view, which is now a child entry in the XML category.

XML Security Tools

New XML Security Tools build available

A new XML Security Tools version (I20090307153956) is available for download. This version contains a lot of bugfixes and enhancements:

XML Signatures view is fully sortable.
XML Encryption wizard is much easier to use and provides more user feedback (error and information messages). The keys are now stored password protected in a standard Java KeyStore. Old keys will not be usable any more (sorry, but I had to break with it some time).
Cheat Sheets for verification, encryption and decryption were updated.
– And of course a lot (really a lot) of clean up work and code improvements under the covers.

This is not yet an official release. We will set up a release plan during EclipseCon, so please be patient a little more…


Eclipse XML Development Tools

Dave Carver has published a, yet inofficial, XML Development Tools Proposal for Eclipse. I think this is a great idea. Not only because it affects the XML Security Tools I'm working on. The Web Tools Platform is great, but personally I think its scope is too diversified. Developing Web and Java EE applications is different, and XML is not necessarily used for web development (only). Surely the XML Development Tools and the Web Tools Platform would work closely together (as do most (if not all) Eclipse projects). But two projects make it easier for new users to find and install only the plug-ins they need to get their job done.

From all I have heard the last days (there was an interesting discussion on the WTP Incubator Dev mailing list) this new project would take a while, but it definitively is worth the wait! In the meantime have a look at Daves blog post on the topic or at the proposal mentioned above.


Only one filled column in a JFace TableViewer

I prepared a TableViewer based view for a workshop today. And ran into a really, really nice problem. The TableViewer displayed all rows and columns, but only the first column was filled with data (since it was for demonstration purposes only I used some hardcoded data in an ArrayList). I checked everything, from LabelProvider to ContentProvider and the view itself. Finally I noticed (after a long, long time, it felt like weeks) that I was calling viewer.setInput(myArrayList) before setting the columns with TableColumn column = new TableColumn(…). Changing that solved my problem, all data was visible. I seems that JFace displays a simple list in this case, but sets all column headers and shows no error message at all.


My first look at Eclipse 3.5

There are always so many new cool features in a new Eclipse release. Sometimes those guys develop new features you never thought of, but can't live without them any more. Eclipse 3.5 contains a lot of new cool things. And since I do not check out every new milestone, M5 was the first look I had at Galileo. As a Mac user I just love the new Cocoa support. But even better are the product configuration improvements (see my post a little while ago). It happens almost all the time that someone (OK, me) forgets to update the product configuration after changing a feature version number. Well, updating means to remove the feature and add it again. The next developer who uses the launch link ends up with an empty RCP. But this problem has been solved now. OK, the developer still has to update the version number. But at least the version number is visible and one can update it without removing and adding the feature.