Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Running Long UIJobs with progress(is this the solution?)
Running Long UIJobs with progress(is this the solution?) [message #532152] Fri, 07 May 2010 07:05 Go to next message
Eclipse UserFriend
Hi,

I have a utility which exports Table/Tree content to HTML with all its labels and icons.

Since this involves accessing GUI elements,this export hangs the GUI.

I tryed to put the whole process in a UIJOB,syncexec etc
but the progress dialog was not able to show up.

Hence in the loop where each Table/Tree item is processed i added the code
Display.getcurrent().readAndDispatch();

this solved the problem and the progress monitor dialog got updated properly.

Is this correct?
Are there any side effects???

Thanks in advance for your replys.

[Updated on: Fri, 07 May 2010 07:20] by Moderator

Re: Runting Long UIJobs with progress [message #532461 is a reply to message #532152] Mon, 10 May 2010 03:28 Go to previous messageGo to next message
Eclipse UserFriend
> Display.getcurrent().readAndDispatch();
> this solved the problem and the progress monitor dialog got updated
> properly.
>
> Is this correct?
> Are there any side effects???
Personally, I would not recommend this approach for updating the
progress monitor accurately. UI Thread is always responsible for reading
and dispatching the events from eventQ. However, it is served whenever
it gets an empty slot. So, it is important to get the UI thread an empty
slot instead of application repeatedly calling readAndDispatch() method.
This would be an extra overhead to the application, as there is already
UI thread doing the same processing for you.
Re: Runting Long UIJobs with progress [message #532489 is a reply to message #532461] Mon, 10 May 2010 05:00 Go to previous message
Eclipse UserFriend
Any SWT Application or RCP application has this loop

while (!shell.isDisposed())
{
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();

Since we are doing a long loop on display thread its not able to read and dispatch ,hence what if we do it in between loops for such situations...

For that matter a UIJob does not make sence appart from running the task in ui thread it servers no pupose of a job(progress,manage etc)

Also what if there is setuation where you have to do a long job on ui,should we leave the UI blank and un responsive???

[Updated on: Mon, 10 May 2010 05:03] by Moderator

Previous Topic:JavaDoc Typo
Next Topic:Scroll within a tableItem
Goto Forum:
  


Current Time: Wed Jul 23 11:05:21 EDT 2025

Powered by FUDForum. Page generated in 0.03428 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top