[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [equinox-dev] Eclipse ViewPart and OSGI Declarative Services problem
- From: Neil Bartlett <njbartlett@xxxxxxxxx>
- Date: Tue, 2 Nov 2010 11:11:20 +0000
- Delivered-to: firstname.lastname@example.org
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=GyLKW1F2ipAY3WXMh8KtGr+hn+sHqUH5iys5to88Xi0eASAzurAR/MMx8mlg6hsS2v rdwk/zmivyPOfv8Oo8FZvgzu9ur0Jqbt+SZhtMpA9JPtAXa3HZcSlyOHzX33XM+hEjlT th4BKpmC8drXvaQ5qvRSkohyAfikgiMRP0D90=
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
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.
On Mon, Nov 1, 2010 at 9:17 PM, Richard Catlin
> 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.
> Richard Catlin
> equinox-dev mailing list