Project: Eclipse_Platform_UI
Bug 21988 [Editor Mgmt] MultiPageEditorPart.getActiveEditor() doesn't check for disposed
Reported: 2002-07-26 18:16:43 | Status: resolved fixed

If you close a MultiPageEditorPart from its setFocus() method (because the file it's editing has been deleted, for instance), an error occurs: org.eclipse.swt.SWTException: Widget is disposed Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V org/eclipse/swt/SWTException.<init>(ILjava/lang/String;)V org/eclipse/swt/SWTException.<init>(I)V org/eclipse/swt/SWT.error(ILjava/lang/Throwable;)V org/eclipse/swt/SWT.error(I)V org/eclipse/swt/custom/CTabItem.getDisplay() Lorg/eclipse/swt/widgets/Display; org/eclipse/swt/widgets/Widget.isValidThread()Z org/eclipse/swt/widgets/Widget.checkWidget()V org/eclipse/swt/widgets/Widget.getData()Ljava/lang/Object; org/eclipse/ui/part/MultiPageEditorPart.getEditor(I) Lorg/eclipse/ui/IEditorPart; org/eclipse/ui/part/MultiPageEditorPart.getActiveEditor() Lorg/eclipse/ui/IEditorPart; com/ibm/etools/ctc/flow/ui/MicroflowMultiPageEditor.getActiveEditor() Lorg/eclipse/ui/IEditorPart; org/eclipse/ui/part/MultiPageSelectionProvider.getSelection() Lorg/eclipse/jface/viewers/ISelection; org/eclipse/ui/internal/AbstractSelectionService.partActivated (Lorg/eclipse/ui/IWorkbenchPart;)V org/eclipse/ui/internal/WorkbenchPage.firePartActivated (Lorg/eclipse/ui/IWorkbenchPart;)V org/eclipse/ui/internal/WorkbenchPage.setActivePart (Lorg/eclipse/ui/IWorkbenchPart;)V org/eclipse/ui/internal/WorkbenchPage.requestActivation (Lorg/eclipse/ui/IWorkbenchPart;)V org/eclipse/ui/internal/PartPane.requestActivation()V org/eclipse/ui/internal/EditorPane.requestActivation()V org/eclipse/ui/internal/PartPane.handleEvent (Lorg/eclipse/swt/widgets/Event;)V org/eclipse/swt/widgets/EventTable.sendEvent (Lorg/eclipse/swt/widgets/Event;)V . . . To work around this, I overrode 'getActiveEditor()' to check if the container is disposed, and return null if it is. This seems to fix the problem.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java