aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2012-04-24 15:13:47 (EDT)
committerOleg Besedin2012-04-24 15:13:47 (EDT)
commitf30557255255e1338587145d3e4f520d00a9fdf3 (patch)
tree6d17af862d9820ab0a47f74c287a8964c1cce24e
parent78badb9db2c4072b88aa19125170abd531121ab7 (diff)
downloadeclipse.platform.ui-f30557255255e1338587145d3e4f520d00a9fdf3.zip
eclipse.platform.ui-f30557255255e1338587145d3e4f520d00a9fdf3.tar.gz
eclipse.platform.ui-f30557255255e1338587145d3e4f520d00a9fdf3.tar.bz2
Bug 373529 - [Compatibility] IPageListener's pageOpened(*) is sent outv20120424-1913
too early
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java65
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java1
2 files changed, 6 insertions, 60 deletions
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 fec944c..eb0dd8d 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
@@ -115,7 +115,6 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.graphics.DeviceData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
@@ -421,8 +420,6 @@ public final class Workbench extends EventManager implements IWorkbench {
boolean initializationDone = false;
- private WorkbenchWindow activatedWindow;
-
/**
* Creates a new workbench.
*
@@ -936,10 +933,6 @@ public final class Workbench extends EventManager implements IWorkbench {
* 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];
@@ -1209,60 +1202,14 @@ public final class Workbench extends EventManager implements IWorkbench {
return null;
}
- // Look at the current shell and up its parent
- // hierarchy for a workbench window.
- Control shell = display.getActiveShell();
- while (shell != null) {
- Object data = shell.getData();
- if (data instanceof IWorkbenchWindow) {
- return (IWorkbenchWindow) data;
- }
- shell = shell.getParent();
- }
-
- // Look for the window that was last known being
- // the active one
- WorkbenchWindow win = getActivatedWindow();
- if (win != null) {
- return win;
- }
-
- // Look at all the shells and pick the first one
- // that is a workbench window.
- Shell shells[] = display.getShells();
- for (int i = 0; i < shells.length; i++) {
- Object data = shells[i].getData();
- if (data instanceof IWorkbenchWindow) {
- return (IWorkbenchWindow) data;
- }
- }
-
- // Can't find anything!
- return null;
- }
-
- /*
- * Returns the workbench window which was last known being the active one,
- * or <code> null </code> .
- */
- private WorkbenchWindow getActivatedWindow() {
- if (activatedWindow != null) {
- Shell shell = activatedWindow.getShell();
- if (shell != null && !shell.isDisposed()) {
- return activatedWindow;
- }
+ MWindow activeWindow = application.getSelectedElement();
+ if (activeWindow == null && !application.getChildren().isEmpty()) {
+ activeWindow = application.getChildren().get(0);
}
- return null;
- }
-
- /*
- * Sets the workbench window which was last known being the active one, or
- * <code> null </code> .
- */
- /* package */
- void setActivatedWindow(WorkbenchWindow window) {
- activatedWindow = window;
+ return createWorkbenchWindow(getDefaultPageInput(), getPerspectiveRegistry()
+ .findPerspectiveWithId(getPerspectiveRegistry().getDefaultPerspective()),
+ activeWindow, false);
}
IWorkbenchWindow createWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor descriptor,
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 d0df087..04c17e2 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
@@ -1766,7 +1766,6 @@ public class WorkbenchWindow implements IWorkbenchWindow {
public void shellActivated(ShellEvent event) {
shellActivated = true;
serviceLocator.activate();
- getWorkbenchImpl().setActivatedWindow(WorkbenchWindow.this);
if (getActivePage() != null) {
getWorkbenchImpl().fireWindowActivated(WorkbenchWindow.this);
}