| Injection Scope [message #986409] |
Tue, 20 November 2012 05:53  |
Michael Behrisch Messages: 6 Registered: October 2012 |
Junior Member |
|
|
Hello,
I think this could be a stupid question, but I don't find it in the forum:
I have a number of plugins that are injected into the main/core framework.
In each of the plugins the injected class is referenced via the fragment and
its connection to the core's part id. This works all perfectly... But here comes the problem:
Class A is injected into the framework and all @Inject, etc. annotations are resolved.
Whenever class A contains another class B,C,D,.. How do I get them also to be resolved?
E.g. Class B either gets an own context object or the parent context and sets a variable. Now the interested class C does not receive it via the @Named annotation.
Where is my missunderstanding?!?
Maybe to make it more abstract: How do I tell the Eclipse injection mechanism to resolved arbitrary other classes?
Thanks in advance...
|
|
|
|
| Re: Injection Scope [message #986417 is a reply to message #986412] |
Tue, 20 November 2012 06:13   |
Michael Behrisch Messages: 6 Registered: October 2012 |
Junior Member |
|
|
Thanks for the fast response, but this is not the problem
The basics that you posted are clear. But the thing is that my problem appears in a single plugin:
The plugin consist of the "entry-point" A in which everything is resolved perfectly.
But if this class contains references to other classes e.g. B and C and B and C should communicate with each other
by means of the context objects or eventbroker service the injection mechanism must get to know B and C.
But I do not understand how I can connect the child contexts (IEclipseContext context = parentPart.getContext(); --> context.createChild())
to the respective class. Thus, if i post something on B, C will not recognize it because it is not automatically injected via
@Named or @UIEventTopic...
Hopefully the problem is now clearer.
PS: Why should I build up something like a Observer Pattern if the injection could do the same thing for me...
[Updated on: Tue, 20 November 2012 06:15] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03516 seconds