ModalContext fork problems in application startup [message #466477] |
Thu, 19 April 2007 22:08 |
Camilo Arango Messages: 15 Registered: July 2009 |
Junior Member |
|
|
Hello,
I am building an RCP application that requires authentication. My authentication dialog has a progressBar implemented using ProgressMonitorPart. I want the progressBar to be in undefined state while I contact the server and perform the authentication in a background thread. I achieved this with the following code that is called in the login dialog:
<code>
ModalContext.run(loginOperation, true, progressMonitor, this.getShell().getDisplay());
}
</code>
The login operation performs all the necesary authentication:
<code>
try {
monitor.beginTask("Autenticando...", 1);
/* do some authentication stuff... */
} finally {
monitor.done();
}
</code>
It worked very well in Eclipse 3.2. I migrated the RCP runtime to 3.3M6 and the progressBar does not paing anymore.
Doing a little research I found out that the problem is caused because the <b>ModalContext is not doing the fork</b> and therefore the login process is running in the main thread. Apparently, this is caused because the dialog is opened in the initialization of the platform, namely, in the <b>postStartup()</b> of the <b>WorkbenchAdvisor</b>. If I open the dialog after using an action in a menu item, everything works as expected.
I temporarily fix the issue by opening the dialog in the eventLoopIdle(Display display) method, using a flag to ensure that it is opened only once.
I was wondering if anyone could help me out with this problem. Thanks in advance.
C.A.
|
|
|
Powered by
FUDForum. Page generated in 0.03539 seconds