Thursday, August 27, 2009

How do you read resources within a plugin ?

There are some txt, xml, image files in your plugin. You want to load them and read them within your application. How do you do that?

Dont fret... And dont go to the extent of using java.util.jar package.
Eclipse framework provides you a very clean mechanism to do the same

Use org.eclipse.core.runtime.FileLocator apis to load the required resources within your plugin. Code snippets are easily available.

What eclipse does internally in this case is: It unzips the specified resources in /configuration/. From within this location the resources are now read as regular files from file system.

Code for a platform and build it for multiple platforms

We create our Eclipse RCP application in Windows. We can then build it to be installed on multiple platforms including Linux, Mac OS.
Isnt this great...

Code it in the platform you are comfortable it. Trust Eclipse to build your executable for multiple other platforms...

Steps involved in making use of this feature:

We need Eclipse Delta pack to be installed on top of Regular Eclipse RCP
Below links are for the latest release of Eclipse 3.5 Galileo:

http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-rcp-galileo-win32.zip

http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.5-200906111540/eclipse-3.5-delta-pack.zip

We can use use wizard approach to build for multiple platforms. Another way the same can be achieved is through PDE Headless build. The Headless build will be most required when the task needs to be automated to run regularly as it happens for any software project.

A good reference for both of the above approaches...
http://www.vogella.de/articles/EclipsePDEBuild/article.html

Few points to be remembered:
Eclipse delta pack is imperative for headless build and building for multiple platforms

For including files in the root/sub folder of the executable, it will be easier accomplished if we create a feature for the product.
Follow the steps in
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/tasks/pde_rootfiles.htm

Sunday, August 23, 2009

Eclipse RCP... It is cool

Getting a feel of Eclipse RCP... Learnt few interesting things about the same.

Detailed posts will follow....