aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Elder2013-07-17 08:52:52 (EDT)
committerGerrit Code Review @ Eclipse.org2013-07-18 03:17:14 (EDT)
commitb9759603472fa79e196346ff68ad96a48c71567d (patch)
tree73c5320d8183fb03fdede817ae9edb61c43e1062
parentd1cca9237e6500daf70829dc0089d3a9bc2cab61 (diff)
downloadeclipse.platform.ui-b9759603472fa79e196346ff68ad96a48c71567d.zip
eclipse.platform.ui-b9759603472fa79e196346ff68ad96a48c71567d.tar.gz
eclipse.platform.ui-b9759603472fa79e196346ff68ad96a48c71567d.tar.bz2
Bug 408927: [debug view] global toolbar vanishes after restartrefs/changes/14/14614/2
Ensure that IPartListener/IPartListener2.partDeactivated() is called for the active part during workbench shutdown. Change-Id: Ia633a770d1a894f25df895e59424f200fd1168ea
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java4
2 files changed, 18 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
index 5028f77..716d1ef 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
@@ -5299,4 +5299,20 @@ public class WorkbenchPage extends CompatibleWorkbenchPage implements
ICoolBarManager2 mgr = (ICoolBarManager2) legacyWindow.getCoolBarManager2();
mgr.resetItemOrder();
}
+
+ /**
+ * Call {@link #firePartDeactivated(MPart)} if the passed part is the
+ * currently active part according to the part service. This method should
+ * only be called in the case of workbench shutdown, where E4 does not fire
+ * deactivate listeners on the active part.
+ *
+ * @param part
+ */
+ public void firePartDeactivatedIfActive(MPart part) {
+ if (partService.getActivePart() == part) {
+ // At shutdown, e4 doesn't fire part deactivated on the active
+ // part.
+ firePartDeactivated(part);
+ }
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java
index 202cd83..170f04e 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/CompatibilityPart.java
@@ -11,8 +11,6 @@
package org.eclipse.ui.internal.e4.compatibility;
-import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
-
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
@@ -28,6 +26,7 @@ import org.eclipse.e4.ui.model.application.ui.MDirtyable;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
@@ -97,6 +96,7 @@ public abstract class CompatibilityPart implements ISelectionChangedListener {
beingDisposed = true;
WorkbenchPartReference reference = getReference();
// notify the workbench we're being closed
+ ((WorkbenchPage) reference.getPage()).firePartDeactivatedIfActive(part);
((WorkbenchPage) reference.getPage()).firePartHidden(part);
((WorkbenchPage) reference.getPage()).firePartClosed(CompatibilityPart.this);
}