Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Listening for Activation of new childcontext?(Is it possible to listen for activation of new child contexs?)
Listening for Activation of new childcontext? [message #1425393] Wed, 17 September 2014 08:41 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
GIven a hierarchy of COntexts

ContextParent
- ContextChild1
- ContextChild2
- ContextChild3
- ContextChild4

Can I somehow listen, whether a new Child of "ContextParent" was activated?
Re: Listening for Activation of new childcontext? [message #1425399 is a reply to message #1425393] Wed, 17 September 2014 08:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6587
Registered: July 2009
Senior Member
I'm not 100% sure but @Active might give you this information, let's
suppose you have a class ContextTracker create on ContextParent then you
should get the current active context maybe through

@Inject
public void contextSwitched(@Active IEclipseContext c) {
// ...
}

if the above does not work the only chance I see is that in each
child-context you store the context itself e.g. in the key
"my_active_child" and then the above looks like

@Inject
public void contextSwitched(@Active @Named("my_active_child")
IEclipseContext c) {
// ...
}

For a short intro to @Active look at
http://tomsondev.bestsolution.at/2013/01/30/active-in-e4/

Tom


On 17.09.14 10:41, Alex Kipling wrote:
> GIven a hierarchy of COntexts
>
> ContextParent
> - ContextChild1
> - ContextChild2
> - ContextChild3
> - ContextChild4
>
> Can I somehow listen, whether a new Child of "ContextParent" was activated?
Re: Listening for Activation of new childcontext? [message #1426318 is a reply to message #1425399] Thu, 18 September 2014 15:06 Go to previous message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Thnx Thomas!
I solved it by tracking a concrete Object in Active context,
because I wished t omodify the context.

On modification the context is reinjected, which caused an infinite loop.

The method with a special (@Named Object ) worked too!

void trackActivePageInitializer(@Optional @Active IEditorPageInitializer editorPageInitializer) {
Previous Topic:Problem with Property page
Next Topic:Adding my own pseudo classes to e4 CSS support?
Goto Forum:
  


Current Time: Wed Mar 03 09:22:33 GMT 2021

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

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

Back to the top