org.eclipse.swtbot.eclipse.gef.finder
Class SWTGefBot

java.lang.Object
  extended by org.eclipse.swtbot.swt.finder.SWTBot
      extended by org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot
          extended by org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot

public class SWTGefBot
extends SWTWorkbenchBot


Field Summary
static long DEFAULT_POLL_DELAY
          Deprecated. 
protected  Display display
          The display on which the bot operates on.
protected  Finder finder
          The finder used by the bot to find controls.
 
Constructor Summary
SWTGefBot()
           
 
Method Summary
 SWTBotShell activeShell()
          Gets the current active shell.
 boolean captureScreenshot(String fileName)
          Captures a screenshot to the given file name.
protected  SWTBotGefEditor createEditor(IEditorReference reference, SWTWorkbenchBot bot)
          Create the editor.
protected  SWTBotGefView createView(IViewReference reference, SWTWorkbenchBot bot)
          Create the view.
 SWTBotGefEditor gefEditor(String fileName)
          Attempts to locate the Gef editor matching the given name.
 SWTBotGefEditor gefEditor(String fileName, int index)
          Attempts to locate the editor matching the given name.
 SWTBotGefView gefView(String viewName)
          Attempts to locate the view matching the given name.
 SWTBotGefView gefView(String viewName, int index)
          Attempts to locate the view matching the given name.
 SWTBotGefViewer gefViewer(String partTitle)
          Attempts to locate a gef viewer that is embedded in a workbench part with the specified title.
 Display getDisplay()
          Gets the display
 Finder getFinder()
           
 Control getFocusedWidget()
          Returns the control which currently has keyboard focus, or null if keyboard events are not currently going to any of the controls built by the currently running application.
 SWTBotMenu menu(String text)
           
 SWTBotMenu menu(String text, int index)
           
 SWTBotMenu menu(SWTBotShell shell, Matcher<MenuItem> matcher, int index)
           
 SWTBotMenu menuWithId(String value)
           
 SWTBotMenu menuWithId(String value, int index)
           
 SWTBotMenu menuWithId(String key, String value)
           
 SWTBotMenu menuWithId(String key, String value, int index)
           
<T> T
performWithTimeout(Result<T> runnable, long timeout)
          Performs an operation with a timeout and return a result.
 void performWithTimeout(VoidResult runnable, long timeout)
           
 SWTBotShell shell(String text)
           
 SWTBotShell shell(String text, int index)
           
 SWTBotShell shell(String text, Shell parent)
           
 SWTBotShell shell(String text, Shell parent, int index)
           
 SWTBotShell[] shells()
          Gets the list of shells found in the display.
 List<Shell> shells(String text)
           
 List<Shell> shells(String text, Shell parent)
           
 SWTBotShell shellWithId(String value)
           
 SWTBotShell shellWithId(String value, int index)
           
 SWTBotShell shellWithId(String key, String value)
           
 SWTBotShell shellWithId(String key, String value, int index)
           
 void sleep(long millis)
          Sleeps for the given number of milliseconds.
protected  Tray systemTray()
           
 SWTBotTrayItem trayItem()
           
 SWTBotTrayItem trayItem(int index)
           
 List<SWTBotTrayItem> trayItems()
           
 List<SWTBotTrayItem> trayItems(Matcher<?> matcher)
           
 SWTBotTrayItem trayItemWithTooltip(String tooltip)
           
 SWTBotTrayItem trayItemWithTooltip(String tooltip, int index)
           
 void waitUntil(ICondition condition)
          Waits until a specified condition evaluates to true.
 void waitUntil(ICondition condition, long timeout)
          Waits until the timeout is reached or the condition is met.
 void waitUntil(ICondition condition, long timeout, long interval)
          Waits until the condition has been meet, or the timeout is reached.
 void waitUntilWidgetAppears(ICondition waitForWidget)
           
 void waitWhile(ICondition condition)
          Waits while the condition is true.
 void waitWhile(ICondition condition, long timeout)
          Waits while the condition is true, until the timeout is reached.
 void waitWhile(ICondition condition, long timeout, long interval)
          Waits while the condition is true, until the timeout is reached.
