Bug 465937 - @PreSave not called on lifecycle handler when using
compatibility mode
Change-Id: Ia9d4ce1115e6cd41c6cff17b2cc47c1bc411bb8b
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
index 82b07cd..79a5a5f 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
@@ -160,10 +160,6 @@
// Create and run the UI (if any)
workbench.createAndRunUI(workbench.getApplication());
- // Save the model into the targetURI
- if (lcManager != null) {
- ContextInjectionFactory.invoke(lcManager, PreSave.class, workbenchContext, null);
- }
saveModel();
workbench.close();
@@ -181,6 +177,11 @@
}
public void saveModel() {
+ // Save the model into the targetURI
+ if (lcManager != null && workbench != null) {
+ ContextInjectionFactory.invoke(lcManager, PreSave.class, workbench.getContext(), null);
+ }
+
try {
if (!(handler instanceof ResourceHandler) || ((ResourceHandler) handler).hasTopLevelWindows()) {
handler.save();