Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Runnable asynExec
Runnable asynExec [message #461569] Fri, 12 January 2007 15:22 Go to next message
Marc is currently offline MarcFriend
Messages: 9
Registered: July 2009
Junior Member
Is there beside the busyIndicator any difference in the way these
runnables are executed in a RCP application ?

getSite().getShell().getDisplay().asyncExec(new Runnable() {
public void run() {
treeViewer.refresh();
}
});



BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
treeViewer.refresh();
}
});
Re: Runnable asynExec [message #461571 is a reply to message #461569] Fri, 12 January 2007 15:47 Go to previous messageGo to next message
Carsten Spieker is currently offline Carsten SpiekerFriend
Messages: 197
Registered: July 2009
Senior Member
Hi,

usually you use the asyncExec in this context

PlatformUI.getWorkbench().getDisplay.asyncExec(*);

in order to execute some code in the UI Thread.
Maybe you read some data or so in another thread and you want to update some
GUI elements,
then you have to use the asyncExec(*) or the syncExec(*) to get access to
the main UI thread, as far as I know.

Greetz,
Carsten


"pigna" <pijnmar@hotmail.com> schrieb im Newsbeitrag
news:598d1f7011e2020a69c29174d1b8cc83$1@www.eclipse.org...
> Is there beside the busyIndicator any difference in the way these
> runnables are executed in a RCP application ?
>
> getSite().getShell().getDisplay().asyncExec(new Runnable() {
> public void run() {
> treeViewer.refresh();
> }
> });
>
>
> BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
> public void run() {
> treeViewer.refresh(); }
> });
Re: Runnable asynExec [message #461573 is a reply to message #461569] Fri, 12 January 2007 17:31 Go to previous messageGo to next message
Francis Upton IV is currently offline Francis Upton IVFriend
Messages: 472
Registered: July 2009
Location: Oakland, CA
Senior Member
Yes, a big difference:

pigna wrote:
> Is there beside the busyIndicator any difference in the way these
> runnables are executed in a RCP application ?
>

This one is executed asynchronously on the display thread. If you are
currently on the display thread, then the execution is deferred until
the main event loop is re-entered.

> getSite().getShell().getDisplay().asyncExec(new Runnable() {
> public void run() {
> treeViewer.refresh();
> }
> });
>
>

This is executed synchronously (it uses Display.syncExec(), meaning it
will run as if you had no wrapper.


> BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
> public void run() {
> treeViewer.refresh(); }
> });


Re: Runnable asynExec [message #461620 is a reply to message #461573] Sat, 13 January 2007 21:30 Go to previous message
Marc is currently offline MarcFriend
Messages: 9
Registered: July 2009
Junior Member
Thank you both for your answers. Learning every day :-)

So if I'm correct if you a scenario where three viewers need simultaneous
update one should go for solution one. Or is there even a better way?

The asyncExec does not change cursor to wait as seconds example did. How
can I achieve same behaviour cursor wise?
Previous Topic:[Newbie] View notification
Next Topic:removing annoying coolbar actionsets
Goto Forum:
  


Current Time: Thu Apr 25 00:48:28 GMT 2024

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

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

Back to the top