<T extends Widget>
T
widget(Matcher<T> matcher)
           
<T extends Widget>
T
widget(Matcher<T> matcher, int index)
           
<T extends Widget>
T
widget(Matcher<T> matcher, Widget parentWidget)
           
<T extends Widget>
T
widget(Matcher<T> matcher, Widget parentWidget, int index)
           
<T extends Widget>
List<? extends T>
widgets(Matcher<T> matcher)
           
<T extends Widget>
List<? extends T>
widgets(Matcher<T> matcher, Widget parentWidget)
           
 
Methods inherited from class org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot
activeEditor, activePerspective, activeView, closeAllEditors, closeAllShells, defaultPerspective, editor, editorById, editorByTitle, editors, editors, multipageEditor, multipageEditorById, multipageEditorByTitle, multipageEditors, multipageEditors, perspective, perspectiveById, perspectiveByLabel, perspectives, perspectives, resetActivePerspective, resetWorkbench, saveAllEditors, view, viewById, viewByTitle, views, views
 
Methods inherited from class org.eclipse.swtbot.swt.finder.SWTBot
arrowButton, arrowButton, arrowButtonInGroup, arrowButtonInGroup, arrowButtonWithId, arrowButtonWithId, arrowButtonWithId, arrowButtonWithId, arrowButtonWithLabel, arrowButtonWithLabel, arrowButtonWithLabelInGroup, arrowButtonWithLabelInGroup, arrowButtonWithTooltip, arrowButtonWithTooltip, arrowButtonWithTooltipInGroup, arrowButtonWithTooltipInGroup, browser, browser, browserInGroup, browserInGroup, browserWithId, browserWithId, browserWithId, browserWithId, browserWithLabel, browserWithLabel, browserWithLabelInGroup, browserWithLabelInGroup, button, button, button, button, buttonInGroup, buttonInGroup, buttonInGroup, buttonInGroup, buttonWithId, buttonWithId, buttonWithId, buttonWithId, buttonWithLabel, buttonWithLabel, buttonWithLabelInGroup, buttonWithLabelInGroup, buttonWithTooltip, buttonWithTooltip, buttonWithTooltipInGroup, buttonWithTooltipInGroup, ccomboBox, ccomboBox, ccomboBox, ccomboBox, ccomboBoxInGroup, ccomboBoxInGroup, ccomboBoxInGroup, ccomboBoxInGroup, ccomboBoxWithId, ccomboBoxWithId, ccomboBoxWithId, ccomboBoxWithId, ccomboBoxWithLabel, ccomboBoxWithLabel, ccomboBoxWithLabelInGroup, ccomboBoxWithLabelInGroup, checkBox, checkBox, checkBox, checkBox, checkBoxInGroup, checkBoxInGroup, checkBoxInGroup, checkBoxInGroup, checkBoxWithId, checkBoxWithId, checkBoxWithId, checkBoxWithId, checkBoxWithLabel, checkBoxWithLabel, checkBoxWithLabelInGroup, checkBoxWithLabelInGroup, checkBoxWithTooltip, checkBoxWithTooltip, checkBoxWithTooltipInGroup, checkBoxWithTooltipInGroup, clabel, clabel, clabel, clabel, clabelInGroup, clabelInGroup, clabelInGroup, clabelInGroup, clabelWithId, clabelWithId, clabelWithId, clabelWithId, comboBox, comboBox, comboBox, comboBox, comboBoxInGroup, comboBoxInGroup, comboBoxInGroup, comboBoxInGroup, comboBoxWithId, comboBoxWithId, comboBoxWithId, comboBoxWithId, comboBoxWithLabel, comboBoxWithLabel, comboBoxWithLabelInGroup, comboBoxWithLabelInGroup, cTabItem, cTabItem, cTabItem, cTabItem, cTabItemInGroup, cTabItemInGroup, cTabItemInGroup, cTabItemInGroup, cTabItemWithId, cTabItemWithId, cTabItemWithId, cTabItemWithId, dateTime, dateTime, dateTimeInGroup, dateTimeInGroup, dateTimeWithId, dateTimeWithId, dateTimeWithId, dateTimeWithId, dateTimeWithLabel, dateTimeWithLabel, dateTimeWithLabelInGroup, dateTimeWithLabelInGroup, expandBar, expandBar, expandBarInGroup, expandBarInGroup, expandBarWithId, expandBarWithId, expandBarWithId, expandBarWithId, expandBarWithLabel, expandBarWithLabel, expandBarWithLabelInGroup, expandBarWithLabelInGroup, label, label, label, label, labelInGroup, labelInGroup, labelInGroup, labelInGroup, labelWithId, labelWithId, labelWithId, labelWithId, link, link, link, link, linkInGroup, linkInGroup, linkInGroup, linkInGroup, linkWithId, linkWithId, linkWithId, linkWithId, list, list, listInGroup, listInGroup, listWithId, listWithId, listWithId, listWithId, listWithLabel, listWithLabel, listWithLabelInGroup, listWithLabelInGroup, radio, radio, radio, radio, radioInGroup, radioInGroup, radioInGroup, radioInGroup, radioWithId, radioWithId, radioWithId, radioWithId, radioWithLabel, radioWithLabel, radioWithLabelInGroup, radioWithLabelInGroup, radioWithTooltip, radioWithTooltip, radioWithTooltipInGroup, radioWithTooltipInGroup, scale, scale, scale, scale, scaleInGroup, scaleInGroup, scaleInGroup, scaleInGroup, scaleWithId, scaleWithId, scaleWithId, scaleWithId, scaleWithLabel, scaleWithLabel, scaleWithLabelInGroup, scaleWithLabelInGroup, scaleWithTooltip, scaleWithTooltip, scaleWithTooltipInGroup, scaleWithTooltipInGroup, slider, slider, slider, slider, sliderInGroup, sliderInGroup, sliderInGroup, sliderInGroup, sliderWithId, sliderWithId, sliderWithId, sliderWithId, sliderWithLabel, sliderWithLabel, sliderWithLabelInGroup, sliderWithLabelInGroup, sliderWithTooltip, sliderWithTooltip, sliderWithTooltipInGroup, sliderWithTooltipInGroup, spinner, spinner, spinner, spinner, spinnerInGroup, spinnerInGroup, spinnerInGroup, spinnerInGroup, spinnerWithId, spinnerWithId, spinnerWithId, spinnerWithId, spinnerWithLabel, spinnerWithLabel, spinnerWithLabelInGroup, spinnerWithLabelInGroup, spinnerWithTooltip, spinnerWithTooltip, spinnerWithTooltipInGroup, spinnerWithTooltipInGroup, styledText, styledText, styledText, styledText, styledTextInGroup, styledTextInGroup, styledTextInGroup, styledTextInGroup, styledTextWithId, styledTextWithId, styledTextWithId, styledTextWithId, styledTextWithLabel, styledTextWithLabel, styledTextWithLabelInGroup, styledTextWithLabelInGroup, tabItem, tabItem, tabItem, tabItem, tabItemInGroup, tabItemInGroup, tabItemInGroup, tabItemInGroup, tabItemWithId, tabItemWithId, tabItemWithId, tabItemWithId, table, table, tableInGroup, tableInGroup, tableWithId, tableWithId, tableWithId, tableWithId, tableWithLabel, tableWithLabel, tableWithLabelInGroup, tableWithLabelInGroup, text, text, text, text, textInGroup, textInGroup, textInGroup, textInGroup, textWithId, textWithId, textWithId, textWithId, textWithLabel, textWithLabel, textWithLabelInGroup, textWithLabelInGroup, textWithMessage, textWithMessage, textWithTooltip, textWithTooltip, textWithTooltipInGroup, textWithTooltipInGroup, toggleButton, toggleButton, toggleButton, toggleButton, toggleButtonInGroup, toggleButtonInGroup, toggleButtonInGroup, toggleButtonInGroup, toggleButtonWithId, toggleButtonWithId, toggleButtonWithId, toggleButtonWithId, toggleButtonWithLabel, toggleButtonWithLabel, toggleButtonWithLabelInGroup, toggleButtonWithLabelInGroup, toggleButtonWithTooltip, toggleButtonWithTooltip, toggleButtonWithTooltipInGroup, toggleButtonWithTooltipInGroup, toolbarButton, toolbarButton, toolbarButton, toolbarButton, toolbarButtonInGroup, toolbarButtonInGroup, toolbarButtonInGroup, toolbarButtonInGroup, toolbarButtonWithId, toolbarButtonWithId, toolbarButtonWithId, toolbarButtonWithId, toolbarButtonWithTooltip, toolbarButtonWithTooltip, toolbarButtonWithTooltipInGroup, toolbarButtonWithTooltipInGroup, toolbarDropDownButton, toolbarDropDownButton, toolbarDropDownButton, toolbarDropDownButton, toolbarDropDownButtonInGroup, toolbarDropDownButtonInGroup, toolbarDropDownButtonInGroup, toolbarDropDownButtonInGroup, toolbarDropDownButtonWithId, toolbarDropDownButtonWithId, toolbarDropDownButtonWithId, toolbarDropDownButtonWithId, toolbarDropDownButtonWithTooltip, toolbarDropDownButtonWithTooltip, toolbarDropDownButtonWithTooltipInGroup, toolbarDropDownButtonWithTooltipInGroup, toolbarRadioButton, toolbarRadioButton, toolbarRadioButton, toolbarRadioButton, toolbarRadioButtonInGroup, toolbarRadioButtonInGroup, toolbarRadioButtonInGroup, toolbarRadioButtonInGroup, toolbarRadioButtonWithId, toolbarRadioButtonWithId, toolbarRadioButtonWithId, toolbarRadioButtonWithId, toolbarRadioButtonWithTooltip, toolbarRadioButtonWithTooltip, toolbarRadioButtonWithTooltipInGroup, toolbarRadioButtonWithTooltipInGroup, toolbarToggleButton, toolbarToggleButton, toolbarToggleButton, toolbarToggleButton, toolbarToggleButtonInGroup, toolbarToggleButtonInGroup, toolbarToggleButtonInGroup, toolbarToggleButtonInGroup, toolbarToggleButtonWithId, toolbarToggleButtonWithId, toolbarToggleButtonWithId, toolbarToggleButtonWithId, toolbarToggleButtonWithTooltip, toolbarToggleButtonWithTooltip, toolbarToggleButtonWithTooltipInGroup, toolbarToggleButtonWithTooltipInGroup, tree, tree, treeInGroup, treeInGroup, treeWithId, treeWithId, treeWithId, treeWithId, treeWithLabel, treeWithLabel, treeWithLabelInGroup, treeWithLabelInGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_POLL_DELAY

