Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 295901

Summary: [JUnit] CCE when opening an editor
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: UIAssignee: Dani Megert <daniel_megert>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.6   
Target Milestone: 3.6 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 277697    
Bug Blocks:    

Description Olivier Thomann CLA 2009-11-23 12:43:19 EST
Using eclipse.buildId=I20091118-1342
java.version=1.6.0_18-ea
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=fr_CA
Command-line arguments:  -os win32 -ws win32 -arch x86 -console

I got this exception in my .log file. I don't know exactly what I was doing when this occurred.

java.lang.ClassCastException: org.eclipse.compare.internal.CompareEditor cannot be cast to org.eclipse.ui.texteditor.ITextEditor
at org.eclipse.jdt.internal.junit.ui.OpenEditorAction.run(OpenEditorAction.java:76)
at org.eclipse.jdt.internal.junit.ui.FailureTrace$1.handleOpen(FailureTrace.java:77)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:264)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:258)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:298)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3524)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2404)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2368)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2220)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:367)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:611)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:566)
at org.eclipse.equinox.launcher.Main.run(Main.java:1363)
at org.eclipse.equinox.launcher.Main.main(Main.java:1339)
Comment 1 Markus Keller CLA 2009-11-23 13:37:11 EST
Dani, this happens when a compare editor for the file in question is already open and currently active (consequence of bug 264321). This should get fixed when bug 277697 is fixed.

Workaround is to switch away from the compare editor.
Comment 2 Dani Megert CLA 2009-11-24 04:36:05 EST
Doing an unchecked cast is wrong: it also fails if the user chose any different non-ITextEditor to open *.java files.