LifeCycleLock workaround for 1.1 M2 [message #75080] |
Thu, 21 February 2008 13:39 |
Eclipse User |
|
|
|
Originally posted by: benjamin.wolff.web.de
Hi!
i'm using the DialogPicker that Frank once posted in this newsgroup
(somehow the newsgroup search function is totally screwed up so i didn't
manage to get the link of the thread), it is the one from this demo:
http://rap.innoopract.com/rapdemo/rms (thx for that again, frank!).
the DialogPicker uses a LifeCycleLock an waited for the user to pick a
date button to return the selected date, here's snippet:
from the end of the open() method of the DatePickerDialog:
...
shell.open();
shell.setActive();
lock = DatePickerDialogHelper.createLock();
DatePickerDialogHelper.block( lock, shell );
return selectedDate;
}
when a date has been chosen the doClose() method of the DatePickerDialog
is called:
private void doClose() {
this.shell.close();
DatePickerDialogHelper.resume( lock );
}
here are the methods of the DatePickerDialogHelper Class
public static Object createLock() {
return new LifeCycleLock();
}
public static void block( final Object lock, final Shell shell ) {
LifeCycleControl.block( ( LifeCycleLock )lock );
}
public static void resume( final Object lock ) {
LifeCycleControl.resume( ( LifeCycleLock )lock );
}
i'm using this dialog pretty often in my app, so i wanted to ask how i can
work around this with the new readAndDispatch mechanism, i could find it
out myself, until now nothing worked.
someone has an idea? thx!!
greets
ben
|
|
|
Re: LifeCycleLock workaround for 1.1 M2 [message #75231 is a reply to message #75080] |
Fri, 22 February 2008 13:42 |
Eclipse User |
|
|
|
Originally posted by: benjamin.wolff.web.de
ok, i figured it out, i guess it just was too simple :PP
is simply added
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
before the return selectedDate; statement in the open() method, seems to
work :PP
thx anyway!
|
|
|
Powered by
FUDForum. Page generated in 0.04058 seconds