EMenuService is null [message #1292206] |
Fri, 11 April 2014 12:12  |
Eclipse User |
|
|
|
Hi,
I have following handler implemented:
@Execute
public void execute(
IEclipseContext eclipseContext,
EMenuService service,
@Named(value = ContextVariables.CANVAS_OBJECTS_MANAGER) ICanvasManager canvasManager) {
...
}
Following error is thrown:
MenuService: TrimmedWindowImpl (cz.martinbayer.e4.analyser.trimmedwindow.0) Context: org.eclipse.e4.core.di.InjectionException: Unable to process "MenuService.myPart": no actual value was found for the argument "MPart".
service parameter is null even when this handler is registered in application model but regarding previous error message it is obvious there is no EMenuService registered for context of the part.
Am I missing something? I tried to register the handler to the:
*Application->Handlers
*Application->Windows->Trimmed window->Handlers
Any advice would be appreciated.
Thank you very much,
M.
|
|
|
|
|
|
|
Re: EMenuService is null [message #1298361 is a reply to message #1295425] |
Wed, 16 April 2014 03:56   |
Eclipse User |
|
|
|
Hi,
Martin Bayer wrote on Mon, 14 April 2014 04:56Hi,
But why there is no EMenuService contained in the context? I thought it searches for variables in the context hierarchically, so it should be found at least in the main context for the application. Do I understand it well?
Thanks for your responses,
Martin
this question is FAQ meanwhile, you will find at least 5 questions (all unanswered) to this topic in the threads below.
I spent some time searching for an answer, because in all PartDescriptors, the EMenuservice is NULL too, which is quite anoying.
The EMenuservice is not a e4 core service, it is a declarative service provided by the SWT renderer. For these services, the hierarchically lookup seems to be buggy, the DI-Container just searches the actual context and injects NULL without proceeding to higher contextes.
A solution may be to manually retrieve the service context and access the EMenuservice directly, without 'DI-Magic'.
I hope, some day, a committer will answer to this topic.....
|
|
|
Re: EMenuService is null [message #1298393 is a reply to message #1298361] |
Wed, 16 April 2014 04:28   |
Eclipse User |
|
|
|
Frank Schaare wrote on Wed, 16 April 2014 09:56Hi,
Martin Bayer wrote on Mon, 14 April 2014 04:56Hi,
But why there is no EMenuService contained in the context? I thought it searches for variables in the context hierarchically, so it should be found at least in the main context for the application. Do I understand it well?
Thanks for your responses,
Martin
this question is FAQ meanwhile, you will find at least 5 questions (all unanswered) to this topic in the threads below.
I spent some time searching for an answer, because in all PartDescriptors, the EMenuservice is NULL too, which is quite anoying.
The EMenuservice is not a e4 core service, it is a declarative service provided by the SWT renderer. For these services, the hierarchically lookup seems to be buggy, the DI-Container just searches the actual context and injects NULL without proceeding to higher contextes.
A solution may be to manually retrieve the service context and access the EMenuservice directly, without 'DI-Magic'.
I hope, some day, a committer will answer to this topic.....
You really have no idea what you're talking about, do you? The EMenuService is provided by a context function called MenuServiceCreationFunction. Whatever .....
@Martin, can't you put the EMS injection at the @Postconstruct of the part which has this canvas? You can see from the debug statement that the context in question is the workbench and there's no part in it, or above it. Is there an active part around when this handler is called?
|
|
|
|
Re: EMenuService is null [message #1322333 is a reply to message #1298504] |
Tue, 29 April 2014 16:19  |
Eclipse User |
|
|
|
Hi, sorry for late response but I was quite busy.
Sepot, you're absolutely right with active part thought and I'm really stupid on the other hand:). The problem doesn't occur when part is focused before the handler is invoked.
|
|
|
Powered by
FUDForum. Page generated in 0.05074 seconds