Skip to main content



      Home
Home » Eclipse Projects » SWTBot » Select Tree Items Problem
Select Tree Items Problem [message #484807] Wed, 09 September 2009 08:11 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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.*
Previous Topic:Externalized Strings in SWTBot: best practices
Next Topic:SWTBot test case as Eclipse Product
Goto Forum:
  


Current Time: Mon Jun 23 00:23:53 EDT 2025

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

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

Back to the top