@Deprecated
public static final long DEFAULT_POLL_DELAY
Deprecated. 
the delay between successive polling while waiting for a condition to be true. Use SWTBotPreferences#DEFAULT_POLL_DELAY


display

protected final Display display
The display on which the bot operates on.


finder

protected final Finder finder
The finder used by the bot to find controls.

Constructor Detail

SWTGefBot

public SWTGefBot()
Method Detail

gefEditor

public SWTBotGefEditor gefEditor(String fileName)
                          throws WidgetNotFoundException
Attempts to locate the Gef editor matching the given name. If no match is found an exception will be thrown. The name is the name as displayed on the editor's tab in eclipse.

Parameters:
fileName - the name of the file.
Returns:
an editor for the specified fileName.
Throws:
WidgetNotFoundException - if the editor is not found.

gefEditor

public SWTBotGefEditor gefEditor(String fileName,
                                 int index)
                          throws WidgetNotFoundException
Attempts to locate the editor matching the given name. If no match is found an exception will be thrown. The name is the name as displayed on the editor's tab in eclipse.

Parameters:
fileName - the name of the file.
index - in case of multiple views with the same fileName.
Returns:
an editor for the specified fileName.
Throws:
WidgetNotFoundException - if the editor is not found.

createEditor

protected SWTBotGefEditor createEditor(IEditorReference reference,
                                       SWTWorkbenchBot bot)
