Monday, July 30, 2007

Eclipse RCP

I recently decided to upgrade my skill set and add Eclipse RCP to my list of things I almost know how to do. I purchased a book on the subject and gave it a whirl.

The book exhorts you to have two environments; one for you development environment and one for your deployment environment. I already had the Eclipse JAVA development environment at 3.3 so I downloaded RCP and installed it into a new directory. After this, you must go into window-preference then expand Plug-in Development->Target Platform to set your target platform to the RCP install location. I found I had to reselect all the Plug-ins it found in the RCP install location.

Next you create your project and the plug-in. The book left out the important step of configuring the environment the first time you use the RCP installation target. This is ignored in most tutorials (or is new in 3.3) due to the fact that the writers already have their environment set properly at the time the tutorial was developed.

The first thing that bit me was that there are subtle changes in the 3.1 to 3.3 versions of RCP. When you create your first plug-in, you'll find that IApplication no longer has a run() method. These have now been switched to start() and stop(). This, of course, blows the code compare function given by the book since the code base for 3.3 is different from 3.1. I grit my teeth and plow ahead.

Your first tutorial doesn't do much but pop up a screen. When you generate the plugin you get the following java files: Application, ApplicationActionBarAdvisor, ApplicationWorkbenchAdvisor, ApplicationWorkbenchWindowAdvisor, and Perspective. is called at startup. Think of it as your entry point into the plug-in. is where you create any views or editors you want the users to see when the plug-in is first invoked. handles the GUI event loop. It has the following methods that can be overridden.
  • initialize() - called first to do such things as parse the command link, register adapters, and declare images
  • preStartup() - called after initialize but before the first window is opened.
ApplicationWorkbenchWindowAdvisor handles the windows customization like titles, placement and size.

ApplicationActionBarAdvisor creates and customizes information in the menu bar, cool bar (called tool bar most places) and the status line.

I've finished my first tutorial now and and off to the second. I'll post my problems and solutions here as I run into them

It had issues as well but I was able, in the end, to get it working in 3.3. This is the first tutorial. It has links to two others.

Good Luck (you'll need it)