Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBotTreeItem#select() is not working as it should?
SWTBotTreeItem#select() is not working as it should? [message #805165] Thu, 23 February 2012 12:19 Go to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 335
Registered: July 2009
Senior Member

I found SWTBotTreeItem#select() to not work as I would expect.
With a tree like this:
+ project
|- file
where the 'project' item is initially collapsed.

This code snippet doesn't select the 'file' item:
tree.expandNode( "project" );
SWTBotTreeItem fileItem = "file" );
assertEquals( "file", fileItem.getText() );
After it is executed, the projectItem is expanded and selected, hence
the assertion fails with: expected 'file' but was 'project'.

Where as this code succeeds in selecting the 'file' item:
SWTBotTreeItem projectItem = tree.expandNode( "project" );
SWTBotTreeItem fileItem = projectItem.getNode( "file" ).select();
assertEquals( "file", fileItem.getText() );

Is this a bug? Am I missing something?

Thanks in advance,
Rüdiger Herrmann
Re: SWTBotTreeItem#select() is not working as it should? [message #821313 is a reply to message #805165] Thu, 15 March 2012 07:31 Go to previous message
benhu Missing name is currently offline benhu Missing nameFriend
Messages: 14
Registered: October 2010
Junior Member

I donot think this is a bug.
In my opinion,

what【 "file" );】selects is a TreeItem with the name "file", but the node "file" itself isn't selected.
so, you should make the node is selected first, then use to select the node(s), and return as TreeItem.

hope this can help you.
Previous Topic:Issue in waiting for tree expansion
Next Topic:Drag&Drop SWTBotTreeItem to SWTBotGefEditor
Goto Forum:

Current Time: Tue May 22 16:03:03 GMT 2018

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

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

Back to the top