Create the editor. Subclass if necessary to instance your own GEF editor.

Parameters:
reference - the editor reference
bot - the bot
Returns:
the created editor instance

gefView

public SWTBotGefView gefView(String viewName)
                      throws WidgetNotFoundException
Attempts to locate the view matching the given name. If no match is found an exception will be thrown. The name is the name as displayed on the view in eclipse.

Parameters:
viewName - the name of the view.
Returns:
a view with the specified name.
Throws:
WidgetNotFoundException - if the view is not found.

gefView

public SWTBotGefView gefView(String viewName,
                             int index)
                      throws WidgetNotFoundException
Attempts to locate the view matching the given name. If no match is found an exception will be thrown. The name is the name as displayed on the view in eclipse.

Parameters:
viewName - the name of the view.
index - in case of multiple views with the same fileName.
Returns:
a view with the specified name.
Throws:
WidgetNotFoundException - if the view is not found.

createView

protected SWTBotGefView createView(IViewReference reference,
                                   SWTWorkbenchBot bot)
Create the view. Subclass if necessary to instance your own GEF view.

Parameters:
reference - the view reference
bot - the bot
Returns:
the created view instance

gefViewer

public SWTBotGefViewer gefViewer(String partTitle)
                          throws WidgetNotFoundException
Attempts to locate a gef viewer that is embedded in a workbench part with the specified title.

