Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 23352 - [Editor Mgmt] MultiPageEditorPart will not save from right-click context menu
Summary: [Editor Mgmt] MultiPageEditorPart will not save from right-click context menu
Status: RESOLVED DUPLICATE of bug 22325
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Eduardo Pereira CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-09 20:34 EDT by Chris Lloyd CLA
Modified: 2002-09-10 09:16 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lloyd CLA 2002-09-09 20:34:07 EDT
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();
}
Comment 1 Eduardo Pereira CLA 2002-09-10 09:16:11 EDT

*** This bug has been marked as a duplicate of 22325 ***