|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swtbot.swt.finder.utils.SWTUtils
public abstract class SWTUtils
Constructor Summary | |
---|---|
SWTUtils()
|
Method Summary | |
---|---|
static Thread[] |
allThreads()
Gets all the thread in the VM. |
static boolean |
captureScreenshot(String fileName)
This captures a screen shot and saves it to the given file. |
static boolean |
captureScreenshot(String fileName,
Control control)
This captures a screen shot of a widget and saves it to the given file. |
static boolean |
captureScreenshot(String fileName,
Rectangle bounds)
This captures a screen shot of an area and saves it to the given file. |
static Display |
display()
Caches the display for later use. |
static Object |
getAttribute(Object object,
String attributeName)
Get the value of an attribute on the object even if the attribute is not accessible. |
static String |
getText(Object obj)
Gets the text of the given object. |
static String |
getToolTipText(Object obj)
Gets the tooltip text for the given object. |
static boolean |
hasStyle(Widget w,
int style)
Checks if the widget has the given style. |
static Object |
invokeMethod(Object object,
String methodName)
Invokes the specified methodName on the object, and returns the result, or null if the method
returns void. |
static boolean |
isCarbon()
|
static boolean |
isCocoa()
|
static boolean |
isEmptyOrNullText(Widget w)
Checks if the widget text is an empty string. |
static boolean |
isMac()
|
static boolean |
isUIThread()
Return true if the current thread is the UI thread. |
static boolean |
isUIThread(Display display)
Return true if the current thread is the UI thread. |
static Widget |
nextWidget(Widget w)
Gets the next sibling of this passed in widget. |
static Widget |
previousWidget(Widget w)
Gets the previous sibling of the passed in widget. |
static ThreadGroup |
primaryThreadGroup()
Gets the primary thread group. |
static Widget[] |
siblings(Widget w)
|
static void |
sleep(long millis)
Sleeps for the given number of milliseconds. |
static String |
toString(Display display,
Object o)
Convers the display and object to a string. |
static String |
toString(Widget w)
Converts the given widget to a string. |
static void |
waitForDisplayToAppear()
Waits until a display appears. |
static void |
waitForDisplayToAppear(long timeout)
Waits until a display appears. |
static int |
widgetIndex(Widget w)
Gets the index of the given widget in its current container. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SWTUtils()
Method Detail |
---|
public static Widget[] siblings(Widget w)
w
- the widget
public static int widgetIndex(Widget w)
w
- the widget
null
or if the widget does not have a parent; a number greater than
or equal to zero indicating the index of the widget among its siblingspublic static Widget previousWidget(Widget w)
w
- the widget
public static Widget nextWidget(Widget w)
w
- the widget.
null
if it has none.public static String getText(Object obj)
obj
- the object which should be a widget.
public static String getToolTipText(Object obj)
obj
- the object which should be a widget.
public static String toString(Widget w)
w
- the widget.
public static String toString(Display display, Object o)
display
- the display on which the object should be evaluated.o
- the object to evaluate.
public static boolean hasStyle(Widget w, int style)
w
- the widget.style
- the style.
true
if the widget has the specified style bit set. Otherwise false
.public static void sleep(long millis)
millis
- the time in milliseconds to sleep.public static Thread[] allThreads()
public static ThreadGroup primaryThreadGroup()
public static Display display()
public static boolean isEmptyOrNullText(Widget w)
w
- the widget
true
if the widget does not have any text set on it. Othrewise false
.public static Object invokeMethod(Object object, String methodName) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
null
if the method
returns void.
object
- the objectmethodName
- the method name
NoSuchMethodException
- if the method methodName does not exist.
IllegalAccessException
- if the java access control does not allow invocation.
InvocationTargetException
- if the method methodName throws an exception.Method.invoke(Object, Object[])
public static Object getAttribute(Object object, String attributeName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException
object
- the objectattributeName
- the attribute name
SecurityException
- if the attribute accessibility may not be changed.
NoSuchFieldException
- if the attribute attributeName does not exist.
IllegalAccessException
- if the java access control does not allow access.
IllegalArgumentException
public static boolean captureScreenshot(String fileName)
fileName
- the filename to save screenshot to.
true
if the screenshot was created and saved, false
otherwise.public static boolean captureScreenshot(String fileName, Control control)
fileName
- the filename to save screenshot to.control
- the control
true
if the screenshot was created and saved, false
otherwise.public static boolean captureScreenshot(String fileName, Rectangle bounds)
fileName
- the filename to save screenshot to.bounds
- the area to capture.
true
if the screenshot was created and saved, false
otherwise.public static void waitForDisplayToAppear()
TimeoutException
- if the condition does not evaluate to true after SWTBotPreferences.TIMEOUT
milliseconds.public static void waitForDisplayToAppear(long timeout)
timeout
- the timeout in ms.
TimeoutException
- if the condition does not evaluate to true after timeout
ms milliseconds.public static boolean isUIThread(Display display)
display
- the display
true
if the current thread is the UI thread, false
otherwise.public static boolean isUIThread()
true
if this instance is running in the UI thread, false
otherwise.public static boolean isMac()
true
if the current OS is macosx.public static boolean isCocoa()
true
if the current platform is cocoa
public static boolean isCarbon()
true
if the current platform is carbon
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |