|
Re: Eclipse Service with DI [message #1010484 is a reply to message #1009790] |
Sun, 17 February 2013 12:47 |
Eclipse User |
|
|
|
If your bakery service is independent of the UI, but is not intended to be instantiated on a 1-1 basis with thr UI, then I'd recommend configuring it as an OSGi service, and post your events directly to the EventAdmin service instead. If you do want to use the IEventBroker for posting, do it from an addon that is introduced by a model processor -- the model processors originally had a very limited lifetime, created and then torn down, and something changed. Addons are part of the model, on the other hand, and have the same lifetime as the model itself.
Brian,
|
|
|
Re: Eclipse Service with DI [message #1010497 is a reply to message #1010484] |
Sun, 17 February 2013 13:35 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Another way if you need access to the IEventBroker (=you can't simply
contribute as an OSGi-Service) is to register an IContextFunction
providing the service interface through DS.
In 4.3 we are registering our E4Workbench as an OSGi-Application which
allows you to get access to the MApplication which allows you to get
access to the IEclipseContext which allows you to access IEventBroker
even from OSGi.
Tom
Am 17.02.13 13:47, schrieb Brian de Alwis:
> If your bakery service is independent of the UI, but is not intended to
> be instantiated on a 1-1 basis with thr UI, then I'd recommend
> configuring it as an OSGi service, and post your events directly to the
> EventAdmin service instead. If you do want to use the IEventBroker for
> posting, do it from an addon that is introduced by a model processor --
> the model processors originally had a very limited lifetime, created
> and then torn down, and something changed. Addons are part of the model,
> on the other hand, and have the same lifetime as the model itself.
>
> Brian,
|
|
|
Re: Eclipse Service with DI [message #1010515 is a reply to message #1010497] |
Sun, 17 February 2013 14:44 |
Kai Zimmermann Messages: 16 Registered: October 2012 |
Junior Member |
|
|
I will google about IContextFunction, because I never heard about it. I found eclipse.org/forums/index.php/m/734956/, but IEventBroker is only an example, I'd like to use the whole DI functionality, not especially the messaging service
Hint for me
- grepcode.com/file/repository.grepcode.com/java/eclipse.org/4.2/org.eclipse.e4.core/contexts/1.1.0/org/eclipse/e4/core/contexts/IContextFunction.java#IContextFunction.compute%28org.eclipse.e4.core.contexts.IEclipseContext%29
- stackoverflow.com/questions/12996698/example-on-how-to-use-icontextfunction-in-eclipse-4
- toedter.com/blog/?p=222
Thank you!
[Updated on: Sun, 17 February 2013 14:44] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03426 seconds