Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » findControls()(Find tree in the view)
findControls() [message #501315] Tue, 01 December 2009 20:18 Go to next message
Seema  is currently offline Seema
Messages: 14
Registered: December 2009
Junior Member
Hi,

I'm new to SWTBot. I cannot find ClassMatcher in SWTBot 2.0. Someone mentioned that the ClassMatcher is now replaced by the api widgetOfType(class). But, I don't find this either. I find the findControls() method takes in parameter Matcher<T> matcher. But I'm not sure
how to use it fo find the tree in my selected view.

I want to find the controls in the selected view.
I'm trying to use it the following way:
SWTBotView view = bot.activeView();

List controls = new ChildrenControlFinder(view.getWidget()).findControls(Matcher <Tree> (Tree.class));//which I know is wrong

Can someone please correct me ?

Thanks.
Re: findControls() [message #501326 is a reply to message #501315] Tue, 01 December 2009 21:00 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
Seema wrote:
> Hi,
>
> I'm new to SWTBot. I cannot find ClassMatcher in SWTBot 2.0. Someone
> mentioned that the ClassMatcher is now replaced by the api
> widgetOfType(class). But, I don't find this either.

widgetOfType(Class) is a static method found in WidgetMatcherFactory. To
easily find the other methods in this class (and others), you can
activate a simple preferences:
Window > Preferences > SWTBot Preferences and check the single check box.

>
> I want to find the controls in the selected view.
> I'm trying to use it the following way:
> SWTBotView view = bot.activeView();
>
> List controls = new
> ChildrenControlFinder(view.getWidget()).findControls(Matcher <Tree>
> (Tree.class));//which I know is wrong
>
> Can someone please correct me ?

The bot() method in SWTBotView is what you want. It returns a SWTBot
that search inside the view for widgets.

you can do this instead:
bot.activeView().bot().tree();

or, if you want them all in the view:
bot.activeView().bot().widget(widgetOfType(Tree.class));
with this addition in your imports:
import static
org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory. widgetOfType;

Hope this helps.
--
Pascal GĂ©linas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: findControls() [message #501458 is a reply to message #501326] Wed, 02 December 2009 12:56 Go to previous message
Seema  is currently offline Seema
Messages: 14
Registered: December 2009
Junior Member
Thanks for the reply and help !!
Previous Topic:Keyboard layout not available when using typeText
Next Topic:Help in SWTBot
Goto Forum:
  


Current Time: Sun Sep 21 22:19:03 GMT 2014

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

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