[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Eclipse ViewPart and OSGI Declarative Services problem

Hi Richard,

This is a rather challenging area, because the lifecycles of services
and extensions are completely unrelated. As you've noticed, creating a
component with DS does not mean it will be used by the extension
registry. Indeed it cannot be, because the extension registry is more
like a factory where new instances are created each time they are
needed.

I created a small framework to help with this kind of thing:
http://github.com/njbartlett/extensions2services. Please be sure to
read the manual (in PDF), because it helps to describe the background
of the problem, even if you decide not to adopt my solution.

Other possible solutions, which all use or include a
dependency-injection approach, are as follows:

1) Eclipse Riena -- however Riena does a lot of other stuff that I
don't really understand
2) Peaberry is based on Guice
3) Eclipse 4.0 ("e4") uses dependency injection everywhere, but this
is not much use to you if you are using 3.x.

Regards,
Neil


On Mon, Nov 1, 2010 at 9:17 PM, Richard Catlin
<richard.m.catlin@xxxxxxxxx> wrote:
> I have a ViewPart which depends on an OSGI Declarative Service.
>
> I have it configured properly so that the service is injected into the
> ViewPart via a bind method. I can debug and see that this is working.
>
> The problem I am having is that a new instance of the ViewPart is being
> instantiated for viewing and that the instance that was injected is not
> being used.
>
> Any help is appreciated.
>
> Thanks.
> Richard Catlin
>
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev
>
>