Community
Participate
Working Groups
Using any MultiPageEditorPart...specifically using the multipageeditor example in 2.0.0. SAVE menu item accessed from right-click menu raises exception from Bad Cast. java.lang.ClassCastException: org.eclipse.ui.part.MultiPageEditorSite at org.eclipse.ui.internal.WorkbenchPage.getReference (WorkbenchPage.java:2420) at org.eclipse.ui.internal.WorkbenchPage.certifyPart (WorkbenchPage.java:574) at org.eclipse.ui.internal.WorkbenchPage.saveEditor (WorkbenchPage.java:1918) at org.eclipse.ui.texteditor.SaveAction.run(SaveAction.java:41) at org.eclipse.jface.action.Action.runWithEvent(Action.java:749) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:775) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:432) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:24) Error comes in call to certifyPart() // Class WorkbenchPage public boolean saveEditor(org.eclipse.ui.IEditorPart editor, boolean confirm) { // Sanity check. if (!certifyPart(editor)) return false; // Real work. return getEditorManager().saveEditor(editor, confirm); } Bad cast is here....cast to (PartSite) does not work for MultiPageEditorPart // Class WorkbenchPage private IWorkbenchPartReference getReference(IWorkbenchPart part) { **---> PartPane pane = ((PartSite)part.getSite()).getPane(); if(pane instanceof MultiEditorInnerPane) { MultiEditorInnerPane innerPane = (MultiEditorInnerPane)pane; return innerPane.getParentPane().getPartReference(); } return pane.getPartReference(); }
*** This bug has been marked as a duplicate of 22325 ***