|Setting custom workspace [message #893177]
||Tue, 03 July 2012 06:12
| Alok Mishra
Registered: April 2012
I'm trying to develop an RCP application and want to set my custom workspace programmatically.
I added the following line in the constructor of Activator.java file.
Location instanceLocation = Platform.getInstanceLocation();
instanceLocation.set(new URL("file", null, MyWorkspacePath), false);
But I get the following Exception
java.lang.IllegalStateException: Cannot change the location once it is set.
I know if I add "-data @user.home/my_workspace" to the Program Argument in the Run Configuration the workspace will get changed, but I want to do it programmatically, so that I can change the workspace during runtime.
How can I ask my application to override the default workspace? Adding "-data @noDefault" to Program Argument didn't work; rather it results in "org.osgi.framework.BundleException" Exception, even before calling the constructor of Activator class.
Once I've set my workspace, how can I reset it during runtime?
Any help in this regard will be highly appreciated.
Powered by FUDForum
. Page generated in 0.01907 seconds