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
Hi,

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 = projectItem.select( "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

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

what【projectItem.select( "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 tree.select(...) 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: Thu Mar 28 23:01:49 GMT 2024

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

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

Back to the top