Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsre-using a composite
https://www.eclipse.org/forums/index.php/mv/msg/148456/467075/#msg_467075
I initially populate it during public void createContents(Composite
parent) and it appears.
When I get a selection event I want to clear out the composite and refill
it again. I have looked at examples but they all seem to use the same
widgets but just change their contents. In my case I cannot do that as the
first selection might require a combo and then a text wheras the next
might be the other way around.
What I don't want to do is go around orphaning widgets. I build my layout
on a new composite and add that to the parent composite so everything I
want to get rid of is on the single composite.
Can I just dispose the composite and create a new one on the parent?
Will disposing a composite manually also do the same to all its children?
Is it ok to manually dispose a composite while on a parent, does that
automatically remove it from the parents list of children ( I can't find a
removeChild(widget) method)
I have tried looking in the source but have not found anything that
answers these questions.
The dispose comments on widgets are a bit confusing as it says it disposes
all dependants (does not make it clear if direct descendants or not) but
then goes on to say it does not recursively call dependants so I am none
the wiser
Disposes of the operating system resources associated with
* the receiver and all its descendents. After this method has
* been invoked, the receiver and all descendents will answer
* <code>true</code> when sent the message <code>isDisposed()</code>.
* Any internal connections between the widgets in the tree will
* have been removed to facilitate garbage collection.
* <p>
* NOTE: This method is not called recursively on the descendents
* of the receiver. This means that, widget implementers can not
* detect when a widget is being disposed of by re-implementing
* this method, but should instead listen for the <code>Dispose</code>
* event.]]>Phill Perryman2006-01-24T14:41:40-00:00Re: re-using a composite
https://www.eclipse.org/forums/index.php/mv/msg/148456/467078/#msg_467078
children all the way down the parent heirarchy.
If the widgets can change back to the old configuration when the selection
changes again, you might want to consider keeping them around. In that case
you could use a StackLayout.
See the following article for an explanation of how disposing works:
<Phill_Perryman@Mitel.COM> wrote in message
news:dr5ebp$1ch$1@utils.eclipse.org...
>I have a composite (from a FormEditor section).
>
> I initially populate it during public void createContents(Composite
> parent) and it appears.
>
> When I get a selection event I want to clear out the composite and refill
> it again. I have looked at examples but they all seem to use the same
> widgets but just change their contents. In my case I cannot do that as the
> first selection might require a combo and then a text wheras the next
> might be the other way around.
>
> What I don't want to do is go around orphaning widgets. I build my layout
> on a new composite and add that to the parent composite so everything I
> want to get rid of is on the single composite.
>
> Can I just dispose the composite and create a new one on the parent?
>
> Will disposing a composite manually also do the same to all its children?
>
> Is it ok to manually dispose a composite while on a parent, does that
> automatically remove it from the parents list of children ( I can't find a
> removeChild(widget) method)
>
> I have tried looking in the source but have not found anything that
> answers these questions.
>
> The dispose comments on widgets are a bit confusing as it says it disposes
> all dependants (does not make it clear if direct descendants or not) but
> then goes on to say it does not recursively call dependants so I am none
> the wiser
>
> Disposes of the operating system resources associated with
> * the receiver and all its descendents. After this method has
> * been invoked, the receiver and all descendents will answer
> * <code>true</code> when sent the message <code>isDisposed()</code>.
> * Any internal connections between the widgets in the tree will
> * have been removed to facilitate garbage collection.
> * <p>
> * NOTE: This method is not called recursively on the descendents
> * of the receiver. This means that, widget implementers can not
> * detect when a widget is being disposed of by re-implementing
> * this method, but should instead listen for the <code>Dispose</code>
> * event.]]>Veronika Irvine2006-01-24T15:16:30-00:00Re: re-using a composite
https://www.eclipse.org/forums/index.php/mv/msg/148456/467087/#msg_467087
following code which produces the FormText field on creation but it all
goes blank on update (called by the selection changed event and I am
getting the correct selection event in debug).
I have cut everything out but a single widget to test the process. I have
tried all combinations of the layout in the update code with no effect, am
I just missing something basic.