Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Eclipse 4 Context behaviour handling own @Creatable objects changed?
Eclipse 4 Context behaviour handling own @Creatable objects changed? [message #1729674] Sun, 17 April 2016 17:42 Go to next message
Stefan Häusler is currently offline Stefan HäuslerFriend
Messages: 23
Registered: May 2013
Junior Member
Hello all

we recently start evaluating switching from 4.5.0 to a 4.5.2 platform due to some waiting bugfixes. After doing this for our products, we observe some changes in the context how own objects annotated with @Creatable are created/reused for injection.

Lets assume we have a Wizard for which we also have a controller and a model. Both the controller and the model is annotated with @Creatable and injected into the wizard.
- We create the wizard with new Wizard()
- then using ContextInjectionFactory.inject

Before 4.5.2 it seems that the model was created each time team on injection. After going to 4.5.2, the first created object for @Creatable annotation is kept in the context and is reused when reopening the wizard what is a problem as the model still has state from previous session.

Is this intended? Is there some complete change log for the 4.5.2 where i can see the change explained? Are we doing something wrong here?

Actually we were already curious whether we do this correct in 4.5.0, as the context then starts to get bigger and bigger each time we reopened the wizard.

The use case here is actually, just to use the E4 Injection Framework for simple putting together the different objects. No need to hold references for the @Creatable. Of course the framework can not guess this, so the question was here already, what a pattern would be to work with the Context like this.

Maybe its more correct to annotate the wizard itself also with @Creatable and using constructor injection (maybe even a chid context that is disposed afterwards).

But i would like to understand the error here, because i start new things.

Thank you very much for an answer,
Stefan

[Updated on: Sun, 17 April 2016 18:54]

Report message to a moderator

Re: Eclipse 4 Context behaviour handling own @Creatable objects changed? [message #1729715 is a reply to message #1729674] Mon, 18 April 2016 12:31 Go to previous messageGo to next message
Eclipse UserFriend
I don't see any changes that seem relevant. Your classes aren't annotated with @Singleton, correct?

Put the following trace switch into a file (say debug.options):
org.eclipse.e4.core.di/debug/injector = true

And then launch your Eclipse instance with
-debug path/to/your/debug.options
and you should get a bit of debug output from the DI. Something may be helpful.

Since it seems your model object is being recorded in the context, put a breakpoint on EclipseContext#set() for when 'name' is your model class name, and see what turns up.
Re: Eclipse 4 Context behaviour handling own @Creatable objects changed? [message #1729748 is a reply to message #1729715] Mon, 18 April 2016 16:15 Go to previous messageGo to next message
Stefan Häusler is currently offline Stefan HäuslerFriend
Messages: 23
Registered: May 2013
Junior Member
Hello Brian,

thanks. Yes no @Singleton. We looked into it and its indeed not related to 4.5.2 switch. Nonetheless, our initial expectation is correct that @Creatable objects are not automatically added to the context right?

So it must have to do with the way we are calling it?
i.e. creating a new wizard in within a Handler class and then afterwards injecting objects with ContextInjectionFactory into the wizard...

we will have a look into the debug traces

Stefan
Re: Eclipse 4 Context behaviour handling own @Creatable objects changed? [message #1729749 is a reply to message #1729748] Mon, 18 April 2016 16:17 Go to previous message
Eclipse UserFriend
That's right: @Creatable objects aren't put into the context. It's not clear where in the context hierarchy they should be put.
Previous Topic:Editor - list unreadable after last update
Next Topic:Place dependency in window context
Goto Forum:
  


Current Time: Fri Mar 29 12:52:27 GMT 2024

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

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

Back to the top