Select Tree Items Problem [message #484807] |
Wed, 09 September 2009 08:11  |
Eclipse User |
|
|
|
Hallo,
In my RCP program, I use the desktop tree as the main folder to save the
other created folders. These folders are created automatically in the
SWTBot test cases before. But it seems that SWTBot can not select these
folder, although I have expanded desktop tree.
SWTBotTreeItem[] desktopItems = desktopTree.getAllItems();
for(SWTBotTreeItem tempItem:desktopItems){
String itemString=tempItem.getText();
System.out.println("The items in desktop are "+ itemString);
}
I have checked the items of the tree. The output items are only "Desktop"??
I guess, the tree is dynamically adding, not before defined. Or else?
|
|
|
Re: Select Tree Items Problem [message #484824 is a reply to message #484807] |
Wed, 09 September 2009 09:03  |
Eclipse User |
|
|
|
Jie Xiao wrote:
> Hallo,
> In my RCP program, I use the desktop tree as the main folder to save the
> other created folders. These folders are created automatically in the
> SWTBot test cases before. But it seems that SWTBot can not select these
> folder, although I have expanded desktop tree.
> SWTBotTreeItem[] desktopItems = desktopTree.getAllItems();
> for(SWTBotTreeItem tempItem:desktopItems){
> String itemString=tempItem.getText();
> System.out.println("The items in desktop are "+ itemString);
> }
>
> I have checked the items of the tree. The output items are only "Desktop"??
> I guess, the tree is dynamically adding, not before defined. Or else?
>
the SWTBotTree#getAllItems() only returns the top-level items, and not
sub-items of those. For exemple, if you have:
foo
-foobar
bar
-barfoo
the method will only return foo and bar, and not the second level elements.
Seeing this, I got the idea that we might want an API to get all items
up to a certain depth, something like SWTBotTree#items(int depth) (and
change the naming of getAllItems() to items()). We could then define a
constant DEPTH_INFINITE that could be passed to the items(int) method
which would get all the items in the tree.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
|
|
|
Powered by
FUDForum. Page generated in 0.25087 seconds