Bug 413096 - 3.6.2 RCP application does not run correctly on 4.3
(workbench window is launching)
Part 1 of a fix. Honour the openWindows() returns false.
Change-Id: I6c38f6b1d8d48f684ea5e51e5b11cb9cf021dede
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index b0c47c7..f3a0b83 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -606,12 +606,16 @@
}
// run the legacy workbench once
returnCode[0] = workbench.runUI();
- // run the e4 event loop and instantiate ... well, stuff
- e4Workbench.createAndRunUI(e4Workbench.getApplication());
- WorkbenchMenuService wms = (WorkbenchMenuService) e4Workbench.getContext().get(
- IMenuService.class);
- wms.dispose();
- e4app.saveModel();
+ if (returnCode[0] == PlatformUI.RETURN_OK) {
+ // run the e4 event loop and instantiate ... well, stuff
+ e4Workbench.createAndRunUI(e4Workbench.getApplication());
+ WorkbenchMenuService wms = (WorkbenchMenuService) e4Workbench.getContext()
+ .get(IMenuService.class);
+ wms.dispose();
+ }
+ if (returnCode[0] != PlatformUI.RETURN_UNSTARTABLE) {
+ e4app.saveModel();
+ }
e4Workbench.close();
returnCode[0] = workbench.returnCode;
}
@@ -1599,8 +1603,8 @@
// TODO compat: open the windows here/instantiate the model
// TODO compat: instantiate the WW around the model
initializationDone = true;
- // if (isClosing() || !advisor.openWindows()) {
- if (isClosing()) {
+ if (isClosing() || !advisor.openWindows()) {
+ // if (isClosing()) {
bail[0] = true;
}
@@ -2777,6 +2781,9 @@
// runEventLoop(handler, display);
}
returnCode = PlatformUI.RETURN_OK;
+ if (!initOK[0]) {
+ returnCode = PlatformUI.RETURN_UNSTARTABLE;
+ }
} catch (final Exception e) {
if (!display.isDisposed()) {
handler.handleException(e);