new StatisticsDialog now replaces previous opened ones - no weird bugs with several windows appearing simultaneously

git-svn-id: https://ipscan.svn.sourceforge.net/svnroot/ipscan/trunk@268 375186e5-ef17-0410-b0b6-91563547dcda
This commit is contained in:
angryziber 2008-03-03 20:30:42 +00:00
parent aba7699eb6
commit ff7644f7ed
2 changed files with 9 additions and 4 deletions

View File

@ -46,13 +46,12 @@ public abstract class AbstractModalDialog {
// create a separate event loop
Display display = Display.getCurrent();
while (!shell.isDisposed()) {
while (shell != null && !shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
// destroy the window
shell.dispose();
// forget the reference to the shell (this class is reused in the container)
shell = null;
}
/**

View File

@ -54,6 +54,12 @@ public class StatisticsDialog extends AbstractModalDialog {
* This method initializes shell
*/
private void createShell() {
if (shell != null) {
// close the same window if it is already open ('scanning incomplete')
shell.close();
shell.dispose();
}
Display currentDisplay = Display.getCurrent();
Shell parent = currentDisplay.getShells()[0];
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);