Save and Restore Workbench State [message #990622] |
Thu, 13 December 2012 08:40  |
Eclipse User |
|
|
|
Hello everybody,
in my RCP 3.x-based Client-/Server-Application, I need to save the workbench state (e.g. open view and editors, window position and size, ...) for the current user and transfer it to the server. There it is persisted until the user returns. Then the workbench state is restored and the user finds the complete application in the state as he/she left it.
Currently, I achieve this by a quite ugly hack: Right after workbench shutdown (WorkbenchAdvisor.postShutdown()), I read the workbench.xml file from the .metadata/.plugins/org.eclipse.ui.workbench folder in the workspace and transfer it to the server. When the user returns, that file is restored within the WorkbenchAdvisor.preStartup() method.
Unfortunately, after switching to the RCP 4 platform, that workbench.xml file does not exist anymore. The workbench state is now stored in the workbench.xmi file in the .metadata/.plugins/org.eclipse.e4.workbench folder.
Of course, I could apply the same approach as I did so far and save/restore that workbench.xmi file. But somehow this seems to be a strange approach to me anyways... With the new model based workbench, I was hoping there is another, more intuitive approach...
Do you have any hints?
Thank you very much
Timo
|
|
|
Re: Save and Restore Workbench State [message #990665 is a reply to message #990622] |
Thu, 13 December 2012 08:46   |
Eclipse User |
|
|
|
Hi,
Yes you can, we demonstrated something similar at EclipseCon NA 2012
where we stored the model in a CDO-Repository.
The model loading and saving is encapsulated in a class you can overrule
when launching by passing -modelResourceHandler bundleclass://....
The class you pass in there has to implement IModelResourceHandler (you
can take a look at the default implementation in
org.eclipse.e4.ui.internal.workbench.ResourceHandler) to see how we are
persisting and creating the model by default.
Tom
Am 13.12.12 14:40, schrieb Timo Rohrberg:
> Hello everybody,
>
> in my RCP 3.x-based Client-/Server-Application, I need to save the
> workbench state (e.g. open view and editors, window position and size,
> ...) for the current user and transfer it to the server. There it is
> persisted until the user returns. Then the workbench state is restored
> and the user finds the complete application in the state as he/she left it.
>
> Currently, I achieve this by a quite ugly hack: Right after workbench
> shutdown (WorkbenchAdvisor.postShutdown()), I read the workbench.xml
> file from the .metadata/.plugins/org.eclipse.ui.workbench folder in the
> workspace and transfer it to the server. When the user returns, that
> file is restored within the WorkbenchAdvisor.preStartup() method.
>
> Unfortunately, after switching to the RCP 4 platform, that workbench.xml
> file does not exist anymore. The workbench state is now stored in the
> workbench.xmi file in the .metadata/.plugins/org.eclipse.e4.workbench
> folder.
>
> Of course, I could apply the same approach as I did so far and
> save/restore that workbench.xmi file. But somehow this seems to be a
> strange approach to me anyways... With the new model based workbench, I
> was hoping there is another, more intuitive approach...
>
> Do you have any hints?
>
> Thank you very much
> Timo
|
|
|
|
Re: Save and Restore Workbench State [message #1420364 is a reply to message #990622] |
Tue, 09 September 2014 18:46  |
Eclipse User |
|
|
|
Would I go about Save and Restoring Workbench State while the application is running (ie I want users to be able to export and import their current workbench settings like layouts and perspectives to a server or database dynamically, without resetting the program state.)
|
|
|
Powered by
FUDForum. Page generated in 0.03489 seconds