|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swtbot.swt.finder.SWTBot org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot
public class SWTGefBot
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)
|
|
|
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. |
|
|
widget(Matcher<T> matcher)
|
|
|
widget(Matcher<T> matcher,
int index)
|
|
|
widget(Matcher<T> matcher,
Widget parentWidget)
|
|
|
widget(Matcher<T> matcher,
Widget parentWidget,
int index)
|
|
|
widgets(Matcher<T> matcher)
|
|
|
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@Deprecated public static final long DEFAULT_POLL_DELAY
protected final Display display
protected final Finder finder
Constructor Detail |
---|
public SWTGefBot()
Method Detail |
---|
public SWTBotGefEditor gefEditor(String fileName) throws WidgetNotFoundException
fileName
- the name of the file.
WidgetNotFoundException
- if the editor is not found.public SWTBotGefEditor gefEditor(String fileName, int index) throws WidgetNotFoundException
fileName
- the name of the file.index
- in case of multiple views with the same fileName.
WidgetNotFoundException
- if the editor is not found.protected SWTBotGefEditor createEditor(IEditorReference reference, SWTWorkbenchBot bot)
reference
- the editor referencebot
- the bot
public SWTBotGefView gefView(String viewName) throws WidgetNotFoundException
viewName
- the name of the view.
WidgetNotFoundException
- if the view is not found.public SWTBotGefView gefView(String viewName, int index) throws WidgetNotFoundException
viewName
- the name of the view.index
- in case of multiple views with the same fileName.
WidgetNotFoundException
- if the view is not found.protected SWTBotGefView createView(IViewReference reference, SWTWorkbenchBot bot)
reference
- the view referencebot
- the bot
public SWTBotGefViewer gefViewer(String partTitle) throws WidgetNotFoundException
partTitle
- the workbench part title
WidgetNotFoundException
- if a workbench part with the specified title cannot be found.public SWTBotShell shell(String text)
text
- the text on the shell.
public SWTBotShell shell(String text, int index)
text
- the text on the shell.index
- the index of the shell, in case there are multiple shells with the same text.
Shell
with the specified index.public List<Shell> shells(String text)
text
- the text on the shell.
Shell
with the specified index.public SWTBotShell shell(String text, Shell parent)
text
- the text on the shell.parent
- the parent under which a shell will be found.
public SWTBotShell shell(String text, Shell parent, int index)
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.
Shell
with the specified index.public List<Shell> shells(String text, Shell parent)
text
- the text on the shell.parent
- the parent under which a shell will be found.
Shell
which matched.public SWTBotShell shellWithId(String value)
value
- the value of the id
public SWTBotShell shellWithId(String key, String value)
key
- the key of the idvalue
- the value of the id
public SWTBotShell shellWithId(String value, int index)
value
- the value of the idindex
- the index of the shell, in case there are multiple shells with the same text.
public SWTBotShell shellWithId(String key, String value, int index)
key
- the key of the idvalue
- the value of the idindex
- the index of the shell, in case there are multiple shells with the same text.
public SWTBotMenu menu(String text)
text
- the text on the menu.
public SWTBotMenu menu(String text, int index)
text
- the text on the menu.index
- the index of the menu, in case there are multiple menus with the same text.
public SWTBotMenu menuWithId(String value)
value
- the value of the id.
public SWTBotMenu menuWithId(String value, int index)
value
- the value of the id.index
- the index of the menu item, in case there are multiple shells with the same text.
public SWTBotMenu menuWithId(String key, String value)
key
- the key of the id.value
- the value of the id.
public SWTBotMenu menuWithId(String key, String value, int index)
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.
public SWTBotMenu menu(SWTBotShell shell, Matcher<MenuItem> matcher, int index)
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.
public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher, Widget parentWidget)
matcher
- the matcher used to match widgets.parentWidget
- the parent widget to search for a given widget.
public <T extends Widget> List<? extends T> widgets(Matcher<T> matcher)
matcher
- the matcher used to match widgets.
public <T extends Widget> T widget(Matcher<T> matcher, Widget parentWidget)
matcher
- the matcher used to match widgets.parentWidget
- the parent widget to search for a given widget.
public <T extends Widget> T widget(Matcher<T> matcher, Widget parentWidget, int index)
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
public <T extends Widget> T widget(Matcher<T> matcher, int index)
matcher
- the matcher used to match widgets.index
- the index of the widget in case there are multiple widgets.
public <T extends Widget> T widget(Matcher<T> matcher)
matcher
- the matcher used to match widgets.
public SWTBotShell[] shells()
public SWTBotShell activeShell() throws WidgetNotFoundException
WidgetNotFoundException
- if the widget is not found.public void waitUntilWidgetAppears(ICondition waitForWidget)
public void waitUntil(ICondition condition) throws TimeoutException
condition
- the ICondition
to be evaluated.
TimeoutException
- if the condition does not evaluate to true after SWTBotPreferences.TIMEOUT
milliseconds.public void waitUntil(ICondition condition, long timeout) throws TimeoutException
condition
- the condition to be evaluated.timeout
- the timeout.
TimeoutException
- if the condition does not evaluate to true after timeout milliseconds.public void waitUntil(ICondition condition, long timeout, long interval) throws TimeoutException
condition
- the condition to be evaluated.timeout
- the timeout.interval
- The delay time.
TimeoutException
- if the condition does not evaluate to true after timeout milliseconds.public void waitWhile(ICondition condition) throws TimeoutException
condition
- the ICondition
to be evaluated.
TimeoutException
- if the condition does not evaluate to false after SWTBotPreferences.TIMEOUT
milliseconds.public void waitWhile(ICondition condition, long timeout) throws TimeoutException
condition
- the condition to be evaluated.timeout
- the timeout.
TimeoutException
- if the condition does not evaluate to false after timeout milliseconds.public void waitWhile(ICondition condition, long timeout, long interval) throws TimeoutException
condition
- the condition to be evaluated.timeout
- the timeout.interval
- The delay time.
TimeoutException
- if the condition does not evaluate to false after timeout milliseconds.public void sleep(long millis)
millis
- the time in milliseconds for which to sleep.public Display getDisplay()
public boolean captureScreenshot(String fileName)
fileName
- the filename to save screenshot to.
true
if the screenshot was created and saved, false
otherwise.SWTUtils.captureScreenshot(String)
public Finder getFinder()
public Control getFocusedWidget()
null
if keyboard events are not currently
going to any of the controls built by the currently running application.
null
Display.getFocusControl()
public SWTBotTrayItem trayItem()
SWTBotTrayItem
public SWTBotTrayItem trayItem(int index)
index
- he index of the tray item.
SWTBotTrayItem
at specified index
public SWTBotTrayItem trayItemWithTooltip(String tooltip)
tooltip
- the tooltip on the tray item.
SWTBotTrayItem
with the specified tooltip
.public SWTBotTrayItem trayItemWithTooltip(String tooltip, int index)
tooltip
- the tooltip on the tray item.index
- the index of the tray item.
SWTBotTrayItem
with the specified tooltip
.public List<SWTBotTrayItem> trayItems()
public List<SWTBotTrayItem> trayItems(Matcher<?> matcher)
matcher
- the matcher used to match tray item
SWTBotTrayItem
matching the matcher.protected Tray systemTray()
public <T> T performWithTimeout(Result<T> runnable, long timeout)
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);
runnable
- the runnable to execute.timeout
- the timeout for performing the operation.
public void performWithTimeout(VoidResult runnable, long timeout)
runnable
- the runnable to execute.timeout
- the timeout for performing the operation.for more information.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |