Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Select Tree Items Problem
Select Tree Items Problem [message #484807] Wed, 09 September 2009 12:11 Go to next message
Jie Xiao is currently offline Jie XiaoFriend
Messages: 11
Registered: July 2009
Junior Member
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 13:03 Go to previous message
Pascal G is currently offline Pascal GFriend
Messages: 157
Registered: July 2009
Senior Member
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 Nov 24 12:38:37 GMT 2014

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

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