Change path Product configuration files [message #463368] |
Fri, 09 February 2007 04:14  |
Eclipse User |
|
|
|
Executing a RCP product, log files, status workbench (workbench.xml) and
several files are saved inside a path generated by
DataArea.getStateLocation(bundleName).
I need to generate this path in a especific path(different path of the
product path) because in executable directory we dont have write
permissions.
How can we change this path of elegant way? Can it be changed in some
configuration file?
This is very important. Thanks for any help.
Angel
|
|
|
|
Re: Change path Product configuration files [message #463437 is a reply to message #463368] |
Mon, 12 February 2007 07:19  |
Eclipse User |
|
|
|
Angel wrote:
> Executing a RCP product, log files, status workbench (workbench.xml) and
> several files are saved inside a path generated by
> DataArea.getStateLocation(bundleName).
[..]
> How can we change this path of elegant way? Can it be changed in some
> configuration file?
The most general solution is to do the following:
1) Add "-data @noDefault" to your program arguments (i.g. in your
launch config and in your .product file on "Launcher" page.
2) Define your IPlatformRunnable in a way that programmatically sets the
workspace location *before* PlatformUI.createAndRunWorkbench() is
invoked (see (3))
3) To realize (2) have a look at IDEApplication.java
(org.eclipse.platform.source) or use something the following:
final Location instanceLoc = Platform.getInstanceLocation();
if (instanceLoc == null) {
.. //handle error
}
final URL userWSURL;
try {
String path = fUserWorkspace.getAbsolutePath().replace(
File.separatorChar, '/');
userWSURL = new URL("file", null, path); //$NON-NLS-1$
} catch (MalformedURLException e) {
.. //handle error
}
if (instanceLoc.isSet()) {
if (!userWSURL.sameFile(instanceLoc.getURL())) {
.. //handle error
}
} else {
if (!fUserWorkspace.exists()) {
if (!fUserWorkspace.mkdirs()) {
.. //handle error
}
}
final boolean doLock = ...; // Set your locking policy
if (!instanceLoc.setURL(userWSURL, doLock) == doLock) {
.. //handle error
}
}
Greetings from Bremen,
Daniel Krügler
|
|
|
Powered by
FUDForum. Page generated in 0.02783 seconds