Letting a custom class inject services [message #1691156] |
Thu, 02 April 2015 11:51  |
Eclipse User |
|
|
|
Dear experts,
I would like to let my class C of plugin P inject its own stuff.
Like explained in [1], I register a service which provides a org.eclipse.e4.core.services.log.Logger (via Activator, but I tried with a DS too: same thing), then inject my class in the bundle context.
I reproduced my scenario in a minimal project, which I hereby attach for volunteers.
It has an activator (Activator.java) and a command handler (FooHandler.java) which handles the Foo Item model button and triggers the instantiation of a Foo object, which is the guy who I want to inject whatever he wants.
The error I get is pasted in [2].
If I remove the injection of the IEventBroker, I get no error but the injected IEclipseContext is null.
[1] https://www.eclipse.org/forums/index.php?t=msg&th=370090&goto=904549&#msg_904549
[2] http://dpaste.com/3TVAZYW
I tried any sort of things, all day long, can't get rid of the Logger error.
Thanks for any help, I am that close to smashing my keyboard inside the screen and runaway screaming!
@see https://www.eclipse.org/forums/index.php?t=msg&th=389240&goto=956075&#msg_956075
@see https://www.eclipse.org/forums/index.php?t=msg&th=389240&goto=928693&#msg_928693
Attachment: TestOSGi.zip
(Size: 10.51KB, Downloaded 136 times)
|
|
|
Re: Letting a custom class inject services [message #1691169 is a reply to message #1691156] |
Thu, 02 April 2015 14:04   |
Eclipse User |
|
|
|
Hi,
Why are you doing this stuff at the OSGi-Level? Maybe you should start
describing your use case.
Tom
On 02.04.15 17:51, Piero Campalani wrote:
> Dear experts,
> I would like to let my class C of plugin P inject its own stuff.
>
> Like explained in [1], I register a service which provides a org.eclipse.e4.core.services.log.Logger (via Activator, but I tried with a DS too: same thing), then inject my class in the bundle context.
>
> I reproduced my scenario in a minimal project, which I hereby attach for volunteers.
>
> It has an activator (Activator.java) and a command handler (FooHandler.java) which handles the Foo Item model button and triggers the instantiation of a Foo object, which is the guy who I want to inject whatever he wants.
>
> The error I get is pasted in [2].
> If I remove the injection of the IEventBroker, I get no error but the injected IEclipseContext is null.
>
> [1] https://www.eclipse.org/forums/index.php?t=msg&th=370090&goto=904549&#msg_904549
> [2] http://dpaste.com/3TVAZYW
>
> I tried any sort of things, all day long, can't get rid of the Logger error.
> Thanks for any help, I am that close to smashing my keyboard inside the screen and runaway screaming!
>
> @see https://www.eclipse.org/forums/index.php?t=msg&th=389240&goto=956075&#msg_956075
> @see https://www.eclipse.org/forums/index.php?t=msg&th=389240&goto=928693&#msg_928693
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05055 seconds