«« Content Type Support Saves Me Time Rideau Canal Footbridge »»
blog header image
My Experience Moving RCP Apps from 3.0 to 3.1

Durham has two proof-of-concept Rich Client Platform (RCP) applications to demonstrate its metadata support (AudioMan and Quick Editor). While using the Eclipse 3.1 milestones, I was still building/packaging/running these RCP applications from Eclipse 3.0.x plugins because they were more stable as a platform.

Now that Eclipse 3.1 is out, I want to move these RCP applications to RCP 3.1 plugins. There were a few new things and issues that I'll share here.

1. A lot of Eclipse 3.1 plugins are now distributed as completely contained JAR files. This makes them much easier to move around. Their internal structure has changed a bit: it's not just the old plugin directory structure JAR'd up (note: a JAR file uses the same compression as ZIP). There's no JAR-within-a-JAR. What if you wanted to extract the JAR back to a directory and make a slight modification, would that be possible? With the new structure it seems unlikely that it would work but I'm not sure. An upside is that these plugin JARs are harder to "corrupt" accidentally.

2. There's a new plugin in the RCP redistributable: org.eclipse.rcp. Right now there are no Java class files or extension points in this plugin, which leads me to suspect it's a placeholder. The only file of interest is about.ini, which contains some text for the About dialog in Help referring to the RCP platform.

3. One of the main RCP classes, WorkbenchAdvisor, has been split up in 3.1. The easiest way to see how this differs from 3.0 is to create a new Plug-in Project, select the Yes radio button for Rich Client Application and use the RCP application with a view template.

You'll notice ApplicationWorkbenchAdvisor uses two new classes ApplicationWorkbenchWindowAdvisor and ApplicationActionBarAdvisor. The WorkbenchWindowAdvisor handles the window-specific aspects of the workbench, like it's initial attributes and code to be run before and after it opens and closes. The ActionBarAdvisor handles action-related stuff formerly covered by methods like WorkbenchAdvisor.fillActionBars(). You'll notice that many WorkbenchAdvisor methods are now deprecated because of these changes, which doesn't leave much for the original WorkbenchAdvisor class to do.

4. The last problem I'm tackling is a major one: I can't get my RCP application to run with the 3.1. It seems like core.runtime isn't picking up the application id.

If I set the proper eclipse.product in config.ini I get the following error message:

!ENTRY org.eclipse.core.runtime 2005-07-11 04:37:50.440
!MESSAGE Product net.sf.durham.quickeditor.product could not be found.

!ENTRY org.eclipse.osgi 2005-07-11 04:37:50.480
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
{stack trace}

If I set the proper eclipse.application in config.ini I get the following error message:

!ENTRY org.eclipse.osgi 2005-07-11 04:48:07.36
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "net.sf.durham.quickeditor.ui.QuickEditor" could not be found in the registry. The applications available are: <NONE>.
{stack trace}

Looking at how Eclipse 3.1 itself defines its application, I can't see where I'm going wrong. I haven't changed the product or application extension points at all and they worked just fine with 3.0.

I had to make a slight change in my config.ini file because I switched to using OSGi MANIFEST.MF files:

osgi.bundles=org.eclipse.core.runtime@2:start,
org.eclipse.update.configurator@3:start

I also replaced eclipse.exe and startup.jar with 3.1 versions but otherwise everything is the same. The fact that one of the above error messages says "The applications available are: <NONE>" makes me wonder if there may be a bug with core.runtime but I've probably just made a boneheaded mistake and missed something.

It's so frustrating to run into problems like this but I'll keep bashing on it.

Update 9:21 PM: I overlooked the Eclipse 3.1 Plug-in Migration Guide. Maybe it will help.

Tuesday 6:45 AM: Yep, boneheaded mistake. Remember that change to config.ini I mentioned above? See how it's split between two lines? Yeah, that's bad. I'm not sure why I split it like that but I think it's because when I looked at Eclipse's original config.ini file in Wordpad it was in a small window and as a result the line wrapped. D'oh!

Does config.ini need a validator of some sort? I realise now that when I wrapped that line above I violated the whole

[name]=[value]

pattern that an ini file follows. Eclipse could have told me about it in an editor and saved me some time chasing my tail. Isn't there already a property file editor for Eclipse? (I could be thinking of WTP). If so, why isn't it associated with ini files by default?

Also, I could have been given a better error message in the configuration log file when the application failed to start. Seems like having org.eclipse.update.configurator@3:start for osgi.bundles in config.ini is very important for 3.1, yet I had no idea and the error log certainly didn't help. That information could also be added to the 3.1 Plug-in Migration Guide FAQ.

At any rate my RCP apps work now so I'm happy as a clam.

Posted at July 11, 2005 at 04:12 AM EST
Last updated July 11, 2005 at 04:12 AM EST
Comments

Hi Ryan,
I faced the same problem, few weeks ago and i figth one day long to made my rcp move from eclipse 3.1 RC5 to 3.1 final.(not a big step altougth)
Well, i finally succeed but i try so much things that i do not remember which one was the key!
I think that the pb comes from the change of packaging plugin in one jar or the old way.
In fact if you have third party jar your plugin will be exported in a directory, if not PDE will made a jar of your stuff.
Anyway i will try to give you some hints:
- add all the necessary 3rd party jar in your plugin.xml (runtime tabs->classpath part of the form). This are runtime jars , can be the sames as build jars listed in build tab, bur must but specified here also.
-be sure that in product editor second tab all your plugin dependency are listed.

Hope it help
Mathias

» Posted by: Mathias Muller at July 11, 2005 05:19 PM

I should mention that both RCP apps run just fine in Eclipse 3.1. It's when I try to run them as "standalone" apps that they don't work.

» Posted by: Ryan at July 11, 2005 07:08 PM

I should also mention that I'm not "exporting" my RCP app from Eclipse -- I'm building the product myself with Ant scripts. This worked with 3.0.

I will try exporting the RCP app from Eclipse 3.1 to see if that works.

» Posted by: Ryan at July 11, 2005 07:55 PM
Google
 
Search scope: Web ryanlowe.ca