What should a view to dispose? [message #265492] |
Thu, 05 August 2004 05:37  |
Eclipse User |
|
|
|
Originally posted by: jw.jwi.de
The SWT: The Standard Widget Toolkit PART 2: Managing Operating System
Resources ( http://www.eclipse.org/articles/swt-design-2/swt-design-2.ht ml)
article tells about about the need to dispose resources:
1) If you created it, you dispose it (if you didn't create it, don't
dispose it).
2) Disposing the parent disposes the children.
So, 2) should mean, that in a view you never have to dispose any widgets,
because all widgets have the view as parent and Eclipse disposes the view.
The only resources left (1) to dispose are Colors and Fonts.
Is that right?
Thanks,
Juergen
|
|
|
Re: What should a view to dispose? [message #265503 is a reply to message #265492] |
Thu, 05 August 2004 06:02  |
Eclipse User |
|
|
|
Juergen Weber schrieb:
> So, 2) should mean, that in a view you never have to dispose any widgets,
> because all widgets have the view as parent and Eclipse disposes the view.
Yes. See http://www.eclipse.org/articles/viewArticle/ViewArticle2.htm l
There you find:
....
When the view is closed the lifecycle is completed.
1. The parent Composite passed to createPartControl is disposed.
This children are also implicitly disposed. If you wish to run any code
at this time, you must hook the control dispose event.
2. The IViewPart.dispose method is called to terminate the part
lifecycle. This is the last method which the workbench will call on the
part. It is an ideal time to release any fonts, images, etc.
....
> The only resources left (1) to dispose are Colors and Fonts.
Images? And maybe still other things...
Ciao, Michael.
|
|
|
Powered by
FUDForum. Page generated in 0.04761 seconds