Community
Participate
Working Groups
All subclasses of Dialog that come with RWT run a nested event loop in their open() method. This makes them unusable from applications that use the threadless life cycle (see bug 344091). A callback should be introduced that notifies the application when the dialog was closed, like the sketch below shows: final FontDialog dialog = new FontDialog( parent, SWT.NONE ); dialog.open( new DialogCallback() { public void dialogClosed() { applyFont( dialog.getFontList() ); } } ); The challenge here is rather to find a way to provide the extra API that does not (or as least as possible) irritate users of the UI-threaded life cycle but is still as convenient as possible for users of the threadless lifefcyle.
Dialog now implements Adaptable. Dialog#getAdapter() returns an IDialogAdapter that can be used to open dialogs in a non-blocking way. In addition, I created preliminary API for application code to use this feature. org.eclipse.rwt.widgets.DialogUtil#open() can be used to open a given dialog without blocking and a DialogCallback can be supplied to be notified when the dialog was closed. Alternatively the API could offer an abstract class _NonBlockingDialog_ (or similar) that combines the open() method from DialogUtil with the dialogClosed() callback method from DialogCallback. abstract class NonBlockingDialog { NonBlockingDialog( Dialog dialog ) { // ... } void open() { // ... } abstract void dialogClosed( int returnCode ) } application code: NonBlockingDialog dialog = new NonBlockingDialog( fontDialog ) { void dialogClosed( int returnCode ) { // ... } } What do you think?