Friday, May 7, 2010

Default Eclipse Workspace via config.ini

By default, the workspace of an RCP app is somewhere inside the install location, and might actually differ for Linux, Windows, OS X or different Eclipse releases.
I needed a location in the user home directory, independent from the OS, and not affected by updates (including complete replacement) of my RCP application.
The solution is adding something like this to the RCP's config.ini:

# Set default workspace location
osgi.instance.area.default=@user.home/MyRCPAppWorkspace

In the *.product file editor, the Configuration section allows you to specify a custom config.ini to accomplish this, but that brought up another problem: The original content of the config.ini beyond my workspace location settings, entries like osgi.framework=file\:plugins/org.eclipse.osgi_3.5.2.R35x_v20100126.jar, changes with Eclipse releases, so you have to continually update your custom config.ini?

Solution with P2: Use the auto-generated config.ini, and instruct P2 to add your custom content by adding a file p2.inf to your product with the following content:

# Add the following to the generated config.ini
instructions.install = \
setProgramProperty(propName:osgi.instance.area.default,propValue:@user.home/MyRCPAppWorkspace);

No comments:

Post a Comment