Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Runnable asynExec
Runnable asynExec [message #461569] Fri, 12 January 2007 10:22 Go to next message
Eclipse UserFriend
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 10:47 Go to previous messageGo to next message
Eclipse UserFriend
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 12:31 Go to previous messageGo to next message
Eclipse UserFriend
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 16:30 Go to previous message
Eclipse UserFriend
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: Mon Mar 17 01:08:03 EDT 2025

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

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

Back to the top