Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Thread problem
Thread problem [message #444108] Thu, 09 February 2006 14:31 Go to next message
Eclipse UserFriend
I am using a seperate thread for getting data from database and updating
a UI component. I am running the thread using Display asyncExec method so
hopefully it will let me do other work while the thread is running in the
background. However while the thread is running it still give me busy
hourglass signal. I thought asyncExec method will let me free to do other
stuff while it's getting the data in the background. How do I get data in
the background while it allows me to do other stuff on the gui? Please
help!

I have following code:

public static Runnable t1;
private static Category[] cArr = null;
private static Category root = null;

t1 = new Runnable() {
public void run() {
cArr = CategoriesClient.getRootCategories(1,1);
root = new Category();
root.setChildren(cArr);
TreeModelManager.setRootCategory(root);
IWorkbenchWindow window =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IViewPart part =
window.getActivePage().findView("com.worldpac.pde.views.CategoryView ");
if (part != null && part instanceof CategoryView){
CategoryView cv= (CategoryView)part;
cv.initializeSession();
}
}
};
Display.getCurrent().asyncExec(t1);



Thanks,

Dhiresh
Re: Thread problem [message #444109 is a reply to message #444108] Thu, 09 February 2006 14:38 Go to previous messageGo to next message
Eclipse UserFriend
Actually, it works the other way ... you need to spawn a Thread or a Job
from the UI thread to do the work ... either with Thread#start() or
Job#schedule().

In your Job, you can use syncExec(*) or asyncExec(*) to update the GUI
.... the *syncExec(*) methods don't create a separate thread, they're run
in the UI thread when it gets a chance :-)

Later,
PW
Re: Thread problem [message #444110 is a reply to message #444109] Thu, 09 February 2006 16:04 Go to previous message
Eclipse UserFriend
Thank you very much for your answer- I used an automatically triggered job
to get my data and then used Display asyncExec from it to update GUI and
it works.
Previous Topic:Exceptions at startup of application
Next Topic:[DataBinding] Binding Text Vs Label
Goto Forum:
  


Current Time: Sun Jul 06 05:45:56 EDT 2025

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

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

Back to the top