1

I have a label provider for my model tree view:

public class ModelTreeLabelProvider implements ILabelProvider {

    @Inject
    IWorkbench workbench;

    @Override
    public Image getImage(Object element) {
        return workbench.getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
    }
[...]

}

It does work nice and dandy, but on application exit I get an InjectionException. I assume because at that time the Workbench no longer exists.

Actually I no longer use this class when the application is shutting down, so it is not a problem as is, just clutters up my log.

How to get rid of this error?

The first few lines of the stack trace:

org.eclipse.e4.core.di.InjectionException: org.eclipse.e4.core.di.InjectionException: Unable to process "ModelTreeLabelProvider.workbench": no actual value was found for the argument "IWorkbench".
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:66)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:977)
    at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:939)
    at org.eclipse.e4.core.internal.di.InjectorImpl.uninject(InjectorImpl.java:182)
2
  • That stack trace looks like injector uninject trying to run a @PreDestroy annotated method Commented Aug 16 at 15:07
  • Aside from that since the IWorkbench value never changes you could inject the value in the Constructor rather than using field injection. Constructor injection does not set up the value change tracking and uninject processing like field injection. Commented Aug 16 at 15:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.