Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [e4-dev] How should clients be expected to dispose of IEclipseContext instances?


Oleg, we just committed code yesterday that manages the life-cycle of any UIElement that has a context. The MContext will be created and set into the model element before it is rendered and removed /disposed when the element is taken down (i.e. in removeGui). Note that this ties the life-cycle of the MContext to that of the 'widget', if anybody knows of a scenario under which this would be an issue let us know.

As much as possible we'd like to keep the network of Context's out of mere mortals hands I think. Playing with this structure must be done with care, what happens if I have contexts C,D,E with parent B with parent A and dispose B ? Do C.D.E get re-injected with B's parent?

That being said I think we have to allow the creation/insertion of Contexts, just not *require* it.

Eric


From: Oleg Besedin/Ottawa/IBM@IBMCA
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>
Date: 10/20/2009 10:54 AM
Subject: Re: [e4-dev] How should clients be expected to dispose        of        IEclipseContext instances?
Sent by: e4-dev-bounces@xxxxxxxxxxx






I think this is a good point and something that we should look into. As a background, this was done, believe it or not, in the name of simplicity.


There are two roles when it comes to contexts: the contexts I created, and the contexts I got from somewhere else.


For the "contexts I created", it makes sense to be able to control the life cycle. However, for the contexts passed to the parts, I'd like to: a) make them as simple as possible, without any strange methods; and b) I would be unhappy if somebody actually disposed of my context.


>From a quick glance it seems that we can achieve this separation by having an extra interface IEclipseContextControl (inherits from IEclipseContext) with dispose and other "strange" methods to be returned by context factories. I opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=292766 for this.

Sincerely,

Oleg Besedin



From: Axel Rauschmayer <axel@xxxxxxxxxxx>
To: E4 Project developer mailing list <e4-dev@xxxxxxxxxxx>
Date: 10/20/2009 09:02 AM
Subject: Re: [e4-dev] How should clients be expected to dispose of        IEclipseContext instances?
Sent by: e4-dev-bounces@xxxxxxxxxxx






Commenting out of complete ignorance regarding the actual problem,  
but: I've never liked this kind of pattern, because it is hard to  
discover and easy to forget.

Is there a better way of handling life cycle stages? I would expect  
this kind of method to be always there, possibly with empty  
implementations.

Greetings,

Axel

On Oct 20, 2009, at 14:39 , Paul Webster wrote:

> If code creates a creates a context with EclipseContextFactory then
> they should  dispose  it when they're done with it.  i.e. in our
> model/renderer code we have to create and dispose the context.  We use
> the pattern with IDisposable (as you found :-)
>
> if (context implements IDisposable) {
>  ((IDisposable)context).dispose();
> }
>
> PW
>
> --
> Paul Webster
> Hi floor.  Make me a sammich! - GIR
> _______________________________________________
> e4-dev mailing list
> e4-dev@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/e4-dev
>

--
Axel.Rauschmayer@xxxxxxxxxx

http://www.pst.ifi.lmu.de/~rauschma/



_______________________________________________
e4-dev mailing list
e4-dev@xxxxxxxxxxx

https://dev.eclipse.org/mailman/listinfo/e4-dev

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



Back to the top