|
Re: EMenuService is null [message #1295347 is a reply to message #1292206] |
Mon, 14 April 2014 07:31 |
Eclipse User |
|
|
|
Normally one would use the EMenuService in a part context (it internally tries to inject a part). What's your scenario for needing it from the window level? Can't you inject directly from the part you're trying to use it?
|
|
|
|
Re: EMenuService is null [message #1295601 is a reply to message #1295425] |
Mon, 14 April 2014 12:05 |
Eclipse User |
|
|
|
You do understand it well. However, look at the error message. It is not saying "I can't find an EMS", it's saying I can't find an MPart to initialize the EMS. Internally the EMS implementation has an @Inject MPart part; which fails in this context and its hierarchy.
Can you sysout the eclipseContext that you get as a parameter?
|
|
|
|
Re: EMenuService is null [message #1298361 is a reply to message #1295425] |
Wed, 16 April 2014 07:56 |
Frank Schaare Messages: 8 Registered: July 2009 |
Junior Member |
|
|
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 08: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?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04362 seconds