java - Eclipse RCP 4.x - Defining workspace location -


i know question asked many times, didn't find exact answer fulfill desires :)

long story short: i've got simple e4 application, product project, feature , main plugin simple trim window.

works, after exporting works too.

now. add lifecycleuri property, create bundleclass , create simple dialog text area , button. run it\export , works, before running main trim window dialog shown. fine.. cool etc.

but want enter location eg. c:\test , after clicking button want workspace area application (with .metedata , on). how ???

of course i've tried :

location instancelocation = platform.getinstancelocation(); instancelocation.set(new url("file", null, "c:\test"), false); 

but... says can't change location cause set... tried use above in activator. same. tried add -data @nodefault in products launching arguments ... same...

i try accomplish tasks myself this.... this... ehh... ?

you should able in @postcontextcreate method of life cycle class. don't specify '-data' argument

@postcontextcreate public void postcontextcreate() {      location instanceloc = platform.getinstancelocation();    // stop if location set   if (instanceloc.isset())     return;    file file = new file("c:\\test");    instancelocation.set(file.tourl(), false); } 

note: need '\\' in file path.

this adapted code use in e4 rcp.

if testing application within eclipse need clear workspace location in 'run configuration' application. open 'run > run configurations', find application , clear 'location' field on 'main' tab.


Comments