Skip to main content

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

Hi!

Another dependency-injection approach is Spring.  Martin Libbert provided a way to bridge extension points w/ spring beans.  See his blog at:
* http://martinlippert.blogspot.com/2008/05/dependency-injection-for-extensions.html

The bridge that I built some time ago is now located at:

http://github.com/martinlippert/spring-extension-factory

Cheers,
-Martin





-----Original Message-----
From: equinox-dev-bounces@xxxxxxxxxxx [mailto:equinox-dev-bounces@xxxxxxxxxxx] On Behalf Of Neil Bartlett
Sent: Tuesday, November 02, 2010 7:11 AM
To: Equinox development mailing list
Subject: Re: [equinox-dev] Eclipse ViewPart and OSGI Declarative Servicesproblem

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


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top