Plugin initialization [message #305239] |
Tue, 27 June 2006 07:32 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Manuel Selva![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=manuel.selva%40st.com) Messages: 189 Registered: July 2009 Location: Grenoble, France |
Senior Member |
|
|
Hi all,
I am writing an application dispatched into several plugins. In these
plugins there is one called "A" wich depends(there is a dependency into
the manifest file) on an other called "B". When "A" is started, "A" have
to register some listeners on "B" ("B" will be able to communicate with
"A" without dependency on it). My problem is the following one :
"A" is started only after "B" and the code into the plugin "A" is only
called by "B" with the listeners mechanism so "A" will never be notified.
Is there a way (for example in the start method of plugin B) to initialize
my listeners on A without creating the following dependency: B depends on
A. (My application can't have such a dependency because it is introducing
cycle due to other plugins)
Thanks
Manu
http://manuelselva.wordpress.com/
|
|
|
Re: Plugin initialization [message #305243 is a reply to message #305239] |
Tue, 27 June 2006 10:41 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Barthelemy Dagenais![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=barthelemy%40prologique.com) Messages: 14 Registered: July 2009 |
Junior Member |
|
|
I'm sure there are better solutions, but I see two options here:
1- Do not use LazyStart (not recommended...): your plug-in will be initialized
when Eclipse starts, so A will be able to register to B.
2- Use extension points (I think this is exactly what you want).
a) B declares an extension point (with an attribute class that must implements
your listener interface).
b) A declares an extension and provides the listener class.
c) When B is created (say, when the start method is called in the plug-in
activator), it goes through the plug-in registry and creates listeners from
registered extensions.
With this solution, you have lazy plug-in loading, plus A depends on B, but B
does not statically depend on A (you do not need to put A in the plug-in
dependencies).
Barthelemy
Manu wrote:
> Hi all,
>
> I am writing an application dispatched into several plugins. In these
> plugins there is one called "A" wich depends(there is a dependency into
> the manifest file) on an other called "B". When "A" is started, "A" have
> to register some listeners on "B" ("B" will be able to communicate with
> "A" without dependency on it). My problem is the following one :
>
> "A" is started only after "B" and the code into the plugin "A" is only
> called by "B" with the listeners mechanism so "A" will never be
> notified. Is there a way (for example in the start method of plugin B)
> to initialize my listeners on A without creating the following
> dependency: B depends on A. (My application can't have such a dependency
> because it is introducing cycle due to other plugins)
>
> Thanks
>
> Manu
>
|
|
|
Re: Plugin initialization [message #305245 is a reply to message #305243] |
Tue, 27 June 2006 11:00 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: eclipse.bettsockentraeger.de
Barthelemy Dagenais wrote:
> I'm sure there are better solutions, but I see two options here:
>
> 1- Do not use LazyStart (not recommended...): your plug-in will be
> initialized when Eclipse starts, so A will be able to register to B.
This is incorrect if you want automatic Plugin activation when your
Plugin is called you will have to specify LazyStart else your bundle
/plugin will only be activated when it is being manually activated.
What you are referring to is the Startup Extensionpoint.
Regards
Stefan
|
|
|
|
|
Re: Plugin initialization [message #305248 is a reply to message #305246] |
Tue, 27 June 2006 12:17 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: lamont_gilbert.rigidsoftware.com
Manu wrote:
> Thanks you very much Barthelemy,
>
> I still have a last question: does the fact of declaring an exstension
> point that will be only extended into my application is in the Eclipse
> philosophy ??
>
> Thanks again
>
> Manu
Extention points are between plugins not applications. Thus, if one plugin
requires some facilities provided by another, extention point is the proper
Eclipse way. Even if there is only a single plugin. But even with an
extention point, there will still be a dependency. One plugin will have to
define the extension point and another plugin will implement it or call
upon it.
Two plugins will not interoperate without a dependency in at least one
direction.
--
Respectfully,
CL Gilbert
"Verily, verily, I say unto you, He that entereth not by the door() into the
sheepfold{}, but climbeth up some other *way, the same is a thief and a
robber."
|
|
|
|
|
Re: Plugin initialization [message #305264 is a reply to message #305249] |
Tue, 27 June 2006 18:18 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: lamont_gilbert.rigidsoftware.com
Manu wrote:
> In wich way the dependency is when B defines an extension point and A
> extends it ??
>
A depends on B.
B will ask eclipse architecture for all implementors of the extension point.
Then B will 'instantiate' the implementation it gets back from eclipse.
Then b uses it.
> Is it dangerous to have bi-directional dependency ? One static into the
> dependencies of the plugin.xml and the other by extending an exstension
> point?
>
>
> Thanks
>
> Manu
No, don't need any bi-directional dependencies. If you have those then you
probably need to refactor your plugin responsibilities.
--
Respectfully,
CL Gilbert
"Verily, verily, I say unto you, He that entereth not by the door() into the
sheepfold{}, but climbeth up some other *way, the same is a thief and a
robber."
|
|
|
Powered by
FUDForum. Page generated in 0.04589 seconds