|
|
|
Re: ExecutableExtensionFactory#getBundle() [message #689741 is a reply to message #675500] |
Tue, 28 June 2011 09:11 |
Sebastian Paul Messages: 106 Registered: July 2009 |
Senior Member |
|
|
Hi Gerit,
Sebastian Z. is right, you have to use the Injector from the plugin you
depend on, and create a new Injector from it. See
http://google-guice.googlecode.com/svn/trunk/javadoc/com/google/inject/Injector.html#createChildInjector%28com.google.inject.Module...%29
I am wondering why the Grammar core plugins do not build their own
Injector by default. This could be used in the UI plugin to create a
child Injector, instead of the current approach using Module overrides.
--
Best regards,
Sebastian Paul
Am 2011-05-31 19:20, schrieb gerit:
> Sebastian Zarnekow wrote on Tue, 31 May 2011 10:35
>> the exectuable extension factory is meant to be used only for classes
>> that are visible from a given bundle. However, you could use an own
>> ExecutableExtensionFactory in your second bundle that uses the
>> injector of your first bundle.
>
> Hi Sebastian and thanks for the fast answer!
> But I am a little bit confused... my
> mymodel.otherplugin.ui.OtherPluginClass is 'visible from a given bundle'
> because the given bundle of the extension is 'mymodel.otherplugin.ui'
> itself ;)
> Why not use the given bundle to load the class like in the 2nd
> code-sample(post#1)? It would make the generated factory much more
> flexible. Why must the factory create the given extension-class in the
> own class loader? I though the job of the factory is to 'inject' the
> created (and maybe 'external') class with the required 'own'-classes?
> Atm I use in mymodel.ui a derived factory with this modification and it
> works fine.
> many thanks,
> gerit
>
|
|
|
|
Re: ExecutableExtensionFactory#getBundle() [message #692903 is a reply to message #690948] |
Tue, 05 July 2011 12:15 |
Sebastian Paul Messages: 106 Registered: July 2009 |
Senior Member |
|
|
Hi Sebastian,
thanks for the explaination. The problem I see here only arises in more
complex scenarios where there are more than one core and UI plugin
involved. For example, an optional plugin which only depends on the
grammar core may also want to get dependencies injected by Guice. With
your approach, there are two choices:
a) create child injector from grammar UI plugin - this would create an
aditional coupling
b) create new injector, using the runtime module from grammar core - to
the cost of more memory consumption (and maybe other side effects)
I'm a but curios about what is exactly overridden by the UI module.
Isn't it possible to separate concerns so far that UI can use the Core
injector as parent? Is this actually an Equinox issue? I'm asking,
because we need some best practices for our own architecture which
already uses lots of Guice and Xtext functionality.
Am 2011-06-30 14:51, schrieb Sebastian Zarnekow:
> Hi Sebastian,
>
> creating an injector for the core plugins in an Eclipse equinox context
> would lead to corrupt emf registries. The UI modules explicitly
> overrides some of the runtime bindings to avoid instantiating the
> runtime instances. Otherwise, you'd end up with wrong instances in some
> of the EMF registries. That sounds more confusing than helpful to me ...
>
> Let's try again: Creating an runtime injector in an equinox environment
> interferes the eclipse extension mechanism and you wouldn't have to
> possibility to override bindings that are requested by runtime
> components with ui specific functionality.
>
> Regards,
> Sebastian
--
Best regards,
Sebastian Paul
|
|
|
Powered by
FUDForum. Page generated in 0.03107 seconds