Community
Participate
Working Groups
If I throw an UnsupportedOperationException in @PostContruct I get the following error: org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": This is really bad as it makes it very hard to find the cause of the problem. Here is the example: @PostConstruct public void createControls(Composite parent) { Button button = new Button(parent, SWT.PUSH); button.setText("Delete Todo"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { throw new UnsupportedOperationException("not supported"); } }); } Here is the full stacktace: org.eclipse.e4.core.di.InjectionException: Unable to process "WorkbenchStatusReporter.shellProvider": no actual value was found for the argument "IShellProvider". at org.eclipse.e4.core.internal.di.InjectorImpl.reportUnresolvedArgument(InjectorImpl.java:387) at org.eclipse.e4.core.internal.di.InjectorImpl.resolveRequestorArgs(InjectorImpl.java:382) at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:99) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:317) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:239) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:153) at org.eclipse.e4.ui.internal.workbench.swt.StatusReporterCreationFunction.compute(StatusReporterCreationFunction.java:23) at org.eclipse.e4.core.internal.contexts.ValueComputation.get(ValueComputation.java:59) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:220) at org.eclipse.e4.core.internal.contexts.EclipseContext.internalGet(EclipseContext.java:229) at org.eclipse.e4.core.internal.contexts.EclipseContext.get(EclipseContext.java:191) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9$1.eventLoopException(PartRenderingEngine.java:981) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.handle(PartRenderingEngine.java:1020) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1008) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:893) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:85) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:140) 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:352) 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:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:624) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:579) at org.eclipse.equinox.launcher.Main.run(Main.java:1433) at org.eclipse.equinox.launcher.Main.main(Main.java:1409)
Could you attach complete code to duplicate the problem? I am not sure how the code piece in the comment 0 could create that error stack.
@Oleg, strange isn't it? Here is the full implementation of the Part. There is not more execution code then then coding I originally attached. package com.example.e4.rcp.todo.parts; import javax.annotation.PostConstruct; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; public class TestPart { @PostConstruct public void createControls(Composite parent) { Button button = new Button(parent, SWT.PUSH); button.setText("Delete Todo"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { throw new UnsupportedOperationException("not supported"); } }); } }
Created attachment 210340 [details] Example Project As suggested a complete example project
The problem is that error reporting from a part renderer is broken. It tries to create WorkbenchStatusReporter using application context which does not have IShellProvider in it. Hence the error message you see - it is not the original error, but the error in creating error handling object. If that makes any sense. I added code into the WorkbenchStatusReporter to get a proper shell: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=f876fcac1d5c3d445342f1ea15d31dc9f5e1bd86 More generally, we need to cleanup IShellProvider service. Opened bug 370341 for that.
.
Thanks for the fast fix.
Verified in I20120313-0610.