Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Getting the Eclipse Context for DI
Getting the Eclipse Context for DI [message #580851] Mon, 16 August 2010 20:22 Go to next message
U. Geerds is currently offline U. GeerdsFriend
Messages: 10
Registered: July 2010
Junior Member
Hi anybody,

I'm trying to use @Inject values with the ContextInjectionFactory.make(MyClass.class, context). To do this, i need the correct EclipseContext. If the class who calls ContextInjectionFactory.make or .inject, has a injected EclipseContext from the E4, it works fine.

What is right way, to get the EclipseContext from a POJO who isn't created from the E4 and hasn't a injected Context and resides at another Plug-In? It is possible?

I played around with the EclipseContextFactory, who is described at the vogella articles, but i get always a empty or invalid EclipseContext.


Thanks a lot. Uwe
Re: Getting the Eclipse Context for DI [message #580885 is a reply to message #580851] Mon, 16 August 2010 20:59 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You can't. Who is creating the instance? In the end there always have to
be something was instatiated by the e4 platform and you need to pass
through the IEclipseContext from there.

Tom

Am 16.08.10 22:22, schrieb U. Geerds:
> Hi anybody,
>
> I'm trying to use @Inject values with the
> ContextInjectionFactory.make(MyClass.class, context). To do this, i need
> the correct EclipseContext. If the class who calls
> ContextInjectionFactory.make or .inject, has a injected EclipseContext
> from the E4, it works fine.
>
> What is right way, to get the EclipseContext from a POJO who isn't
> created from the E4 and hasn't a injected Context and resides at another
> Plug-In? It is possible?
>
> I played around with the EclipseContextFactory, who is described at the
> vogella articles, but i get always a empty or invalid EclipseContext.
>
>
> Thanks a lot. Uwe
Re: Getting the Eclipse Context for DI [message #580903 is a reply to message #580851] Tue, 17 August 2010 19:00 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

As Tom asks, "where are you?" :-)

The IEclipseContexts form a hierarchy, with an OSGi lookup context and
the application context at the top. Every other context is created as a
child of the application context. For a given IEclipseContext, it
should be able to create one using createChild(*), no?

Are you controlling your entire IEclipseContext hierarchy (and the
services available) for your own use of DI, or are you trying to operate
within an E4 application?

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:Getting the Eclipse Context for DI
Next Topic:Using XWT Views with Riena
Goto Forum:
  


Current Time: Thu Apr 18 05:22:27 GMT 2024

Powered by FUDForum. Page generated in 0.02500 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top