Concurrency problem in building TreeItem [message #460652] |
Fri, 02 September 2005 11:43 |
Eclipse User |
|
|
|
Originally posted by: murley.murley.murley
Hello, i have a question about concurrency in my gui application.
Left hand side have a many tree item, when select one of the tree item, the
right hand side will create about 50000 numbers of Tree Item.
But when creating the 50000 numbers of tree Item, the gui application become
un-responsive.
Here is my code for concurrency issue...
Thread t = new Thread(){
public void run(){
shell.getDisplay().asyncExec(new Runnable(){
public void run(){
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText("item " + i);
}
});
}
};
t.start();
is that i have something wrong?
thanks for help
|
|
|
updated code.. [message #460653 is a reply to message #460652] |
Fri, 02 September 2005 11:47 |
Eclipse User |
|
|
|
Originally posted by: murley.murley.murley
i have update the code like this...
Thread t = new Thread(){
public void run(){
for (int i = 0; i < 50000; i++){
shell.getDisplay().asyncExec(new Runnable(){
public void run(){
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText("item " + i);
}
});
}
}
};
t.start();
|
|
|
Re: updated code.. [message #460654 is a reply to message #460653] |
Fri, 02 September 2005 12:50 |
Eclipse User |
|
|
|
Originally posted by: ddana78ar.yahoo.com.ar
try to do that without making a thread. When you call "asyncExec" you are making a user thread.
May be like this:
for (int i = 0; i < 50000; i++){
shell.getDisplay().asyncExec(new Runnable(){
public void run(){
TreeItem item = new TreeItem(tree, SWT.NONE);
item.setText("item " + i);
}
});
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03432 seconds