Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Concurrency problem in building TreeItem
Concurrency problem in building TreeItem [message #460652] Fri, 02 September 2005 11:43 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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);
}
});
}
Re: updated code.. [message #460655 is a reply to message #460654] Fri, 02 September 2005 12:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ddana78ar.yahoo.com.ar

ohh... I forget, see that link:
http://help.eclipse.org/help30/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/swt_threading.htm
DD
Re: updated code.. [message #460745 is a reply to message #460653] Tue, 06 September 2005 16:25 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Your updated code gives me reasonable performance while the Tree is
populating (win32), though this does take a while to finish.

The good news is that VIRTUAL is planned to become a supported style on Tree
for 3.2M2 (see
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/R3_2/plan.html )
, so you'll soon be able to just create items on an as-needed basis like in
Table.

Grant

"murley" <murley@murley.murley> wrote in message
news:df9e4h$cr1$1@news.eclipse.org...
> 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();
>
>
>
Previous Topic:Does anybody know an Implementation for using DirectShow in SWT
Next Topic:CCombo issues...
Goto Forum:
  


Current Time: Sat Sep 21 20:01:13 GMT 2019

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

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

Back to the top