Skip to main content



      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 07:19 Go to next message
Eclipse UserFriend
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 03:31 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 00:30:19 EDT 2025

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

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

Back to the top