Community
Participate
Working Groups
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
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.
wrt comment 1 - you are right.
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