Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » failed chaining of select(String)
failed chaining of select(String) [message #479382] Mon, 10 August 2009 19:33 Go to next message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 112
Registered: July 2009
Senior Member
I see that the code for select("String") forwarding the operation to code
that selects a group of nodes, but unfortunately doesn't return the single
selected item in this case as the SWTBotTreeItem, so it fails to chain in
the below example, while the getTreeItem("String") works as expected.

bot.tree().expandNode("C1").select("Debug").expand(); // fails to expand
Debug bot.tree().expandNode("C1").getTreeItem("Debug").expand(); // works
Re: failed chaining of select(String) [message #479389 is a reply to message #479382] Mon, 10 August 2009 20:26 Go to previous messageGo to next message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 112
Registered: July 2009
Senior Member
It appears that is the way it is designed to work, since its pop-up help
text indicates that it returns the current node (rather than a selected
node).

This is counterintuitive (at least to me). If I select something, I
expect to get what I selected. You can add this to a list of gotchas for
people who are starting out.
Re: failed chaining of select(String) [message #479438 is a reply to message #479389] Tue, 11 August 2009 05:15 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Hmm... Interesting problem. The #select() methods can also perform
multiple selection for trees that support it, in which case returning
the current node makes sense.

However I think it makes sense for swtbot to return the selected node if
there's only one argument passed in into the #select() methods ?

Thoughts, patches ;)

Cheers!

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr


On 11/8/09 01:56, Jay Norwood wrote:
> It appears that is the way it is designed to work, since its pop-up help
> text indicates that it returns the current node (rather than a selected
> node).
>
> This is counterintuitive (at least to me). If I select something, I
> expect to get what I selected. You can add this to a list of gotchas for
> people who are starting out.
>
>
>
Re: failed chaining of select(String) [message #479654 is a reply to message #479438] Tue, 11 August 2009 20:59 Go to previous message
Jay Norwood is currently offline Jay NorwoodFriend
Messages: 112
Registered: July 2009
Senior Member
I suppose getting back an array of selected objects would be the expected
thing for multiple selections, and getting back a single one would return
a single object, but then the functions would need different names.

Maybe someone had a reason for the operation to select two children
sequentially?

expandNode("a").select("a.1").select("a.2")


You have a second form selects both children at the same time while the
first version selects one, then selects the second and clears selection on
the first.

expandNode("a").select("a.1","a.2");

It isn't really clear to me what all the requirements are. If you are
trying to provide support for gui recording, perhaps there should be
available api to do the equivalent of the gui actions for ctrl-select and
shift-select.

select("a.1").shiftSelect("a.2");

and

select("a.1").ctrlSelect("a.2");
Previous Topic:Re: [swtbot-dev] Welcome Mariot Chauvin as a new technology.swtbot Committer
Next Topic:No getParent or getParentItem
Goto Forum:
  


Current Time: Mon Dec 22 05:49:54 GMT 2014

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

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