11.2.1 Windows 7 x64
When opening a .p by dragging the file from explorer to the editor pane and the file is not in the workspace or belongs to a closed project, Eclipse throws an error:
An error has occurred. See error log for more details.
java.io.File cannot be cast to
org.eclipse.core.resources.IFile
The file is then shown normally. When closing the file the error occurs again.
Why?
Had to search the knowledge base to find where the error log is, here it is:
!ENTRY org.eclipse.ui.workbench 4 2 2013-12-05 09:28:46.876
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.ClassCastException: java.io.File cannot be cast to org.eclipse.core.resources.IFile
at com.openedge.pdt.project.codeinfo.CodeModelManager.getABLContentPath(CodeModelManager.java:357)
at com.openedge.pdt.project.codeinfo.CodeModelManager.getPath(CodeModelManager.java:494)
at com.openedge.pdt.project.codeinfo.CodeModelManager.access$4(CodeModelManager.java:477)
at com.openedge.pdt.project.codeinfo.CodeModelManager$PartListener.partClosed(CodeModelManager.java:444)
at org.eclipse.ui.internal.PartListenerList2$3.run(PartListenerList2.java:100)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
at org.eclipse.ui.internal.PartListenerList2.firePartClosed(PartListenerList2.java:98)
at org.eclipse.ui.internal.PartService.firePartClosed(PartService.java:227)
at org.eclipse.ui.internal.WWinPartService$WWinListener.partClosed(WWinPartService.java:46)
at org.eclipse.ui.internal.PartListenerList2$3.run(PartListenerList2.java:100)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
at org.eclipse.ui.internal.PartListenerList2.firePartClosed(PartListenerList2.java:98)
at org.eclipse.ui.internal.PartService.firePartClosed(PartService.java:227)
at org.eclipse.ui.internal.WorkbenchPagePartList.firePartClosed(WorkbenchPagePartList.java:39)
at org.eclipse.ui.internal.PartList.partClosed(PartList.java:274)
at org.eclipse.ui.internal.PartList.removePart(PartList.java:186)
at org.eclipse.ui.internal.WorkbenchPage.disposePart(WorkbenchPage.java:1796)
at org.eclipse.ui.internal.WorkbenchPage.handleDeferredEvents(WorkbenchPage.java:1501)
at org.eclipse.ui.internal.WorkbenchPage.deferUpdates(WorkbenchPage.java:1485)
at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:1459)
at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:1514)
at org.eclipse.ui.internal.EditorPane.doHide(EditorPane.java:61)
at org.eclipse.ui.internal.PartStack.close(PartStack.java:537)
at org.eclipse.ui.internal.EditorStack.close(EditorStack.java:206)
at org.eclipse.ui.internal.PartStack$1.close(PartStack.java:120)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:83)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:269)
at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:278)
at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1)
at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$1.closeButtonPressed(DefaultTabFolder.java:71)
at org.eclipse.ui.internal.presentations.PaneFolder.notifyCloseListeners(PaneFolder.java:631)
at org.eclipse.ui.internal.presentations.PaneFolder$3.close(PaneFolder.java:206)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1598)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:261)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:344)
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:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
Hi Stefan,
Are you observing this issue for any of the external file (which is located outside of workspace) or is it specific to any peculiar file?
I have tried this with a simple ABL file and I did not observe the exception in log on opening or closing the file.
Thanks and Regards,
Anil Kumar.
Hi Anil,
Yes, I am getting this with any file (so also for example a .txt file). The same error occurs when opening a 'recent file' from File / <recent files> menu and the project has been closed.
Regards,
Stefan
Additional info: I do have various plug-ins installed - the most important one being the Microsoft TFS plug-in Team Explorer. But the error stack seems to point to Progress?
Hi Stefan,
Can you please try installing Developer Studio plugins in a new eclipse (3.7.1) directory using the 'integrateArchitect.bat' file and check for the behavior?
Thanks and Regards,
Anil Kumar.
Hi Anil,
With a vanilla Eclipse there is no issue, I have done the following:
Any ideas?
Thanks,
Stefan
I have been in contact with PTS with this - while analyzing the steps to reproduce it seems that the combination of the OpenEdge stuff and AnyEditTools (which is a great white space stripper and resource opener) is causing the issue.
That's the beauty of java error messages, they give you the exact error location.
Line 357 may look like: IFile xyz = (IFile) abc.getSomething(...);
That line results in a ClassCastException because the getSomething Method is returning java.io.File und the programmer thought File.class returns an object of org.eclipse.core.internal.resources.File which indeed implements IFile.