org.eclipse.swtbot.swt.finder.waits
Class Conditions

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.waits.Conditions
Direct Known Subclasses:
Conditions

public abstract class Conditions
extends Object

This is a factory class to create some conditions provided with SWTBot.

Version:
$Id$
Author:
Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>

Constructor Summary
Conditions()
           
 
Method Summary
static ICondition shellCloses(SWTBotShell shell)
          Gets the condition for checking if shells have closed.
static ICondition shellIsActive(String shellText)
          Gets the condition for checking if an awaited shell is visible and has focus
static ICondition tableHasRows(SWTBotTable table, int rowCount)
          Gets the condition for checking tables have the proper number of rows.
static ICondition treeHasRows(SWTBotTree tree, int rowCount)
          Gets the condition for checking trees have the proper number of rows.
static WaitForObjectCondition<MenuItem> waitForMenu(SWTBotShell shell, Matcher<MenuItem> matcher)
           
static WaitForObjectCondition<Shell> waitForShell(Matcher<Shell> matcher)
           
static WaitForObjectCondition<Shell> waitForShell(Matcher<Shell> matcher, Shell parent)
           
static
<T extends Widget>
WaitForObjectCondition<T>
waitForWidget(Matcher<T> matcher)
           
static
<T extends Widget>
WaitForObjectCondition<T>
waitForWidget(Matcher<T> matcher, Widget parent)
           
static ICondition widgetIsEnabled(AbstractSWTBot<? extends Widget> widget)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Conditions

public Conditions()
Method Detail

tableHasRows

public static ICondition tableHasRows(SWTBotTable table,
                                      int rowCount)
Gets the condition for checking tables have the proper number of rows. Useful in cases where the table is populated continuously from a non UI thread.

Parameters:
table - the table
rowCount - the number of rows that the table must have, in order for ICondition.test() to evaluate to true.
Returns:
true if the table has the number of rows specified. Otherwise false.
Throws:
IllegalArgumentException - Thrown if the row count is less then 1.
Since:
1.2

treeHasRows

public static ICondition treeHasRows(SWTBotTree tree,
                                     int rowCount)
Gets the condition for checking trees have the proper number of rows. Useful in cases where the tree is populated continuously from a non UI thread.

Parameters:
tree - the tree
rowCount - the number of rows that the tree must have, in order for ICondition.test() to evaluate to true.
Returns:
true if the tree has the number of rows specified. Otherwise false.
Throws:
IllegalArgumentException - Thrown if the row count is less then 1.
Since:
2.0

shellCloses

public static ICondition shellCloses(SWTBotShell shell)
Gets the condition for checking if shells have closed. Useful in cases where a shell takes long to close.

Parameters:
shell - the shell to monitor.
Returns:
a condition that evaluates to false until the shell is closed or invisible.
Since:
1.2

shellIsActive

public static ICondition shellIsActive(String shellText)
Gets the condition for checking if an awaited shell is visible and has focus

Parameters:
shellText - the text of the shell.
Returns:
a condition that evaluates to false until the shell is visible and has focus.
Since:
1.3

waitForWidget

public static <T extends Widget> WaitForObjectCondition<T> waitForWidget(Matcher<T> matcher)
Parameters:
matcher - a matcher.
Returns:
a condition that waits until the matcher evaluates to true.
Since:
2.0

waitForWidget

public static <T extends Widget> WaitForObjectCondition<T> waitForWidget(Matcher<T> matcher,
                                                                         Widget parent)
Parameters:
matcher - a matcher.
parent - the parent under which a widget will be found.
Returns:
a condition that waits until the matcher evaluates to true.
Since:
2.0

waitForShell

public static WaitForObjectCondition<Shell> waitForShell(Matcher<Shell> matcher)
Parameters:
matcher - the matcher.
Returns:
a condition that waits until the matcher evaluates to true.
Since:
2.0

waitForShell

public static WaitForObjectCondition<Shell> waitForShell(Matcher<Shell> matcher,
                                                         Shell parent)
Parameters:
matcher - the matcher.
parent - the parent under which a shell will be found or null to search all shells.
Returns:
a condition that waits until the matcher evaluates to true.
Since:
2.0

waitForMenu

public static WaitForObjectCondition<MenuItem> waitForMenu(SWTBotShell shell,
                                                           Matcher<MenuItem> matcher)
Parameters:
shell - the shell to search for the menu.
matcher - the matcher.
Returns:
a condition that waits until the matcher evaluates to true.
Since:
2.0

widgetIsEnabled

public static ICondition widgetIsEnabled(AbstractSWTBot<? extends Widget> widget)
Parameters:
widget - the widget
Returns:
a condition that waits until the widget is enabled.
Since:
2.0