Restoring View Positions [message #808014] |
Mon, 27 February 2012 04:45  |
Eclipse User |
|
|
|
Hi,
my RCP application creates and disposes views programmatically. This means that I shut down my views before the workbench performs a shutdown. Restoring the views by the workbench makes no sense to me, because important context information needs to be passed to the view, that the workbench does not know.
My question: If the user drags a view to a specific position, how can I get that position information, store it, and pass this information to the view on the next start of the view, to obtain the same position again?
Could anyone give me a hint, how that could be achieved? Actually the workbench somehow does the same with standard views.
Thanks and regards,
Andreas
|
|
|
|
Re: Restoring View Positions [message #815202 is a reply to message #811346] |
Wed, 07 March 2012 05:55  |
Eclipse User |
|
|
|
Thorsten,
thank you for your prompt reply. Actually your answer and code example pointed me into the right direction. What I did not wrote in my description caused the problem in my application. I pass the view context information by using a secondary view id. This secondary view id was always different from the last time I opened the view. I now found out, that the workbench stores the view position in a file called workbench.xml under the plugin org.eclipse.ui.workbench. Here the view identifier is stored together with the secondary identifier. If they do not match, the view position is assumed unknown and therefore the view is started with default position.
I now changed my secondary identifier handling to be reproducible on opening the view. And it works perfectly.
Thanks again, this gives a usablity boost to my application!
best regards
Andreas
additional remark to others who might read this:
To enable restoring in general you need to overwrite the following method in class ApplicationWorkbenchAdvisor of your RCP application
@Override
public void initialize(IWorkbenchConfigurer configurer) {
super.initialize(configurer);
configurer.setSaveAndRestore(true);
}
|
|
|
Powered by
FUDForum. Page generated in 0.05143 seconds