Parameters:
partTitle - the workbench part title
Returns:
The gef viewer
Throws:
WidgetNotFoundException - if a workbench part with the specified title cannot be found.

shell

public SWTBotShell shell(String text)
Parameters:
text - the text on the shell.
Returns:
a wrapper around a @{link Shell} with the specified text.

shell

public SWTBotShell shell(String text,
                         int index)
Parameters:
text - the text on the shell.
index - the index of the shell, in case there are multiple shells with the same text.
Returns:
a wrapper around a Shell with the specified index.

shells

public List<Shell> shells(String text)
Parameters:
text - the text on the shell.
Returns:
a wrapper around a Shell with the specified index.

shell

public SWTBotShell shell(String text,
                         Shell parent)
Parameters:
text - the text on the shell.
parent - the parent under which a shell will be found.
Returns:
a wrapper around a @{link Shell} with the specified text.

shell

public SWTBotShell shell(String text,
                         Shell parent,
                         int index)
Parameters:
text - the text on the shell.
parent - the parent under which a shell will be found.
index - the index of the shell, in case there are multiple shells with the same text.
Returns:
a wrapper around a Shell with the specified index.

shells

public List<Shell> shells(String text,
                          Shell parent)
Parameters:
text - the text on the shell.
parent - the parent under which a shell will be found.
Returns:
a List of Shell which matched.

shellWithId

public SWTBotShell shellWithId(String value)
Parameters:
value - the value of the id
Returns:
a wrapper around a @{link Shell} with the specified value pair for its id.
Since:
2.0

shellWithId

public SWTBotShell shellWithId(String key,
                               String value)
Parameters:
key - the key of the id
value - the value of the id
Returns:
a wrapper around a @{link Shell} with the specified key/value pair for its id.

shellWithId

public SWTBotShell shellWithId(String value,
                               int index)
Parameters:
value - the value of the id
index - the index of the shell, in case there are multiple shells with the same text.
Returns:
a wrapper around a @{link Shell} with the specified value for its id.
Since:
2.0

shellWithId

public SWTBotShell shellWithId(String key,
                               String value,
                               int index)
Parameters:
key - the key of the id
value - the value of the id
index - the index of the shell, in case there are multiple shells with the same text.
Returns:
a wrapper around a @{link Shell} with the specified key/value pair for its id.

menu

public SWTBotMenu menu(String text)
Parameters:
text - the text on the menu.
Returns:
a menu item that matches the specified text.

menu

public SWTBotMenu menu(String text,
                       int index)
Parameters:
text - the text on the menu.
index - the index of the menu, in case there are multiple menus with the same text.
Returns:
a menu item that matches the specified text.

