Project: Eclipse_Platform_UI
Bug 371087 [EAP] No way to store UI-State like in 3.x with IMemento
Reported: 2012-02-09 09:31:33 | Status: resolved fixed

The current EAP does not allow to persist the state in a way RCP 3.x allowed save the state by implementing IViewPart#saveState(). In EAP we only have @PreDestroy as a lifecycle which is not good because at this moment e.g. SWT-Widgets are already disposed and saving their state in ApplicationElement.persistedState is not possible any more. My suggestion would be to: a) add @PersistState annotation to ui.di b) call it in the ContributedPart renderer in disposeWidget Please not this make it work a bit different than in 3.x where the saveState was called on Workbench shutdown only which always bugged me there already.

Files changed in fix:
bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/PersistState.java bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/SampleView.java