Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 249630 - IRunnableWithProgress in WorkbenchAdvisor does not show dialog
Summary: IRunnableWithProgress in WorkbenchAdvisor does not show dialog
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: Workbench (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 1.2 M7   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-03 12:58 EDT by Scott Warner CLA
Modified: 2009-05-12 11:12 EDT (History)
3 users (show)

See Also:


Attachments
Small project that demonstrates the bug. (12.23 KB, application/zip)
2008-10-03 13:00 EDT, Scott Warner CLA
no flags Details
Fix (853 bytes, patch)
2009-02-20 17:34 EST, Vasko Tchoumatchenko CLA
ruediger.herrmann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Warner CLA 2008-10-03 12:58:48 EDT
An IRunnable in the WorkbenchAdvisor#initialize method does not show the dialog, however it does show in RCP.  I have attached a project demonstrating the bug RAP single sourced with the RCP implementation that does work.  See the ApplicationWorkbenchWindowAdvisor class in the rap.bugs project and rap.bugs package.
Comment 1 Scott Warner CLA 2008-10-03 13:00:07 EDT
Created attachment 114210 [details]
Small project that demonstrates the bug.
Comment 2 Vasko Tchoumatchenko CLA 2009-02-20 17:34:55 EST
Created attachment 126355 [details]
Fix

Background:
For the ProgressMonitorDialog to work in RAP, the UICallBack should be enabled when the IRunnableWithProgress is executed. 

The runnable passed to ProgressMonitorDialog#run method is executed in a separate thread, depending on the value of the fork argument. If the runnable is to be executed in a separate thread, then the ModalContext#run method crates a new ModalContextThread which activates the UICallBack and the progress dialog is correctly shown.

The problem:
At such early stage (when ApplicationWorkbenchAdvisor#initialize is called), the Workbench disallow running the IRunnableWithProgress in a separate thread by calling ModalContext.setAllowReadAndDispatch(false). Since UICallBack is enabled only if the runnable is run in the ModalContextThread, this effectively prevents the progress dialog from being shown on the screen.

The solution (?)
The attached patch works by commenting out the call to    ModalContext.setAllowReadAndDispatch(false) in the Workbwench code. It solves the problem at hand and looks harmless enough, but I'm not 100% sure that the modification in completely benign.
Comment 3 Rüdiger Herrmann CLA 2009-04-02 06:40:00 EDT
Committed patch as described in comment #2