menuWithId

public SWTBotMenu menuWithId(String value)
Parameters:
value - the value of the id.
Returns:
a wrapper around a @{link Menu} with the specified key/value pair for its id.

menuWithId

public SWTBotMenu menuWithId(String value,
                             int index)
Parameters:
value - the value of the id.
index - the index of the menu item, in case there are multiple shells with the same text.
Returns:
a wrapper around a @{link Menu} with the specified key/value pair for its id.

menuWithId

public SWTBotMenu menuWithId(String key,
                             String value)
Parameters:
key - the key of the id.
value - the value of the id.
Returns:
a wrapper around a @{link Menu} with the specified key/value pair for its id.

menuWithId

public SWTBotMenu menuWithId(String key,
                             String value,
                             int index)
Parameters:
key - the key of the id.
value - the value of the id.
index - the index of the menu item, in case there are multiple shells with the same text.
Returns:
a wrapper around a @{link Menu} with the specified key/value pair for its id.

menu

public SWTBotMenu menu(SWTBotShell shell,
                       Matcher<MenuItem> matcher,
                       int index)
Parameters:
shell - the shell to search for the menu.
matcher - the matcher used to find the menu.
index - the index of the menu, in case there are multiple menus with the same text.
Returns:
a menu item that matches the specified text.

widgets

public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher,
                                                    Widget parentWidget)
Parameters:
matcher - the matcher used to match widgets.
parentWidget - the parent widget to search for a given widget.
Returns:
a list of widgets that match the matcher.

widgets

public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher)
Parameters:
matcher - the matcher used to match widgets.
Returns:
a list of widgets in the active shell that match the matcher.

widget

public <T extends Widget> T widget(Matcher<T> matcher,
                                   Widget parentWidget)
Parameters:
matcher - the matcher used to match widgets.
parentWidget - the parent widget to search for a given widget.
Returns:
the first widget that matchs the matcher.

widget

public <T extends Widget> T widget(Matcher<T> matcher,
                                   Widget parentWidget,
                                   int index)
Parameters:
matcher - the matcher used to match widgets.
parentWidget - the parent widget to search for a given widget.
index - the index of the widget, incase the matcher finds multiple widgets
Returns:
the first widget that matchs the matcher.

widget

public <T extends Widget> T widget(Matcher<T> matcher,
                                   int index)
Parameters:
matcher - the matcher used to match widgets.
index - the index of the widget in case there are multiple widgets.
Returns:
the index'th widget matching the matcher.

widget

public <T extends Widget> T widget(Matcher<T> matcher)
Parameters:
matcher - the matcher used to match widgets.
Returns:
the index'th widget matching the matcher.

shells

public SWTBotShell[] shells()
Gets the list of shells found in the display.

Returns:
all the shells in the display.

activeShell

public SWTBotShell activeShell()
                        throws WidgetNotFoundException
Gets the current active shell.

Returns:
the current active shell
Throws:
WidgetNotFoundException - if the widget is not found.

waitUntilWidgetAppears

public void waitUntilWidgetAppears(ICondition waitForWidget)

waitUntil

public void waitUntil(ICondition condition)
               throws TimeoutException
Waits until a specified condition evaluates to true.

Parameters:
condition - the ICondition to be evaluated.
Throws:
TimeoutException - if the condition does not evaluate to true after SWTBotPreferences.TIMEOUT milliseconds.
Since:
1.2

waitUntil

public void waitUntil(ICondition condition,
                      long timeout)
               throws TimeoutException
Waits until the timeout is reached or the condition is met.

Parameters:
condition - the condition to be evaluated.
timeout - the timeout.
Throws:
TimeoutException - if the condition does not evaluate to true after timeout milliseconds.
Since:
1.2

waitUntil

public void waitUntil(ICondition condition,
                      long timeout,
                      long interval)
               throws TimeoutException
Waits until the condition has been meet, or the timeout is reached. The interval is the delay between evaluating the condition after it has failed.

Parameters:
condition - the condition to be evaluated.
timeout - the timeout.
interval - The delay time.
Throws:
TimeoutException - if the condition does not evaluate to true after timeout milliseconds.

