Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Searching Trees(Performing a regex search of open TreeItems?)
Searching Trees [message #560004] Mon, 20 September 2010 16:50 Go to next message
Alexander Kidd is currently offline Alexander KiddFriend
Messages: 1
Registered: September 2010
Junior Member

I expected to be able to do something like this:

Matcher<Widget> customMatcher = WidgetMatcherFactory.withRegex("regex");
SWTBotTreeItem treeItem = new SWTBotTreeItem((TreeItem)bot.widget(customMatcher, headTreeItem);

But I get no results.
I'm trying to find a TreeItem that is already expanded and made visible by Eclipse as the test runs so the issue isn't that the item hasn't been loaded yet.

Is searching a tree using a matcher (any type of matcher) possible?
I noticed that there's no TreeResolver or TreeItemResolver in org.eclipse.swtbot.swt.finder.resolvers, is that what would be necessary for the matcher to work correctly on Trees?

Assuming I'm not doing it wrong and matchers for trees simply don't work with SWTBot then is there a recommended way to search trees without knowing the full path to the tree item? Just getting the getAllItems() list and looping through it?


[Updated on: Mon, 20 September 2010 16:50]

Report message to a moderator

Re: Searching Trees [message #623617 is a reply to message #560004] Wed, 22 September 2010 02:39 Go to previous message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Recursive tree searches for a particular item is quite possible and very trivial to implement.

Expanding tree items to look for a particular item could be a very expensive operation. Imaging expanding your project explorer view with hundreds of thousands of nodes to look for a particular node.

This is the reason why it's required that tree paths be as explicit as possible. I could see one possible middle ground for regular expressions to match a part of the tree.

This for e.g might match all methods beginning with 'is' in all classes inside org/foo/bar/*:

bot.tree('*', 'src', 'org', 'foo', 'bar', '*', 'is*')
Previous Topic:Send directly keyboard events
Next Topic:SWTBot has different behaviour depending if the window is top-most or not
Goto Forum:

Current Time: Tue Apr 24 14:52:21 GMT 2018

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

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