Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Display Class Dispose method
Display Class Dispose method [message #659664] Tue, 15 March 2011 01:38 Go to previous message
Dharam  is currently offline Dharam
Messages: 18
Registered: December 2010
Junior Member
Hi!!
I have created RenameDialog class by subclassing Dialog class as shown below. (necessary only)

public class RenameDialog extends Dialog{
protected RenameDialog(Shell parentShell) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.SHELL_TRIM);
}

protected void configureShell(Shell newShell)
{
super.configureShell(newShell);
newShell.setText("Rename Dialog");
newShell.setSize(500,150);
}

protected Control createDialogArea(Composite parent)
{}
}


When I am running this using code shown below, on closing of dialog, dialog disappears but disposing of display doesn't happen.

public class RenameDialogTest {

public static void main(String[] args) {
Display display=new Display();
Shell shell=new Shell(display,SWT.BORDER | SWT.TITLE);
RenameDialog dialog=new RenameDialog(shell);
if(dialog.open()==Window.OK)
System.out.println("OK");
while(!shell.isDisposed())
{
if(!display.readAndDispatch())
{
display.sleep();
}
}

display.dispose();
}

}


On above code if I remove, if(!display.readAndDispatch()){..}, it works fine. Could u please explain me the exact funda of this method?

Thanks
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Regarding TreeViewer
Next Topic:[databinding] JUnit tests, howto ?
Goto Forum:
  


Current Time: Fri May 24 20:16:31 EDT 2013

Powered by FUDForum. Page generated in 0.01687 seconds