waitWhile

public void waitWhile(ICondition condition)
               throws TimeoutException
Waits while the condition is true.

Parameters:
condition - the ICondition to be evaluated.
Throws:
TimeoutException - if the condition does not evaluate to false after SWTBotPreferences.TIMEOUT milliseconds.
Since:
2.0

waitWhile

public void waitWhile(ICondition condition,
                      long timeout)
               throws TimeoutException
Waits while the condition is true, until the timeout is reached.

Parameters:
condition - the condition to be evaluated.
timeout - the timeout.
Throws:
TimeoutException - if the condition does not evaluate to false after timeout milliseconds.
Since:
2.0

waitWhile

public void waitWhile(ICondition condition,
                      long timeout,
                      long interval)
               throws TimeoutException
Waits while the condition is true, until the timeout is reached. The interval is the delay between evaluating the condition after it has succeed.

Parameters:
condition - the condition to be evaluated.
timeout - the timeout.
interval - The delay time.
Throws:
TimeoutException - if the condition does not evaluate to false after timeout milliseconds.
Since:
2.0

sleep

public void sleep(long millis)
Sleeps for the given number of milliseconds.

Parameters:
millis - the time in milliseconds for which to sleep.

getDisplay

public Display getDisplay()
Gets the display

Returns:
the display
Since:
1.0

captureScreenshot

public boolean captureScreenshot(String fileName)
Captures a screenshot to the given file name.

Parameters:
fileName - the filename to save screenshot to.
Returns:
true if the screenshot was created and saved, false otherwise.
Since:
1.1
See Also:
SWTUtils.captureScreenshot(String)

getFinder

public Finder getFinder()
Returns:
the finder

getFocusedWidget

public Control getFocusedWidget()
Returns the control which currently has keyboard focus, or null if keyboard events are not currently going to any of the controls built by the currently running application.

Returns:
the control which currently has focus, or null
See Also:
Display.getFocusControl()

trayItem

public SWTBotTrayItem trayItem()
Returns:
the first SWTBotTrayItem

trayItem

public SWTBotTrayItem trayItem(int index)
Parameters:
index - he index of the tray item.
Returns:
a SWTBotTrayItem at specified index

trayItemWithTooltip

public SWTBotTrayItem trayItemWithTooltip(String tooltip)
Parameters:
tooltip - the tooltip on the tray item.
Returns:
the first SWTBotTrayItem with the specified tooltip.

trayItemWithTooltip

public SWTBotTrayItem trayItemWithTooltip(String tooltip,
                                          int index)
Parameters:
tooltip - the tooltip on the tray item.
index - the index of the tray item.
Returns:
a SWTBotTrayItem with the specified tooltip.

trayItems

public List<SWTBotTrayItem> trayItems()
Returns:
List of all tray items in the system tray.

trayItems

public List<SWTBotTrayItem> trayItems(Matcher<?> matcher)
Parameters:
matcher - the matcher used to match tray item
Returns:
List of SWTBotTrayItem matching the matcher.

systemTray

protected Tray systemTray()
Returns:
The single instance of the system tray

performWithTimeout

public <T> T performWithTimeout(Result<T> runnable,
                                long timeout)
Performs an operation with a timeout and return a result.

This is a convenience api for performing a particular operation with a different timeout:

 long timeout = ...;
 long old = SWTBotPreferences.TIMEOUT;
 SWTBotPreferences.TIMEOUT = timeout;
 try {
        // do something that takes very long
        return aNumber;
 } finally {
        SWTBotPreferences.TIMEOUT = old;
 }
 

The above can now be written as:

 performWithTimeout(new Result() {
        public Integer run() {
                // do something that takes very long
        }
 }, timeout);

Parameters:
runnable - the runnable to execute.
timeout - the timeout for performing the operation.
Returns:
the result of executing the runnable.

performWithTimeout

public void performWithTimeout(VoidResult runnable,
                               long timeout)
Parameters:
runnable - the runnable to execute.
timeout - the timeout for performing the operation.
See Also:
for more information.