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

Bug 325187

Summary: Double click on a history entry results in 'Could not open the editor: Invalid Input: Must be IFileEditorInput'
Product: [Technology] EGit Reporter: Bernard Leach <leachbj>
Component: CoreAssignee: Mathias Kinzler <mathias.kinzler>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.sohn, remy.suen, stefan.lay
Version: 0.9.0   
Target Milestone: ---   
Hardware: All   
OS: Linux-GTK   
Whiteboard:

Description Bernard Leach CLA 2010-09-13 23:16:21 EDT
1. Right click on a resource stored in a git reopsitory and select 'Show In->History' from popup menu
2. Double click on a commit in the History View

Expected:
The resource from that revision is displayed

Actual:
An error editor is displayed with the message 'Could not open the editor: Invalid Input: Must be IFileEditorInput' and the following details.

org.eclipse.ui.PartInitException: Invalid Input: Must be IFileEditorInput
	at com.springsource.sts.config.ui.editors.SpringConfigEditor.init(SpringConfigEditor.java:446)
	at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:798)
	at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:644)
	at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:462)
	at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
	at org.eclipse.ui.internal.EditorReference.getEditor(EditorReference.java:286)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2857)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2762)
	at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2754)
	at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2705)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2701)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2685)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2676)
	at org.eclipse.egit.ui.internal.EgitUiEditorUtils.openEditor(EgitUiEditorUtils.java:86)
	at org.eclipse.egit.ui.internal.EgitUiEditorUtils.openEditor(EgitUiEditorUtils.java:72)
	at org.eclipse.egit.ui.internal.EgitUiEditorUtils.openEditor(EgitUiEditorUtils.java:58)
	at org.eclipse.egit.ui.internal.history.command.ShowVersionsHandler.execute(ShowVersionsHandler.java:86)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:294)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommandInContext(HandlerService.java:270)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommandInContext(SlaveHandlerService.java:285)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommandInContext(SlaveHandlerService.java:285)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommandInContext(SlaveHandlerService.java:285)
	at org.eclipse.egit.ui.internal.history.GitHistoryPage$4.open(GitHistoryPage.java:479)
	at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:842)
	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.JFaceUtil$1.run(JFaceUtil.java:48)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
	at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:840)
	at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1101)
	at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1205)
	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:1176)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	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:368)
	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:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Comment 1 Bernard Leach CLA 2010-09-13 23:19:18 EDT
Sometimes an error dialog is shown;

"Trying to execute the disabled command org.eclipse.egit.ui.history.ShowVersions"

This seems to occur if I try double clicking on another revision shortly after the first error occurs.
Comment 2 Remy Suen CLA 2010-09-14 20:27:00 EDT
(In reply to comment #0)
> Actual:
> An error editor is displayed with the message 'Could not open the editor:
> Invalid Input: Must be IFileEditorInput' and the following details.
> 
> org.eclipse.ui.PartInitException: Invalid Input: Must be IFileEditorInput
>     at
> com.springsource.sts.config.ui.editors.SpringConfigEditor.init(SpringConfigEditor.java:446)

This is an issue with the Spring editor not being capable of opening files that are not known by the workspace.
Comment 3 Mathias Kinzler CLA 2010-10-01 06:46:13 EDT
Actually, EGit has some fallback coding that would try to open a text editor if opening of the "default" editor for a file fails. Unfortunately, the PartInitException is not thrown in that case, as an error editor is displayed instead. This behavior is described extensively in bug 90582 (see in particular comment #46). 
We don't want to use internals in our code, so we can't code the workaround described there.
Unless bug 90582 is fixed, as it seems, there are two options: either the SpringConfig editor must be able to use IEditorInput instead of IFileEditorInput, or we need to have an explicit action "Open in Text Editor" in the history view.
Comment 4 Mathias Kinzler CLA 2010-10-05 05:53:42 EDT
Code review at http://egit.eclipse.org/r/#change,1697. This adds a "Open in Text Editor" action to the history view.
Comment 5 Matthias Sohn CLA 2010-10-14 19:27:43 EDT
merged as 644bbbc5fb660ee2598fc9ae3025285dff8a04be