Empty Window after second call [message #1841219] |
Thu, 06 May 2021 19:17 |
Ralf Heydenreich Messages: 235 Registered: July 2009 |
Senior Member |
|
|
Hi all,
I've created a dialog with a MWindow. There I placed a "close" button which closes the dialog (at least I think it's closed since it isn't visible ;-) ):
cancelButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MUIElement myAppDialog = modelService.find("org.my.project", application);
myAppDialog.setVisible(false);
}
});
Now, if I use this button I can re-open the dialog once again. But if I close the dialog via the red cross, the dialog stays empty after re-opening. What's wrong with this? I've tried to implement a PreDestroy handler, but this didn't solve the problem.
@PreDestroy
public void closeWindow() {
MUIElement myAppDialog = modelService.find("org.my.project", application);
myAppDialog.setVisible(false);
myAppDialog.setToBeRendered(false);
}
Any hints are welcome.
Regards,
Ralf.
[Updated on: Thu, 06 May 2021 19:18] Report message to a moderator
|
|
|
Re: Empty Window after second call [message #1841229 is a reply to message #1841219] |
Fri, 07 May 2021 07:02 |
Rolf Theunissen Messages: 260 Registered: April 2012 |
Senior Member |
|
|
The same question has been asked before, with a kind of workaround as answer: https://www.eclipse.org/forums/index.php/t/1083038/
I haven't used dialog mwindows like this, though I can imagine two causes. Fist, a (dialog) mwindow will show when it is both toBeRendered and visible.
When a mwindow is showed (it was rendered), and then visibility is changed to false, the mwindow is hidden. That is, the shell.setVisible(false) is called on the shell of the mwindow, the shell is not disposed.
When the X is used to close the window, shell.close() is called. A listener is installed that marks the window toBeRendered=false, so in the end the Shell is disposed.
When programmatically opening the mwindow, you should be calling setToBeRendered(true) to ensure that it is rendered. Also make sure to unrender the mwindow when programmatically closing it, otherwise you are keeping resources allocated.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02864 seconds