Project: Eclipse_Platform_UI
Bug 169898 [MPE] ClassCastException in EditorManager when using multi-page editor
Reported: 2007-01-08 17:05:31 | Status: resolved fixed

Build ID: I20061214-1445 Steps To Reproduce: 1. Create a multi-page editor that uses addPage(IEditorPart, IEditorInput) 2. Open the editor 3. Make it dirty 4. Close the workbench (choosing to save the editor) More information: When the workbench closes, it calls into EditorManager's saveEditorState() method, which makes the following call: final EditorSite site = (EditorSite) editor.getEditorSite(); Because the editor site is a MultiPageEditorSite rather than an EditorSite, it throws a ClassCastException and it ends up bringing up an error dialog. Because of that error dialog, its a more noticeable problem for me. Here's the exception: java.lang.ClassCastException: org.eclipse.ui.part.MultiPageEditorSite at org.eclipse.ui.internal.EditorManager.saveEditorState(EditorManager.java:1514) at org.eclipse.ui.internal.EditorManager.saveState(EditorManager.java:1433) at org.eclipse.ui.internal.WorkbenchPage.saveState(WorkbenchPage.java:3065) at org.eclipse.ui.internal.WorkbenchWindow.saveState(WorkbenchWindow.java:2440) at org.eclipse.ui.internal.Workbench.saveState(Workbench.java:1950) I'd recommend doing an instanceof before the cast.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java