Project: Eclipse_Platform_UI
Bug 2536 Window lifecycle needed (1GFL2TW)
Reported: 2001-10-10 22:38:19 | Status: resolved fixed

From Eclipse Corner (6/13/2001): It seems some obvious functionality is missing from IWorkbench. We need to know when a new workbench window is opened or an existing one closed. For example: IWorkbench.addWorkbenchListener(IWorkbenchListener) IWorkbenchListener would contain, among other methods, windowOpened(IWorkbenchWindow) windowClosed(IWorkbenchWindow) etc... I've found a workaround. However, this is very ugly and it would be great if someone could give an estimate when real listener support could be added to IWorkbench. I'm adding a ShellListener to the current WorkbenchWindow's shell. When I get a shellDeactivated, I check to see what the activeWorkBenchWindow is. If its not the original window, I know I've got a new one. I've discovered I must do the check in an asyncExec, because at the time shellDeactivated is called, the original workbench window is still the active one. NOTES:

Files changed in fix:
bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/IWindowListener.java bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/IWorkbench.java bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/Workbench.java bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java