Howto dispose an MWindow? [message #957846] |
Thu, 25 October 2012 10:42  |
Eclipse User |
|
|
|
I created a new Window by using the EModelService.
Now I want to close the associated shell.
How can I achieve this?
|
|
|
|
|
|
|
Re: Howto dispose an MWindow? [message #959107 is a reply to message #959066] |
Fri, 26 October 2012 09:01   |
Eclipse User |
|
|
|
So you are saying that toBeRendered(false) is only making the Shell
invisible (visible=false)? I would expect toBeRendered to dispose the
resource (=shell).
Remembering the current position makes sense, because the MWindow stays
part of the workbench model and so opens on the next time at the old
position. So if you also want to wipe it from the model you need to
remove it from there manually!
IMHO toBeRendered=false should (and does) dispose the underlying shell.
Tom
Am 26.10.12 14:31, schrieb Alex Kipling:
> The difference is in different window behaviour:
>
> When I use toBeRendered(false), then the Windows remembers its last
> position, when it reapears.
> It won't happen, when closing Windows by the shell-close-button.
>
>
> The other difference is in code:
> When I close the Window by the ShellButton, the shell is disposed, so I
> have to restructure my code, to recreate the Window, when it should
> reapear.
>
> The toBeRendered(false) doesnt dispose teh window, so I doesnt't have to
> recreate the Window on toBeRendered(false).
|
|
|
|
Re: Howto dispose an MWindow? [message #959291 is a reply to message #959229] |
Fri, 26 October 2012 11:47  |
Eclipse User |
|
|
|
Yes as I said the model element of course is not remove at all but the
SWT-Control is disposed!
I think we here have a misunderstanding on what dispose means. In my
think you can only dispose SWT-Resources and not Model-Objects.
Model-Objects are not disposed but if not needed any more they are
simply removed from the Application Model.
Setting toBeRendered=true:
* does dispose the native resource (SWT-Shell)
* does not remove the model element from the application model
=> if you want to have your additional window to get remove completley
you need to remove it also from the model by calling
((MElementContainer)window.eContainer()).getChildren().remove(window)
Tom
Am 26.10.12 16:59, schrieb Alex Kipling:
> I keep a pointer to the Window, and a MWindow still exists, after doing
> "toBeRendered(false)".
>
> I do not know, if the undelying shell still exists, but I guess so.
>
> I guess so, because of the following effect:
> When doing "toBeRendered(false); toBeRendered(true)" - the MWindow
> disapears and reapears without any problems.
> When doing "push-close-button; toBeRendered(true)" - the MWindow
> disapears and do not reapears. The MWindow still exists, so I guess that
> the underlying shell is disposed.
>
>
> because when I close the MWindow-Shell by pushing the close
> Shell-Close-button the
|
|
|
Powered by
FUDForum. Page generated in 0.07270 seconds