Bug 341118 [Compatibility] IWindowListeners are not notified of window activations
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 19e244a..7ad5ba4 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
@@ -338,8 +338,6 @@
 	private Display display;
 
 
-	private WorkbenchWindow activatedWindow;
-
 	private EditorHistory editorHistory;
 
 	private boolean runEventLoop = true;
@@ -887,11 +885,6 @@
 	 *            The window which just closed; should not be <code>null</code>.
 	 */
 	protected void fireWindowClosed(final IWorkbenchWindow window) {
-		if (activatedWindow == window) {
-			// Do not hang onto it so it can be GC'ed
-			activatedWindow = null;
-		}
-
 		Object list[] = getListeners();
 		for (int i = 0; i < list.length; i++) {
 			final IWindowListener l = (IWindowListener) list[i];
@@ -2652,16 +2645,6 @@
 		return WorkbenchPlugin.getDefault().getDecoratorManager();
 	}
 
-
-	/*
-	 * Sets the workbench window which was last known being the active one, or
-	 * <code> null </code> .
-	 */
-	/* package */
-	void setActivatedWindow(WorkbenchWindow window) {
-		activatedWindow = window;
-	}
-
 	/**
 	 * Returns the unique object that applications use to configure the
 	 * workbench.
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index 04af313..f8a83a6 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -116,7 +116,6 @@
 import org.eclipse.ui.ISources;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchPartReference;
 import org.eclipse.ui.IWorkbenchPreferenceConstants;
 import org.eclipse.ui.IWorkbenchWindow;
@@ -549,6 +548,8 @@
 				windowWidgetHandler);
 
 		partService.setPage(page);
+
+		trackShellActivation();
 	}
 
 	private void removeTrimContributions() {
@@ -1703,26 +1704,14 @@
 
 	/**
 	 * Hooks a listener to track the activation and deactivation of the window's
-	 * shell. Notifies the active part and editor of the change
+	 * shell.
 	 */
-	void trackShellActivation(Shell shell) {
+	private void trackShellActivation() {
 		getShell().addShellListener(new ShellAdapter() {
 			public void shellActivated(ShellEvent event) {
 				shellActivated = true;
 				serviceLocator.activate();
-				getWorkbenchImpl().setActivatedWindow(WorkbenchWindow.this);
-				WorkbenchPage currentPage = (WorkbenchPage) getActivePage();
-				if (currentPage != null) {
-					IWorkbenchPart part = currentPage.getActivePart();
-					if (part != null) {
-						// PartSite site = (PartSite) part.getSite();
-						// site.getPane().shellActivated();
-					}
-					IEditorPart editor = currentPage.getActiveEditor();
-					if (editor != null) {
-						// PartSite site = (PartSite) editor.getSite();
-						// site.getPane().shellActivated();
-					}
+				if (getActivePage() != null) {
 					getWorkbenchImpl().fireWindowActivated(WorkbenchWindow.this);
 				}
 				liftRestrictions();
@@ -1732,18 +1721,7 @@
 				shellActivated = false;
 				imposeRestrictions();
 				serviceLocator.deactivate();
-				WorkbenchPage currentPage = (WorkbenchPage) getActivePage();
-				if (currentPage != null) {
-					IWorkbenchPart part = currentPage.getActivePart();
-					if (part != null) {
-						// PartSite site = (PartSite) part.getSite();
-						// site.getPane().shellDeactivated();
-					}
-					IEditorPart editor = currentPage.getActiveEditor();
-					if (editor != null) {
-						// PartSite site = (PartSite) editor.getSite();
-						// site.getPane().shellDeactivated();
-					}
+				if (getActivePage() != null) {
 					getWorkbenchImpl().fireWindowDeactivated(WorkbenchWindow.this);
 				}
 			}