Persisting the current perspective state of an RCP

If you're developing on Eclipse RCP applications it may be interesting to save the perspective layout and open views of the user s.t. when he launches the application the next time, everything looks as before. That may sound difficult but actually it is really simple.
In your ApplicationWorkbenchAdvisor.java, in the initialize(IWorkbenchConfigurer) just write the following:

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
...

@Override
public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);
configurer.setSaveAndRestore(true);
...
}

...
}
This should work fine. In case it doesn't, try to get the WorkbenchConfigurer by calling the method getWorkbenchConfigurer() and invoke the setSaveAndRestore(...) on that.
Kindle

Comments

0

Your ad here?