cucumber / cucumber-eclipse

Eclipse plugin for Cucumber
MIT License
192 stars 149 forks source link

Unable to create part when showing revision information #407

Open PyvesB opened 4 years ago

PyvesB commented 4 years ago

Hello hello!

I've got a Cucumber feature file version controlled using Git. I've enabled revision information by right clicking in the file, Team -> Show Revision Information. The editor ruler then displays commit information for every single line when you hover over the lines number, and in the hover popup you can click on "show revision information" again to open a new editor corresponding to that revision of the file.

When I do so, I get an error message "Unable to create part", with the following stack trace:

org.eclipse.ui.PartInitException: Editor could not be initialized.
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3212)
    at org.eclipse.ui.texteditor.AbstractTextEditor.init(AbstractTextEditor.java:3221)
    at org.eclipse.ui.internal.EditorReference.initialize(EditorReference.java:353)
    at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create(CompatibilityPart.java:340)
    at jdk.internal.reflect.GeneratedMethodAccessor138.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:999)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:964)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:140)
    at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:405)
    at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:332)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:91)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:60)
    at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:42)
    at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(ContributedPartRenderer.java:132)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(PartRenderingEngine.java:1002)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:662)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:768)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$0(PartRenderingEngine.java:739)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run(PartRenderingEngine.java:733)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:717)
    at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.showTab(StackRenderer.java:1294)
    at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer.lambda$0(LazyStackRenderer.java:75)
    at org.eclipse.e4.ui.workbench.renderers.swt.LazyStackRenderer$$Lambda$279/0000000000000000.handleEvent(Unknown Source)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler.lambda$0(UIEventHandler.java:38)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler$$Lambda$190/0000000000000000.run(Unknown Source)
    at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
    at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
    at org.eclipse.swt.widgets.Display.syncExec(Display.java:4998)
    at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:219)
    at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:38)
    at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203)
    at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
    at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
    at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75)
    at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44)
    at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55)
    at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
    at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(ElementContainerImpl.java:170)
    at org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(ElementContainerImpl.java:188)
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:661)
    at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:625)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.delegateBringToTop(PartServiceImpl.java:790)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1263)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3195)
    at org.eclipse.ui.internal.WorkbenchPage.lambda$9(WorkbenchPage.java:3100)
    at org.eclipse.ui.internal.WorkbenchPage$$Lambda$1066/000000005DAC0020.run(Unknown Source)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3098)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3068)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3059)
    at org.eclipse.egit.ui.internal.EgitUiEditorUtils.openEditor(EgitUiEditorUtils.java:134)
    at org.eclipse.egit.ui.internal.EgitUiEditorUtils.openEditor(EgitUiEditorUtils.java:119)
    at org.eclipse.egit.ui.internal.blame.BlameOperation.openEditor(BlameOperation.java:335)
    at org.eclipse.egit.ui.internal.blame.BlameOperation.access$0(BlameOperation.java:326)
    at org.eclipse.egit.ui.internal.blame.BlameOperation$1.run(BlameOperation.java:321)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4126)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3793)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
    at org.eclipse.ui.internal.Workbench$$Lambda$120/0000000000000000.run(Unknown Source)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
Caused by: java.lang.ClassCastException: org.eclipse.egit.ui.internal.revision.FileRevisionEditorInput incompatible with org.eclipse.ui.IFileEditorInput
    at cucumber.eclipse.editor.editors.Editor.getFile(Editor.java:166)
    at cucumber.eclipse.editor.editors.Editor.warnIfFeatureFileOpenedComesFromNonCucumberProject(Editor.java:155)
    at cucumber.eclipse.editor.editors.Editor.doSetInput(Editor.java:151)
    at org.eclipse.ui.texteditor.AbstractTextEditor.lambda$1(AbstractTextEditor.java:3179)
    at org.eclipse.ui.texteditor.AbstractTextEditor$$Lambda$507/0000000000000000.run(Unknown Source)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:436)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
    at org.eclipse.ui.internal.WorkbenchWindow.lambda$5(WorkbenchWindow.java:2375)
    at org.eclipse.ui.internal.WorkbenchWindow$$Lambda$1068/000000005F25FE20.run(Unknown Source)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2373)
    at org.eclipse.ui.texteditor.AbstractTextEditor.internalInit(AbstractTextEditor.java:3196)
    ... 89 more

Let me know if you need any more information!

laeubi commented 3 years ago

You should report the issue to the EGit project

PyvesB commented 3 years ago

You should report the issue to the EGit project

I disagree. The faulty line of code is in the Cucumber project: https://github.com/cucumber/cucumber-eclipse/blob/fe9cff7944f58614d3051ecf611d5e3695c01681/cucumber.eclipse.editor/src/main/java/cucumber/eclipse/editor/editors/Editor.java#L166

Assuming that the editor input is necessarily a file is wrong from the point of view of the Eclipse Platform API. EGit is perfectly allowed to launch a text editor not based on a file.

Therefore reopening.