Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341318 - CCE in XMLEditorTester.test
Summary: CCE in XMLEditorTester.test
Status: RESOLVED INVALID
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.3   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: wst.xml CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-30 04:17 EDT by Johannes Rieken CLA
Modified: 2011-04-20 12:05 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Rieken CLA 2011-03-30 04:17:13 EDT
Build Identifier: 3.7M6

java.lang.ClassCastException: com.ibm.team.apt.internal.ide.ui.editor.IterationPlanEditor cannot be cast to org.eclipse.ui.texteditor.ITextEditor
	at org.eclipse.wst.xml.ui.internal.editor.propertytester.XMLEditorTester.test(XMLEditorTester.java:35)
	at org.eclipse.core.internal.expressions.Property.test(Property.java:58)
	at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:99)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
	at org.eclipse.core.internal.expressions.WithExpression.evaluate(WithExpression.java:72)
	at org.eclipse.core.internal.expressions.CompositeExpression.evaluateOr(CompositeExpression.java:68)
	at org.eclipse.core.internal.expressions.OrExpression.evaluate(OrExpression.java:21)
	at org.eclipse.core.internal.expressions.ReferenceExpression.evaluate(ReferenceExpression.java:70)
	at org.eclipse.ui.internal.services.EvaluationResultCache.evaluate(EvaluationResultCache.java:74)
	at org.eclipse.ui.internal.WorkbenchWindow.liftRestrictions(WorkbenchWindow.java:3091)
	at org.eclipse.ui.internal.WorkbenchWindow$28.shellActivated(WorkbenchWindow.java:3143)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:88)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4054)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1435)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1439)
	at org.eclipse.swt.widgets.Shell.windowDidBecomeKey(Shell.java:2057)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5438)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:213)
	at org.eclipse.swt.widgets.Widget.becomeKeyWindow(Widget.java:358)
	at org.eclipse.swt.widgets.Shell.becomeKeyWindow(Shell.java:494)

Reproducible: Always

Steps to Reproduce:
1. Open a custom editor
2. Select a different view/editor 
3. CCE happens because the XMLEditorTester cast my custom editor to a ITextEditor which it isn't
Comment 1 Nick Sandonato CLA 2011-03-30 10:41:37 EDT
Hi Johannes,

It looks like your implementation of IEditorPart has broken the API contract for IAdaptable#getAdapter(). In particular, it must return an object which is an instance of the class provided as a parameter. Since we are passing ITextEditor.class, we are guaranteed to have an object returned that is castable to ITextEditor or null.
Comment 2 Johannes Rieken CLA 2011-04-20 12:03:31 EDT
wrt comment 1 - you are right.
Comment 3 Johannes Rieken CLA 2011-04-20 12:05:06 EDT
Still, I have the feeling it's a bit weird to have a workbench listener that pokes into other editors to figure out if it's a xml editor. This knowledge should come from somewhere else