Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:05 Go to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
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.


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Fri, 07 May 2010 11:20]

Report message to a moderator

Re: Runting Long UIJobs with progress [message #532461 is a reply to message #532152] Mon, 10 May 2010 07:28 Go to previous messageGo to next message
Praveen  is currently offline Praveen Friend
Messages: 86
Registered: July 2009
Member
> 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 09:00 Go to previous message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
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???


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Mon, 10 May 2010 09:03]

Report message to a moderator

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


Current Time: Fri Aug 23 13:09:39 GMT 2019

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

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

Back to the top