Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 5028f77294e..716d1ef8070 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 202cd8322c7..170f04ea5bf 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);
}

Back to the top