When designer generates the code for an Application, it generates an open() method that does everything: creates the display, initializes the shell, and runs the message loop.
In my situation, I'm really using the Application like a Form Dialog, and I'd like a little more control. What would be ideal would be if there were a member that just created the shell.
So for example:
public class MyApplication
{
public void open()
{ Shell shell = createShell(new Display);
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
}
public Shell createShell(Display display)
{
// generated code to put controls in the Shell goes here...
}
}
(Now, I can do this myself, and it doesn't seem to trip the designer up... nice!)
Why do I want this functionality broken out? I should be able to create the dialog without running it. For example, I think a modeless dialog would not use the same dispatch code (would it?). Perhaps I'd want to pass a specific display rather than creating a new one. In my case, I need to be able to do some reflection on the shell to generate some other code I need.
So to have it automatically be able to split out the code, as some kind of a preference, would be nice. I have a lot of dialogs in my app...
Ken