Bug 371707 - Hook into saving of workbench state to perform additional tasks (e.g. storing state in remote database)
Summary: Hook into saving of workbench state to perform additional tasks (e.g. storing...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-16 03:00 EST by Timo Rohrberg CLA
Modified: 2013-01-25 04:41 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timo Rohrberg CLA 2012-02-16 03:00:41 EST
Build Identifier: M20110909-1335

Eclipse provides an automatic way to save the workbench state, e.g. size and position of views, editors, etc. This feature is activated by returning "true" in the IWorkbenchConfigurer.setSaveAndRestore() method. Within the Workbench its state is recored in the private recordWorkbenchState() method and then written to a workbench.xml file within the busyClose() method.

Since we have a Client/Server application, we would like to hook into this saving procedure to transfer the recorded workbench state into a remote database. Our idea is to provide a hook, listener, or similar to achieve this. After the call of recordWorkbenchSate() all information is available and could be transferred anywhere else before or after saveMementoToFile() is called.

Do you have any ideas or is there any other provided way to achieve that goal?

Reproducible: Always

Steps to Reproduce:
1. Run any Eclipse RCP application with IWorkbenchConfigurer.setSaveAndRestore() set to true.
2. Configure user interface (e.g. open views, change their size, etc.)
3. Close Eclipse RCP application.
4. State will automatically be saved into workbench.xml.
5. Try to hook that saving procedure to also save state somewhere else, e.g. remote database.
Comment 1 Paul Webster CLA 2012-02-16 07:15:52 EST
In 3.x the workbench.xml is an internal implementation detail.  It doesn't exist in 4.2, for example.

But if you did want to save it, probably org.eclipse.ui.IWorkbenchListener.postShutdown(IWorkbench) would be the best place, because by then it would be written out.  Also it is read during creating the first workbench.  You might be able to replace it in org.eclipse.ui.application.WorkbenchAdvisor.preStartup() though.

In 4.x, workbench.xml has been replaced by the model.  I know that people working with the CDO project have managed to save the model to a server and reload it.

PW