Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » Howto dispose an MWindow?(Howto dispose an MWindow?)
Howto dispose an MWindow? [message #957846] Thu, 25 October 2012 10:42 Go to next message
Eclipse UserFriend
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 #958843 is a reply to message #957846] Fri, 26 October 2012 04:55 Go to previous messageGo to next message
Eclipse UserFriend
Simply set it's toBeRenderered to false. This will still leave the
window in the application model but so if you want to open it once more
simply set toBeRendered to true.

Tom

Am 25.10.12 16:42, schrieb Alex Kipling:
> 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 #958903 is a reply to message #958843] Fri, 26 October 2012 06:01 Go to previous messageGo to next message
Eclipse UserFriend
Thnx Tom, unfortunately this bahaviour differs from the behaviour,
when the close button the MWindow#s shell is clicked.

I would like to have teh same behaviour, in my methods, so is there a way to really dispose the MWindow?
Re: Howto dispose an MWindow? [message #958920 is a reply to message #958903] Fri, 26 October 2012 06:14 Go to previous messageGo to next message
Eclipse UserFriend
So what difference do you see when you simply set toBeRendered to false?

IIRC setting toBeRendered to false should be resulting in
IPresentationEngine#removeGUI().

So what difference do you see when closing through the shell-button you
miss with toBeRendered/removeGUI. Is it the check for vetoing the close
because of unsaved data, ... .

Tom

Am 26.10.12 12:01, schrieb Alex Kipling:
> Thnx Tom, unfortunately this bahaviour differs from the behaviour, when
> the close button the MWindow#s shell is clicked.
> I would like to have teh same behaviour, in my methods, so is there a
> way to really dispose the MWindow?
Re: Howto dispose an MWindow? [message #959066 is a reply to message #958920] Fri, 26 October 2012 08:31 Go to previous messageGo to next message
Eclipse UserFriend
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 #959107 is a reply to message #959066] Fri, 26 October 2012 09:01 Go to previous messageGo to next message
Eclipse UserFriend
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 #959229 is a reply to message #959107] Fri, 26 October 2012 10:59 Go to previous messageGo to next message
Eclipse UserFriend
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.

[Updated on: Fri, 26 October 2012 11:00] by Moderator

Re: Howto dispose an MWindow? [message #959291 is a reply to message #959229] Fri, 26 October 2012 11:47 Go to previous message
Eclipse UserFriend
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
Previous Topic:Handler does not execute
Next Topic:Events to Parts without Focus
Goto Forum:
  


Current Time: Fri Jul 04 05:52:03 EDT 2025

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

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

Back to the top