Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2015-02-02 16:13:17 +0000
committerMarkus Tiede2015-02-02 16:13:17 +0000
commitd0cc618d2adf11e68126390652fc8d166caebd99 (patch)
tree63b2d30ac3abb8aa21ae0f4c0243dae1718e3ceb /org.eclipse.jubula.rc.swt
parent44e32355d70b83845672984783cf3e6a8eadcff4 (diff)
downloadorg.eclipse.jubula.core-d0cc618d2adf11e68126390652fc8d166caebd99.tar.gz
org.eclipse.jubula.core-d0cc618d2adf11e68126390652fc8d166caebd99.tar.xz
org.eclipse.jubula.core-d0cc618d2adf11e68126390652fc8d166caebd99.zip
Non-sprint task - major refactoring: added generic type information to IEventThreadQueuer
Diffstat (limited to 'org.eclipse.jubula.rc.swt')
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/components/FindSWTComponentBP.java8
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/ClickSwtEventMatcher.java5
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/DefaultSwtEventMatcher.java11
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/EventThreadQueuerSwtImpl.java4
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotEventConfirmerSwtImpl.java4
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotSwtImpl.java135
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/WindowActivationMethod.java4
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/ComponentHandler.java8
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/MenuTester.java4
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/SwtApplicationTester.java51
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java134
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/ToolItemTester.java25
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TreeTester.java62
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/AbstractComboBoxAdapter.java14
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ButtonAdapter.java17
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CComboAdapter.java121
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CLabelAdapter.java8
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CTabFolderAdapter.java51
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ComboAdapter.java76
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ControlAdapter.java39
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/LabelAdapter.java9
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ListAdapter.java69
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuAdapter.java24
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuItemAdapter.java162
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/StyledTextAdapter.java48
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TabFolderAdapter.java55
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TableAdapter.java205
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TextComponentAdapter.java45
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ToolItemAdapter.java58
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TreeAdapter.java7
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/WidgetAdapter.java42
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TableTreeOperationContext.java56
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TreeOperationContext.java178
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/util/SimulatedTooltip.java10
-rw-r--r--org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/utils/SwtUtils.java97
35 files changed, 810 insertions, 1036 deletions
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/components/FindSWTComponentBP.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/components/FindSWTComponentBP.java
index 695651896..f58bd3972 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/components/FindSWTComponentBP.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/components/FindSWTComponentBP.java
@@ -43,11 +43,11 @@ public class FindSWTComponentBP extends FindComponentBP {
throws IllegalArgumentException {
EventThreadQueuerSwtImpl etQueuer = new EventThreadQueuerSwtImpl();
- return etQueuer.invokeAndWait(
- this.getClass().getName() + ".findComponent", new IRunnable() { //$NON-NLS-1$
+ return etQueuer.invokeAndWait(this.getClass().getName()
+ + ".findComponent", new IRunnable<Object>() { //$NON-NLS-1$
public Object run() throws StepExecutionException {
- return findComponentImpl(componentIdentifier,
- autHierarchy);
+ return findComponentImpl(componentIdentifier,
+ autHierarchy);
}
});
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/ClickSwtEventMatcher.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/ClickSwtEventMatcher.java
index 201247bf6..1ed9bdbad 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/ClickSwtEventMatcher.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/ClickSwtEventMatcher.java
@@ -181,8 +181,8 @@ public class ClickSwtEventMatcher extends DefaultSwtEventMatcher {
*/
private boolean isOnBorder(final Widget graphicsComponent) {
try {
- Boolean isOnBorder = (Boolean)new EventThreadQueuerSwtImpl().invokeAndWait("CheckBorderFallbackMatching", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ return new EventThreadQueuerSwtImpl().invokeAndWait("CheckBorderFallbackMatching", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
int fuzz = 3;
Display d = graphicsComponent.getDisplay();
Rectangle widgetBounds =
@@ -202,7 +202,6 @@ public class ClickSwtEventMatcher extends DefaultSwtEventMatcher {
return Boolean.FALSE;
}
});
- return isOnBorder.booleanValue();
} catch (Throwable t) {
// Since this method is a workaround, it would be unacceptable to
// propagate any errors here. Instead, we'll log the problem and
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/DefaultSwtEventMatcher.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/DefaultSwtEventMatcher.java
index 3d9ad103f..77edc4598 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/DefaultSwtEventMatcher.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/DefaultSwtEventMatcher.java
@@ -72,12 +72,11 @@ public class DefaultSwtEventMatcher implements IEventMatcher {
Widget w = e.widget;
if (w instanceof Control) {
final Control c = (Control) w;
- Composite parent = (Composite)
- new EventThreadQueuerSwtImpl().invokeAndWait("getParent", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return c.getParent();
- }
- });
+ Composite parent = new EventThreadQueuerSwtImpl().invokeAndWait("getParent", new IRunnable<Composite>() { //$NON-NLS-1$
+ public Composite run() {
+ return c.getParent();
+ }
+ });
if (parent == combo && isMatching(e)) {
return true;
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/EventThreadQueuerSwtImpl.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/EventThreadQueuerSwtImpl.java
index 0d98ae198..30504c872 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/EventThreadQueuerSwtImpl.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/EventThreadQueuerSwtImpl.java
@@ -37,11 +37,11 @@ public class EventThreadQueuerSwtImpl implements IEventThreadQueuer {
new AutServerLogger(EventThreadQueuerSwtImpl.class);
/** {@inheritDoc} */
- public Object invokeAndWait(String name, IRunnable runnable)
+ public <V> V invokeAndWait(String name, IRunnable<V> runnable)
throws IllegalArgumentException, StepExecutionException {
Validate.notNull(runnable, "runnable must not be null"); //$NON-NLS-1$
- RunnableWrapper wrapper = new RunnableWrapper(name, runnable);
+ RunnableWrapper<V> wrapper = new RunnableWrapper<V>(name, runnable);
try {
Display display = getDisplay();
if (display.isDisposed()) {
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotEventConfirmerSwtImpl.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotEventConfirmerSwtImpl.java
index edd4e427e..4edfd8c96 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotEventConfirmerSwtImpl.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotEventConfirmerSwtImpl.java
@@ -286,8 +286,8 @@ class RobotEventConfirmerSwtImpl implements IRobotEventConfirmer,
final IEventThreadQueuer evThreadQueuer =
new EventThreadQueuerSwtImpl();
evThreadQueuer.invokeAndWait("add-/removeDisplayFilters", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
final Display autDisplay = ((SwtAUTServer)AUTServer
.getInstance()).getAutDisplay();
final int maskLength = eventMask.length;
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotSwtImpl.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotSwtImpl.java
index 0c5522cde..f7fdbb370 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotSwtImpl.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/RobotSwtImpl.java
@@ -261,9 +261,9 @@ public class RobotSwtImpl implements IRobot {
* a component.
*/
public void scrollRectToVisible(final Rectangle aRect) {
- m_queuer.invokeAndWait("scrollToComponent", new IRunnable() { //$NON-NLS-1$
+ m_queuer.invokeAndWait("scrollToComponent", new IRunnable<Void>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
Point currentPoint = new Point(aRect.x, aRect.y);
if (m_component instanceof Scrollable) {
final Scrollable scrollable = (Scrollable)m_component;
@@ -415,11 +415,11 @@ public class RobotSwtImpl implements IRobot {
RobotException re, final StringBuffer sb) {
// Get mouse coordinates
- Object mouseCoords =
+ Point mouseCoords =
m_queuer.invokeAndWait("get mouse coordinates", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Point>() {
- public Object run() throws StepExecutionException {
+ public Point run() throws StepExecutionException {
return m_autServer.getAutDisplay()
.getCursorLocation();
}
@@ -430,9 +430,9 @@ public class RobotSwtImpl implements IRobot {
Rectangle compBounds = null;
if (graphicsComponent instanceof Widget) {
- compBounds = (Rectangle)m_queuer.invokeAndWait(
- "getBounds", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ compBounds = m_queuer.invokeAndWait(
+ "getBounds", new IRunnable<Rectangle>() { //$NON-NLS-1$
+ public Rectangle run() throws StepExecutionException {
return SwtUtils.getWidgetBounds(
(Widget)graphicsComponent);
}
@@ -446,8 +446,8 @@ public class RobotSwtImpl implements IRobot {
// we receive a "*Wrong Thread*" message rather than actual
// component information.
m_queuer.invokeAndWait(
- "getBounds", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ "appendGraphicsComponent", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
sb.append(graphicsComponent);
// Return value not used
@@ -477,16 +477,15 @@ public class RobotSwtImpl implements IRobot {
public void preMove(final Rectangle constraint)
throws RobotException {
- boolean isAlreadyInConstraints = ((Boolean)m_queuer.invokeAndWait(
- "isAlreadyInConstraints", new IRunnable() { //$NON-NLS-1$
+ boolean isAlreadyInConstraints = m_queuer.invokeAndWait(
+ "isAlreadyInConstraints", new IRunnable<Boolean>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Boolean run() throws StepExecutionException {
return constraint.contains(
- m_autServer.getAutDisplay().getCursorLocation())
- ? Boolean.TRUE : Boolean.FALSE;
+ m_autServer.getAutDisplay().getCursorLocation());
}
- })).booleanValue();
+ });
if (!isAlreadyInConstraints) {
Point p = new Point(constraint.x + (constraint.width / 2),
constraint.y + (constraint.height / 2));
@@ -504,9 +503,9 @@ public class RobotSwtImpl implements IRobot {
*/
private boolean isMouseMoveRequired(Point p) {
boolean result = false;
- Point point = (Point)m_queuer.invokeAndWait("isMouseMoveRequired", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ Point point = m_queuer.invokeAndWait("isMouseMoveRequired", //$NON-NLS-1$
+ new IRunnable<Point>() {
+ public Point run() throws StepExecutionException {
Display d = (m_autServer).getAutDisplay();
return d.getCursorLocation();
}
@@ -578,9 +577,9 @@ public class RobotSwtImpl implements IRobot {
if (log.isDebugEnabled()) {
log.debug("Moving mouse to: " + pointToGo); //$NON-NLS-1$
}
- Point initialPoint = (Point)m_queuer.invokeAndWait("moveImpl", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ Point initialPoint = m_queuer.invokeAndWait("moveImpl", //$NON-NLS-1$
+ new IRunnable<Point>() {
+ public Point run() throws StepExecutionException {
Display d = m_autServer.getAutDisplay();
return d.getCursorLocation();
}
@@ -621,9 +620,9 @@ public class RobotSwtImpl implements IRobot {
*/
private Point convertLocation(final Rectangle constraints,
final Control graphicsComponent) {
- Point convertedLocation = (Point)m_queuer.invokeAndWait(
- "toDisplay", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ Point convertedLocation = m_queuer.invokeAndWait(
+ "toDisplay", new IRunnable<Point>() { //$NON-NLS-1$
+ public Point run() throws StepExecutionException {
return graphicsComponent.toDisplay(constraints.x,
constraints.y);
}
@@ -635,10 +634,10 @@ public class RobotSwtImpl implements IRobot {
&& graphicsComponent instanceof org.eclipse.swt.widgets.List) {
final org.eclipse.swt.widgets.List list =
(org.eclipse.swt.widgets.List)graphicsComponent;
- Integer correctedYPos = (Integer)m_queuer.invokeAndWait(
- "correctedYPos", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return new Integer(list.getClientArea().y);
+ Integer correctedYPos = m_queuer.invokeAndWait(
+ "correctedYPos", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return list.getClientArea().y;
}
});
convertedLocation.y += correctedYPos.intValue();
@@ -657,9 +656,9 @@ public class RobotSwtImpl implements IRobot {
*/
private void logAndCorrectMousePosition(Point pointToGo) {
String runnableName = "moveImpl.getCursorPoint"; //$NON-NLS-1$
- Point curPoint = (Point)m_queuer.invokeAndWait(runnableName,
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ Point curPoint = m_queuer.invokeAndWait(runnableName,
+ new IRunnable<Point>() {
+ public Point run() throws StepExecutionException {
Display d = m_autServer.getAutDisplay();
return d.getCursorLocation();
}
@@ -669,9 +668,9 @@ public class RobotSwtImpl implements IRobot {
log.warn("Current and end points not equal after mouse move. Waiting 1 second to see if a delay fixes the problem."); //$NON-NLS-1$
SwtRobot.delay(1000);
m_robot.waitForIdle();
- curPoint = (Point)m_queuer.invokeAndWait(runnableName,
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ curPoint = m_queuer.invokeAndWait(runnableName,
+ new IRunnable<Point>() {
+ public Point run() throws StepExecutionException {
Display d = m_autServer.getAutDisplay();
return d.getCursorLocation();
}
@@ -682,9 +681,9 @@ public class RobotSwtImpl implements IRobot {
SwtRobot.delay(1000);
m_robot.waitForIdle();
SwtRobot.delay(1000);
- curPoint = (Point)m_queuer.invokeAndWait(runnableName,
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ curPoint = m_queuer.invokeAndWait(runnableName,
+ new IRunnable<Point>() {
+ public Point run() throws StepExecutionException {
Display d = m_autServer.getAutDisplay();
return d.getCursorLocation();
}
@@ -752,10 +751,10 @@ public class RobotSwtImpl implements IRobot {
// add confirmer
final IEventMatcher matcher = new DefaultSwtEventMatcher(SWT.KeyUp);
final IRobotEventConfirmer confirmer = m_interceptor.intercept(options);
- final Boolean succeeded = (Boolean)m_queuer.invokeAndWait(
+ final Boolean succeeded = m_queuer.invokeAndWait(
this.getClass().getName() + ".type", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Boolean>() {
+ public Boolean run() {
Boolean success = Boolean.TRUE;
try {
// press the modifier keys
@@ -947,8 +946,8 @@ public class RobotSwtImpl implements IRobot {
new long[] { SWT.KeyUp });
try {
m_queuer.invokeAndWait(this.getClass().getName() + ".type", //$NON-NLS-1$
- new IRunnable() {
- public Object run() { // SYNCH THREAD START
+ new IRunnable<Boolean>() {
+ public Boolean run() { // SYNCH THREAD START
boolean success = true;
while (i.hasNext()) {
AbstractKeyTyper keyTyper = i
@@ -979,7 +978,7 @@ public class RobotSwtImpl implements IRobot {
EventFactory.createActionError(
TestErrorEvent.INVALID_INPUT));
}
- return Boolean.valueOf(success);
+ return success;
}
});
} finally {
@@ -1052,14 +1051,14 @@ public class RobotSwtImpl implements IRobot {
Rectangle rectangle = bounds;
if (rectangle == null) {
- rectangle = (Rectangle)m_queuer.invokeAndWait(
- "getRelativeWidgetBounds", new IRunnable() { //$NON-NLS-1$
+ rectangle = m_queuer.invokeAndWait(
+ "getRelativeWidgetBounds", new IRunnable<Rectangle>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return SwtUtils.getRelativeWidgetBounds(
- component, component);
+ public Rectangle run() throws StepExecutionException {
+ return SwtUtils.getRelativeWidgetBounds(component,
+ component);
}
-
+
});
}
if (log.isDebugEnabled()) {
@@ -1099,10 +1098,10 @@ public class RobotSwtImpl implements IRobot {
wam.activate(window);
// Verify that window was successfully activated
- Shell activeWindow = (Shell)m_queuer.invokeAndWait(
- "getActiveWindow", new IRunnable() { //$NON-NLS-1$
+ Shell activeWindow = m_queuer.invokeAndWait(
+ "getActiveWindow", new IRunnable<Shell>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Shell run() throws StepExecutionException {
return window.getDisplay().getActiveShell();
}
@@ -1127,10 +1126,10 @@ public class RobotSwtImpl implements IRobot {
* @return the active window
*/
public Shell getActiveWindow() {
- return (Shell)m_queuer.invokeAndWait(
+ return m_queuer.invokeAndWait(
"getActiveWindow", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ new IRunnable<Shell>() {
+ public Shell run() throws StepExecutionException {
Display autDisplay = m_autServer.getAutDisplay();
Shell activeShell = autDisplay.getActiveShell();
if (activeShell == null) {
@@ -1173,8 +1172,8 @@ public class RobotSwtImpl implements IRobot {
try {
while (i.hasNext()) {
m_queuer.invokeAndWait(this.getClass().getName() + ".type", //$NON-NLS-1$
- new IRunnable() {
- public Object run() { // SYNCH THREAD START
+ new IRunnable<Void>() {
+ public Void run() { // SYNCH THREAD START
AbstractKeyTyper keyTyper =
i.next();
if (log.isDebugEnabled()) {
@@ -1325,10 +1324,10 @@ public class RobotSwtImpl implements IRobot {
* {@inheritDoc}
*/
public java.awt.Point getCurrentMousePosition() {
- java.awt.Point currentPos = (java.awt.Point)m_queuer.invokeAndWait(
- "getCursorPosition", new IRunnable() { //$NON-NLS-1$
+ java.awt.Point currentPos = m_queuer.invokeAndWait(
+ "getCursorPosition", new IRunnable<java.awt.Point>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public java.awt.Point run() throws StepExecutionException {
Display d = (m_autServer).getAutDisplay();
final Point cursorLocation = d.getCursorLocation();
return new java.awt.Point(cursorLocation.x,
@@ -1349,9 +1348,9 @@ public class RobotSwtImpl implements IRobot {
final java.awt.Point currentMousePosition = getCurrentMousePosition();
final Point currMousePos = new Point(currentMousePosition.x,
currentMousePosition.y);
- final Rectangle bounds = (Rectangle)m_queuer.invokeAndWait(
- "getBounds", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ final Rectangle bounds = m_queuer.invokeAndWait(
+ "getBounds", new IRunnable<Rectangle>() { //$NON-NLS-1$
+ public Rectangle run() throws StepExecutionException {
return SwtUtils.getWidgetBounds(comp);
}
@@ -1383,8 +1382,8 @@ public class RobotSwtImpl implements IRobot {
IRobotEventConfirmer confirmer = m_interceptor
.intercept(options);
m_queuer.invokeAndWait(this.getClass().getName() + ".type", //$NON-NLS-1$
- new IRunnable() {
- public Object run() { // SYNCH THREAD START
+ new IRunnable<Void>() {
+ public Void run() { // SYNCH THREAD START
AbstractKeyTyper keyTyper =
i.previous();
if (log.isDebugEnabled()) {
@@ -1436,8 +1435,8 @@ public class RobotSwtImpl implements IRobot {
* @see SwtUtils#getBounds(Control)
*/
private Rectangle getBounds(final Widget component) {
- return (Rectangle)m_queuer.invokeAndWait("getBounds", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ return m_queuer.invokeAndWait("getBounds", new IRunnable<Rectangle>() { //$NON-NLS-1$
+ public Rectangle run() throws StepExecutionException {
return SwtUtils.getWidgetBounds(component);
}
});
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/WindowActivationMethod.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/WindowActivationMethod.java
index da375337d..b43d2f1de 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/WindowActivationMethod.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/driver/WindowActivationMethod.java
@@ -206,8 +206,8 @@ public abstract class WindowActivationMethod {
* @param window window
*/
public void activate(final Shell window) {
- m_queuer.invokeAndWait("window activate", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ m_queuer.invokeAndWait("window activate", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
Point pos = window.getLocation();
Point cp = getClickPoint(window);
m_robot.mouseMove(pos.x + cp.x, pos.y + cp.y);
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/ComponentHandler.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/ComponentHandler.java
index c10a53bf4..e71d6f4a1 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/ComponentHandler.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/listener/ComponentHandler.java
@@ -64,8 +64,8 @@ public class ComponentHandler extends BaseSwtEventListener
EventThreadQueuerSwtImpl etQueuer = new EventThreadQueuerSwtImpl();
etQueuer.invokeAndWait(this.getClass().getName()
- + "Add active shell to AUT Hierarchy", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ + "Add active shell to AUT Hierarchy", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
Shell activeShell =
((SwtAUTServer)AUTServer.getInstance())
.getAutDisplay().getActiveShell();
@@ -148,9 +148,9 @@ public class ComponentHandler extends BaseSwtEventListener
// is only modified from the event thread.
IEventThreadQueuer queuer =
new EventThreadQueuerSwtImpl();
- Widget component = (Widget)queuer.invokeAndWait("findComponent", new IRunnable() { //$NON-NLS-1$
+ Widget component = queuer.invokeAndWait("findComponent", new IRunnable<Widget>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Widget run() throws StepExecutionException {
try {
return autHierarchy.
findComponent(componentIdentifier);
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/MenuTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/MenuTester.java
index d2a9b8503..35e90985f 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/MenuTester.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/MenuTester.java
@@ -53,8 +53,8 @@ public class MenuTester extends AbstractMenuTester {
} else {
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("setMenuBarComponent", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("setMenuBarComponent", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
Menu menu = shell.getMenuBar();
setComponent(menu);
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/SwtApplicationTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/SwtApplicationTester.java
index 4d7f6842c..23e84202a 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/SwtApplicationTester.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/SwtApplicationTester.java
@@ -152,8 +152,8 @@ public class SwtApplicationTester extends AbstractApplicationTester {
((SwtAUTServer)AUTServer.getInstance()).getAutDisplay();
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("addWindowOpenedListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("addWindowOpenedListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
display.addFilter(SWT.Activate, listener);
display.addFilter(SWT.Show, listener);
if (isWindowOpen(title, operator)) {
@@ -180,8 +180,8 @@ public class SwtApplicationTester extends AbstractApplicationTester {
}
}
} finally {
- queuer.invokeAndWait("removeWindowOpenedListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("removeWindowOpenedListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
display.removeFilter(SWT.Activate, listener);
display.removeFilter(SWT.Show, listener);
@@ -217,8 +217,8 @@ public class SwtApplicationTester extends AbstractApplicationTester {
((SwtAUTServer)AUTServer.getInstance()).getAutDisplay();
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("addWindowActiveListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("addWindowActiveListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
display.addFilter(SWT.Activate, listener);
if (isWindowActive(title, operator)) {
lock.release();
@@ -244,8 +244,8 @@ public class SwtApplicationTester extends AbstractApplicationTester {
}
}
} finally {
- queuer.invokeAndWait("removeWindowActiveListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("removeWindowActiveListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
display.removeFilter(SWT.Activate, listener);
return null;
@@ -281,8 +281,8 @@ public class SwtApplicationTester extends AbstractApplicationTester {
((SwtAUTServer)AUTServer.getInstance()).getAutDisplay();
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("addWindowClosedListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("addWindowClosedListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
display.addFilter(SWT.Close, listener);
display.addFilter(SWT.Hide, listener);
display.addFilter(SWT.Dispose, listener);
@@ -310,8 +310,8 @@ public class SwtApplicationTester extends AbstractApplicationTester {
}
}
} finally {
- queuer.invokeAndWait("removeWindowClosedListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("removeWindowClosedListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
display.removeFilter(SWT.Close, listener);
display.removeFilter(SWT.Hide, listener);
display.removeFilter(SWT.Dispose, listener);
@@ -385,10 +385,10 @@ public class SwtApplicationTester extends AbstractApplicationTester {
public void rcCheckExistenceOfWindow(final String title,
final String operator, final boolean exists) {
IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- Boolean windowExists = (Boolean)queuer.invokeAndWait(
- "isWindowOpen", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return new Boolean(isWindowOpen(title, operator));
+ Boolean windowExists = queuer.invokeAndWait(
+ "isWindowOpen", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return isWindowOpen(title, operator);
}
});
Verifier.equals(exists, windowExists.booleanValue());
@@ -399,11 +399,11 @@ public class SwtApplicationTester extends AbstractApplicationTester {
*/
public Rectangle getActiveWindowBounds() {
org.eclipse.swt.graphics.Rectangle activeWindowSize =
- (org.eclipse.swt.graphics.Rectangle)getRobotFactory()
+ getRobotFactory()
.getEventThreadQueuer().invokeAndWait(
this.getClass().getName() + ".getActiveWindowBounds", //$NON-NLS-1$
- new IRunnable() {
- public Object run() { // SYNCH THREAD START
+ new IRunnable<org.eclipse.swt.graphics.Rectangle>() {
+ public org.eclipse.swt.graphics.Rectangle run() { //$NON-NLS-1$ // SYNCH THREAD START
Display d = ((SwtAUTServer)AUTServer
.getInstance()).getAutDisplay();
if (d != null && d.getActiveShell() != null) {
@@ -485,21 +485,16 @@ public class SwtApplicationTester extends AbstractApplicationTester {
* {@inheritDoc}
*/
protected Object getActiveWindow() {
- Shell activeWindow = (Shell)getRobotFactory().getEventThreadQueuer()
+ return getRobotFactory().getEventThreadQueuer()
.invokeAndWait(this.getClass().getName() + ".getActiveWindow", //$NON-NLS-1$
-
- new IRunnable() {
- public Object run() { // SYNCH THREAD START
+ new IRunnable<Shell>() {
+ public Shell run() { // SYNCH THREAD START
Display d = ((SwtAUTServer) AUTServer
.getInstance()).getAutDisplay();
return d.getActiveShell();
-
}
}
-
- );
-
- return activeWindow;
+ );
}
/**
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java
index c9819311f..c8672fbe7 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TableTester.java
@@ -124,10 +124,10 @@ public class TableTester extends AbstractTableTester {
final Table table = getTable();
final Point awtMousePos = getRobot().getCurrentMousePosition();
- Cell returnvalue = (Cell) getEventThreadQueuer().invokeAndWait(
+ Cell returnvalue = getEventThreadQueuer().invokeAndWait(
"getCellAtMousePosition", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ new IRunnable<Cell>() {
+ public Cell run() throws StepExecutionException {
Cell cell = null;
final int itemCount = table.getItemCount();
for (int rowCount = table.getTopIndex();
@@ -190,12 +190,10 @@ public class TableTester extends AbstractTableTester {
protected boolean isMouseOnHeader() {
final Table table = getTable();
final ITableComponent adapter = (ITableComponent)getComponent();
- Boolean isVisible;
- isVisible = (Boolean)getEventThreadQueuer().invokeAndWait(
- "isMouseOnHeader", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return new Boolean(table.getHeaderVisible());
+ Boolean isVisible = getEventThreadQueuer().invokeAndWait("isMouseOnHeader", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return table.getHeaderVisible();
}
});
@@ -204,10 +202,10 @@ public class TableTester extends AbstractTableTester {
}
Boolean isOnHeader = new Boolean(false);
- isOnHeader = (Boolean)getEventThreadQueuer().invokeAndWait(
+ isOnHeader = getEventThreadQueuer().invokeAndWait(
"isMouseOnHeader", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Boolean>() {
+ public Boolean run() {
final Point awtMousePos = getRobot()
.getCurrentMousePosition();
org.eclipse.swt.graphics.Point mousePos =
@@ -236,10 +234,10 @@ public class TableTester extends AbstractTableTester {
}
if (bounds.contains(mousePos)) {
- return new Boolean(true);
+ return true;
}
}
- return new Boolean(false);
+ return false;
}
});
@@ -273,19 +271,20 @@ public class TableTester extends AbstractTableTester {
}
/**
- * @param constraints Rectangle
+ * @param constraints
+ * Rectangle
* @return converted Location of table
*/
private org.eclipse.swt.graphics.Point getConvertedLocation(
final Rectangle constraints) {
- org.eclipse.swt.graphics.Point convertedLocation =
- (org.eclipse.swt.graphics.Point)getEventThreadQueuer()
- .invokeAndWait("toDisplay", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return getTable().toDisplay(
- constraints.x, constraints.y);
- }
- });
+ org.eclipse.swt.graphics.Point convertedLocation =
+ getEventThreadQueuer().invokeAndWait("toDisplay", new IRunnable<org.eclipse.swt.graphics.Point>() { //$NON-NLS-1$
+ public org.eclipse.swt.graphics.Point run()
+ throws StepExecutionException {
+ return getTable().toDisplay(constraints.x,
+ constraints.y);
+ }
+ });
return convertedLocation;
}
@@ -303,10 +302,10 @@ public class TableTester extends AbstractTableTester {
*/
public static Rectangle getCellBounds(IEventThreadQueuer etq,
final Table table, final int row, final int col) {
- Rectangle cellBounds = (Rectangle)etq.invokeAndWait(
+ Rectangle cellBounds = etq.invokeAndWait(
"getCellBounds", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Rectangle>() {
+ public Rectangle run() {
TableItem ti = table.getItem(row);
int column = (table.getColumnCount() > 0 || col > 0)
? col : 0;
@@ -378,33 +377,28 @@ public class TableTester extends AbstractTableTester {
*/
private int correctYPos(int pos, String units) {
int correctedPos = pos;
- int headerHeight = ((Integer)getEventThreadQueuer().invokeAndWait(
- "getHeaderHeight", new IRunnable() { //$NON-NLS-1$
-
- public Object run() throws StepExecutionException {
- return new Integer(
- ((Table)getComponent().getRealComponent())
- .getHeaderHeight());
+ int headerHeight = getEventThreadQueuer().invokeAndWait(
+ "getHeaderHeight", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return ((Table) getComponent().getRealComponent())
+ .getHeaderHeight();
}
-
- })).intValue();
+ });
if (ValueSets.Unit.pixel.rcValue().equalsIgnoreCase(units)) {
// Pixel units
correctedPos += headerHeight;
} else {
// Percentage units
- int totalHeight = ((Integer)getEventThreadQueuer().invokeAndWait(
- "getWidgetBounds", new IRunnable() { //$NON-NLS-1$
-
- public Object run() throws StepExecutionException {
- return new Integer(
- SwtUtils.getWidgetBounds(
+ int totalHeight = getEventThreadQueuer().invokeAndWait(
+ "getWidgetBounds", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return SwtUtils.getWidgetBounds(
(Widget) getComponent().
- getRealComponent()).height);
+ getRealComponent()).height;
}
- })).intValue();
+ });
long targetHeight = totalHeight - headerHeight;
long targetPos = Math.round((double)targetHeight * (double)pos
/ 100.0);
@@ -484,9 +478,9 @@ public class TableTester extends AbstractTableTester {
pressOrReleaseModifiers(dndHelper.getModifier(), true);
try {
- getEventThreadQueuer().invokeAndWait("rcDropCell", new IRunnable() { //$NON-NLS-1$
+ getEventThreadQueuer().invokeAndWait("rcDropCell", new IRunnable<Void>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
// drag
robot.mousePress(dndHelper.getDragComponent(), null,
dndHelper.getMouseButton());
@@ -560,9 +554,9 @@ public class TableTester extends AbstractTableTester {
pressOrReleaseModifiers(dndHelper.getModifier(), true);
try {
- getEventThreadQueuer().invokeAndWait("rcDropRowByValue", new IRunnable() { //$NON-NLS-1$
+ getEventThreadQueuer().invokeAndWait("rcDropRowByValue", new IRunnable<Void>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
// drag
robot.mousePress(dndHelper.getDragComponent(), null,
dndHelper.getMouseButton());
@@ -636,9 +630,9 @@ public class TableTester extends AbstractTableTester {
pressOrReleaseModifiers(dndHelper.getModifier(), true);
try {
- getEventThreadQueuer().invokeAndWait("rcDropCellByColValue", new IRunnable() { //$NON-NLS-1$
+ getEventThreadQueuer().invokeAndWait("rcDropCellByColValue", new IRunnable<Void>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
// drag
robot.mousePress(dndHelper.getDragComponent(), null,
dndHelper.getMouseButton());
@@ -694,9 +688,9 @@ public class TableTester extends AbstractTableTester {
* @param row the row-index of the cell in which the checkbox-state should be verified
*/
private void verifyCheckboxInRow(boolean checked, final int row) {
- Boolean checkIndex = ((Boolean)getEventThreadQueuer().invokeAndWait(
- "rcVerifyTableCheckboxIndex", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ Boolean checkIndex = getEventThreadQueuer().invokeAndWait(
+ "rcVerifyTableCheckboxIndex", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
Table table = getTable();
if ((table.getStyle() & SWT.CHECK) == 0) {
throw new StepExecutionException(
@@ -704,10 +698,9 @@ public class TableTester extends AbstractTableTester {
EventFactory.createActionError(
TestErrorEvent.CHECKBOX_NOT_FOUND));
}
- return new Boolean(table.getItem(row).
- getChecked());
+ return table.getItem(row).getChecked();
}
- }));
+ });
Verifier.equals(checked, checkIndex.booleanValue());
}
@@ -722,12 +715,12 @@ public class TableTester extends AbstractTableTester {
* Toggles the checkbox in the selected row
*/
public void rcToggleCheckboxInSelectedRow() {
- int row = ((Integer) getEventThreadQueuer().invokeAndWait(
- "get Selection index", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return new Integer(getTable().getSelectionIndex());
+ int row = getEventThreadQueuer().invokeAndWait(
+ "get Selection index", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return getTable().getSelectionIndex();
}
- })).intValue();
+ });
toggleCheckboxInRow(row);
}
@@ -739,8 +732,8 @@ public class TableTester extends AbstractTableTester {
if (row == -1) {
getEventThreadQueuer().invokeAndWait(
- "No Selection", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ "No Selection", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
throw new StepExecutionException(
"No Selection found ", //$NON-NLS-1$
EventFactory.createActionError(
@@ -753,15 +746,14 @@ public class TableTester extends AbstractTableTester {
final Table table = getTable();
- org.eclipse.swt.graphics.Rectangle itemBounds =
- (org.eclipse.swt.graphics.Rectangle) getEventThreadQueuer().
- invokeAndWait(
- "getTableItem", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
- return table.getItem(row).getBounds();
- }
- });
+ org.eclipse.swt.graphics.Rectangle itemBounds = getEventThreadQueuer()
+ .invokeAndWait(
+ "getTableItem", new IRunnable<org.eclipse.swt.graphics.Rectangle>() { //$NON-NLS-1$
+ public org.eclipse.swt.graphics.Rectangle run()
+ throws StepExecutionException {
+ return table.getItem(row).getBounds();
+ }
+ });
int itemHeight = itemBounds.height;
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/ToolItemTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/ToolItemTester.java
index 1d28bb2f4..b4f8900fa 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/ToolItemTester.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/ToolItemTester.java
@@ -106,15 +106,14 @@ public class ToolItemTester extends ButtonTester {
EventLock lock = new EventLock();
Condition cond = new MenuShownCondition();
final Listener menuOpenListener = new EventListener(lock, cond);
- int style = ((Integer) getEventThreadQueuer().invokeAndWait(
- "getStyle", //$NON-NLS-1$
- new IRunnable() {
+ int style = getEventThreadQueuer().invokeAndWait("getStyle", //$NON-NLS-1$
+ new IRunnable<Integer>() {
- public Object run() throws StepExecutionException {
- return new Integer(item.getStyle());
+ public Integer run() throws StepExecutionException {
+ return item.getStyle();
}
- })).intValue();
+ });
if ((style & SWT.DROP_DOWN) == 0) {
// ToolItem is not DropDown style
@@ -126,11 +125,10 @@ public class ToolItemTester extends ButtonTester {
// Add menuOpenListener
getEventThreadQueuer().invokeAndWait("addMenuOpenListener", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Void>() {
- public Object run() throws StepExecutionException {
- item.getDisplay()
- .addFilter(SWT.Show, menuOpenListener);
+ public Void run() throws StepExecutionException {
+ item.getDisplay().addFilter(SWT.Show, menuOpenListener);
return null;
}
@@ -163,17 +161,14 @@ public class ToolItemTester extends ButtonTester {
} finally {
// remove menuOpenListener
getEventThreadQueuer().invokeAndWait("removeMenuOpenListener", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Void>() {
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
item.getDisplay().removeFilter(SWT.Show,
menuOpenListener);
-
return null;
}
-
});
-
}
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TreeTester.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TreeTester.java
index fc7187dd8..d525cf38d 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TreeTester.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/TreeTester.java
@@ -194,9 +194,9 @@ public class TreeTester extends AbstractTreeTester {
try {
pressOrReleaseModifiers(dndHelper.getModifier(), true);
- getEventThreadQueuer().invokeAndWait("rcDropByTextPath - perform drag", new IRunnable() { //$NON-NLS-1$
+ getEventThreadQueuer().invokeAndWait("rcDropByTextPath - perform drag", new IRunnable<Void>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
// drag
robot.mousePress(dndHelper.getDragComponent(), null,
dndHelper.getMouseButton());
@@ -265,9 +265,9 @@ public class TreeTester extends AbstractTreeTester {
final IRobot robot = getRobot();
try {
pressOrReleaseModifiers(dndHelper.getModifier(), true);
- getEventThreadQueuer().invokeAndWait("rcDropByIndexPath - perform drag", new IRunnable() { //$NON-NLS-1$
+ getEventThreadQueuer().invokeAndWait("rcDropByIndexPath - perform drag", new IRunnable<Void>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
// drag
robot.mousePress(dndHelper.getDragComponent(), null,
dndHelper.getMouseButton());
@@ -307,9 +307,9 @@ public class TreeTester extends AbstractTreeTester {
* {@inheritDoc}
*/
protected Object getNodeAtMousePosition() throws StepExecutionException {
- return (TreeItem)getEventThreadQueuer().invokeAndWait("getItemAtMousePosition", new IRunnable() { //$NON-NLS-1$
+ return getEventThreadQueuer().invokeAndWait("getItemAtMousePosition", new IRunnable<TreeItem>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public TreeItem run() throws StepExecutionException {
Point mousePos = SwtUtils.convertToSwtPoint(
getRobot().getCurrentMousePosition());
ItemAtPointTreeNodeOperation op =
@@ -349,10 +349,10 @@ public class TreeTester extends AbstractTreeTester {
*/
private int getMouseColumn() {
final Tree treeTable = getTree();
- int column = ((Integer)getEventThreadQueuer().invokeAndWait(
- "getMouseColumn", new IRunnable() { //$NON-NLS-1$
+ int column = getEventThreadQueuer().invokeAndWait(
+ "getMouseColumn", new IRunnable<Integer>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Integer run() throws StepExecutionException {
Rectangle treeTableBounds =
SwtUtils.getWidgetBounds(getTree());
Point cursorPosition =
@@ -378,15 +378,14 @@ public class TreeTester extends AbstractTreeTester {
columnBounds.width =
treeTable.getColumn(i).getWidth();
if (columnBounds.contains(cursorPosition)) {
- return new Integer(i);
+ return i;
}
}
}
- return new Integer(-1);
+ return -1;
}
-
- })).intValue();
+ });
return column;
}
@@ -474,14 +473,12 @@ public class TreeTester extends AbstractTreeTester {
* @return the number of columns in the receivers component.
*/
private int getColumnCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getColumnCount", new IRunnable() { //$NON-NLS-1$
-
- public Object run() throws StepExecutionException {
- return new Integer(getTree().getColumnCount());
- }
-
- })).intValue();
+ return getEventThreadQueuer().invokeAndWait(
+ "getColumnCount", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return getTree().getColumnCount();
+ }
+ });
}
/**
@@ -597,15 +594,14 @@ public class TreeTester extends AbstractTreeTester {
private void checkColumnIndex(final int index)
throws StepExecutionException {
- int numColumns = ((Integer)getEventThreadQueuer().invokeAndWait(
- "checkColumnIndex", //$NON-NLS-1$
- new IRunnable() {
+ int numColumns = getEventThreadQueuer().invokeAndWait(
+ "checkColumnIndex", //$NON-NLS-1$
+ new IRunnable<Integer>() {
- public Object run() {
- return new Integer(getTree().getColumnCount());
+ public Integer run() {
+ return getTree().getColumnCount();
}
-
- })).intValue();
+ });
if ((index < 0 || index >= numColumns) && index != 0) {
throw new StepExecutionException("Invalid column: " //$NON-NLS-1$
@@ -784,15 +780,15 @@ public class TreeTester extends AbstractTreeTester {
*/
public void rcVerifySelectedCheckbox(boolean checked)
throws StepExecutionException {
- Boolean checkSelected = ((Boolean)getEventThreadQueuer().invokeAndWait(
- "rcVerifyTreeCheckbox", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ Boolean checkSelected = getEventThreadQueuer().invokeAndWait(
+ "rcVerifyTreeCheckbox", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
AbstractTreeOperationContext context =
((ITreeComponent)getComponent()).getContext();
TreeItem node = (TreeItem) getSelectedNode(context);
- return new Boolean(node.getChecked());
+ return node.getChecked();
}
- }));
+ });
Verifier.equals(checked, checkSelected.booleanValue());
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/AbstractComboBoxAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/AbstractComboBoxAdapter.java
index 5dcb8cbcd..8c9ab7d75 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/AbstractComboBoxAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/AbstractComboBoxAdapter.java
@@ -169,10 +169,10 @@ public abstract class AbstractComboBoxAdapter extends ControlAdapter
EventFactory.createActionError(TestErrorEvent.COMP_NOT_FOUND));
}
- r = (Rectangle)getEventThreadQueuer().invokeAndWait(
+ r = getEventThreadQueuer().invokeAndWait(
AbstractComboBoxAdapter.class.getName()
- + "findArrowIconArea", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ + "findArrowIconArea", new IRunnable<Rectangle>() { //$NON-NLS-1$
+ public Rectangle run() throws StepExecutionException {
return SwtUtils.getRelativeWidgetBounds(editor, editor);
}
});
@@ -189,11 +189,11 @@ public abstract class AbstractComboBoxAdapter extends ControlAdapter
*/
private boolean isComboEditable() {
- Integer comboStyle = (Integer)getEventThreadQueuer().invokeAndWait(
+ Integer comboStyle = getEventThreadQueuer().invokeAndWait(
AbstractComboBoxAdapter.class.getName()
- + "isComboEditable", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return new Integer(((Widget)getRealComponent()).getStyle());
+ + "isComboEditable", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return ((Widget)getRealComponent()).getStyle();
}
});
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ButtonAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ButtonAdapter.java
index e35f5c867..103777aa8 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ButtonAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ButtonAdapter.java
@@ -38,10 +38,9 @@ public class ButtonAdapter extends ControlAdapter implements IButtonComponent {
* {@inheritDoc}
*/
public String getText() {
-
- return (String)getEventThreadQueuer()
- .invokeAndWait("getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return CAPUtil.getWidgetText(m_button,
SwtUtils.removeMnemonics(m_button.getText()));
}
@@ -52,14 +51,12 @@ public class ButtonAdapter extends ControlAdapter implements IButtonComponent {
* {@inheritDoc}
*/
public boolean isSelected() {
- Boolean actual = (Boolean)getEventThreadQueuer()
- .invokeAndWait("isSelected", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_button.getSelection()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs;
+ return getEventThreadQueuer().invokeAndWait(
+ "isSelected", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_button.getSelection();
}
});
- return actual.booleanValue();
}
/** {@inheritDoc} */
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CComboAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CComboAdapter.java
index bcc3ba913..c34ba23aa 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CComboAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CComboAdapter.java
@@ -66,16 +66,14 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
// is that if there is any white space, only part of the
// text is selected.
getEventThreadQueuer().invokeAndWait("selectAll", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Void>() {
- public Object run() throws StepExecutionException {
+ public Void run() throws StepExecutionException {
m_combobox.setSelection(
new Point(0, m_combobox.getText().length()));
-
// return value is not used
return null;
}
-
});
}
@@ -83,45 +81,40 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
* {@inheritDoc}
*/
public int getSelectedIndex() {
- int selectedIndex = ((Integer)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
CComboAdapter.class.getName()
- + "getSelectedIndex", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return new Integer(m_combobox.getSelectionIndex());
+ + "getSelectedIndex", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return m_combobox.getSelectionIndex();
}
- })).intValue();
-
- return selectedIndex;
+ });
}
/**
* {@inheritDoc}
*/
public String getText() {
- Object o = getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return CAPUtil.getWidgetText(
- m_combobox, m_combobox.getText());
+ String o = getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
+ return CAPUtil.getWidgetText(m_combobox,
+ m_combobox.getText());
}
});
- return o != null ? o.toString() : null;
+ return String.valueOf(o);
}
/**
* {@inheritDoc}
*/
protected boolean isComboEnabled() {
- boolean isEnabled = ((Boolean)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
CComboAdapter.class.getName()
- + "isComboEnabled", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return m_combobox.isEnabled()
- ? Boolean.TRUE : Boolean.FALSE;
+ + "isComboEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return m_combobox.isEnabled();
}
- })).booleanValue();
-
- return isEnabled;
+ });
}
/**
@@ -131,11 +124,11 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
scrollIndexToVisible(index);
Rectangle clickConstraints =
- (Rectangle)getEventThreadQueuer().invokeAndWait(
+ getEventThreadQueuer().invokeAndWait(
"setClickConstraints", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Rectangle>() {
- public Object run() throws StepExecutionException {
+ public Rectangle run() throws StepExecutionException {
Rectangle constraints =
SwtUtils.getRelativeWidgetBounds(
getDropdownList(), getDropdownList());
@@ -195,17 +188,12 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
* @return the number of items.
*/
protected int getItemCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getItemCount", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
-
- return new Integer(m_combobox.getItemCount());
+ return getEventThreadQueuer().invokeAndWait("getItemCount", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() {
+ return m_combobox.getItemCount();
}
-
- })).intValue();
-
+ });
}
/**
@@ -216,11 +204,11 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
protected List getDropdownList()
throws StepExecutionException {
- return (List)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
"getDropdownList", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<List>() {
- public Object run() throws StepExecutionException {
+ public List run() throws StepExecutionException {
Shell mainShell = SwtUtils.getShell(m_combobox);
Display d = Display.getCurrent();
@@ -278,18 +266,13 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
* @param index The index to make visible
*/
private void scrollIndexToVisible(final int index) {
- getEventThreadQueuer().invokeAndWait(
- "scrollIndexToVisible", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
-
- getDropdownList().setTopIndex(index);
-
- return null;
- }
-
- });
+ getEventThreadQueuer().invokeAndWait("scrollIndexToVisible", //$NON-NLS-1$
+ new IRunnable<Void>() {
+ public Void run() throws StepExecutionException {
+ getDropdownList().setTopIndex(index);
+ return null;
+ }
+ });
}
/**
@@ -298,11 +281,11 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
* the list is not showing.
*/
private int getDisplayedItemCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
"getDisplayedItemCount", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Integer>() {
- public Object run() throws StepExecutionException {
+ public Integer run() throws StepExecutionException {
List dropdown = getDropdownList();
if (dropdown == null) {
return new Integer(0);
@@ -310,38 +293,34 @@ public class CComboAdapter extends AbstractComboBoxAdapter {
int listHeight = SwtUtils.getWidgetBounds(dropdown).height;
int itemHeight = dropdown.getItemHeight();
- return new Integer(listHeight / itemHeight);
+ return listHeight / itemHeight;
}
- })).intValue();
+ });
}
/**
* @return true, if the dropdown of the combobox is visible
*/
protected boolean isDropdownVisible() {
- Boolean visible = (Boolean)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
CComboAdapter.class.getName()
- + "isDropdownVisible", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- List dropdownList = getDropdownList();
- return dropdownList != null
- ? Boolean.TRUE : Boolean.FALSE;
+ + "isDropdownVisible", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return getDropdownList() != null;
}
});
- return visible.booleanValue();
}
/**
* {@inheritDoc}
*/
public String[] getValues() {
- return (String[])getEventThreadQueuer().invokeAndWait(
- "getItems", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return m_combobox.getItems();
- }
+ return getEventThreadQueuer().invokeAndWait("getItems", //$NON-NLS-1$
+ new IRunnable<String[]>() {
+ public String[] run() {
+ return m_combobox.getItems();
+ }
});
}
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CLabelAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CLabelAdapter.java
index aa31f3904..e1f0664cd 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CLabelAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CLabelAdapter.java
@@ -32,10 +32,10 @@ public class CLabelAdapter extends ControlAdapter implements ITextComponent {
*/
public String getText() {
final CLabel label = (CLabel) getRealComponent();
- return (String)getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return CAPUtil.getWidgetText(label,
+ return getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
+ return CAPUtil.getWidgetText(label,
SwtUtils.removeMnemonics(label.getText()));
}
});
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CTabFolderAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CTabFolderAdapter.java
index ddfeed881..c317bf73e 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CTabFolderAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/CTabFolderAdapter.java
@@ -18,6 +18,7 @@ import org.eclipse.jubula.rc.swt.tester.CAPUtil;
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
/**
* Implementation of the Interface <code>ITabPane</code> as a
@@ -48,24 +49,21 @@ public class CTabFolderAdapter extends ControlAdapter
* {@inheritDoc}
*/
public int getTabCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getTabCount", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
- return new Integer(m_tabFolder.getItemCount());
- }
- })).intValue();
+ return getEventThreadQueuer().invokeAndWait("getTabCount", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
+ return m_tabFolder.getItemCount();
+ }
+ });
}
/**
* {@inheritDoc}
*/
public String getTitleofTab(final int index) {
- return (String)getEventThreadQueuer().invokeAndWait(
- "getTitleofTab", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ return getEventThreadQueuer().invokeAndWait("getTitleofTab", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() throws StepExecutionException {
final CTabItem item = m_tabFolder.getItem(index);
return CAPUtil.getWidgetText(item,
SwtUtils.removeMnemonics(item.getText()));
@@ -78,8 +76,8 @@ public class CTabFolderAdapter extends ControlAdapter
*/
public Object getBoundsAt(final int index) {
return getEventThreadQueuer().invokeAndWait("getBoundsAt", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ new IRunnable<Rectangle>() {
+ public Rectangle run() throws StepExecutionException {
return SwtUtils.getRelativeWidgetBounds(
m_tabFolder.getItem(index), m_tabFolder);
}
@@ -90,9 +88,9 @@ public class CTabFolderAdapter extends ControlAdapter
* {@inheritDoc}
*/
public boolean isEnabledAt(final int index) {
- return ((Boolean) getEventThreadQueuer().invokeAndWait("isEnabledAt", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ return getEventThreadQueuer().invokeAndWait("isEnabledAt", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() throws StepExecutionException {
Control control = m_tabFolder.getItem(index).getControl();
if (control == null) {
// FIXME zeb: Strange workaround for CTabFolders,
@@ -102,24 +100,21 @@ public class CTabFolderAdapter extends ControlAdapter
return Boolean.TRUE;
}
- return control.isEnabled() ? Boolean.TRUE : Boolean.FALSE;
+ return control.isEnabled();
}
- })).booleanValue();
+ });
}
/**
* {@inheritDoc}
*/
public int getSelectedIndex() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getSelectedIndex", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
- return new Integer(m_tabFolder.getSelectionIndex());
- }
- })).intValue();
+ return getEventThreadQueuer().invokeAndWait("getSelectedIndex", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
+ return m_tabFolder.getSelectionIndex();
+ }
+ });
}
-
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ComboAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ComboAdapter.java
index 982c0d67c..4761f9f65 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ComboAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ComboAdapter.java
@@ -54,8 +54,8 @@ public class ComboAdapter extends AbstractComboBoxAdapter {
// effect).
if (EnvironmentUtils.isMacOS()) {
getEventThreadQueuer().invokeAndWait("combo.selectAll", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
int textLength = StringUtils.length(
m_combobox.getText());
m_combobox.setSelection(new Point(0, textLength));
@@ -71,30 +71,27 @@ public class ComboAdapter extends AbstractComboBoxAdapter {
* {@inheritDoc}
*/
public int getSelectedIndex() {
-
- int selectedIndex = ((Integer)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
ComboAdapter.class.getName()
- + "getSelectedIndex", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return new Integer(m_combobox.getSelectionIndex());
+ + "getSelectedIndex", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
+ return m_combobox.getSelectionIndex();
}
- })).intValue();
-
- return selectedIndex;
+ });
}
/**
* {@inheritDoc}
*/
public String getText() {
- Object o = getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return CAPUtil.getWidgetText(
- m_combobox, m_combobox.getText());
+ String o = getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
+ return CAPUtil.getWidgetText(m_combobox,
+ m_combobox.getText());
}
});
- return o != null ? o.toString() : null;
+ return String.valueOf(o);
}
/**
@@ -102,17 +99,13 @@ public class ComboAdapter extends AbstractComboBoxAdapter {
* {@inheritDoc}
*/
protected boolean isComboEnabled() {
-
- boolean isEnabled = ((Boolean)getEventThreadQueuer().invokeAndWait(
+ return getEventThreadQueuer().invokeAndWait(
ComboAdapter.class.getName()
- + "isComboEnabled", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return m_combobox.isEnabled()
- ? Boolean.TRUE : Boolean.FALSE;
+ + "isComboEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return m_combobox.isEnabled();
}
- })).booleanValue();
-
- return isEnabled;
+ });
}
/**
@@ -142,17 +135,12 @@ public class ComboAdapter extends AbstractComboBoxAdapter {
* @return the number of items.
*/
protected int getItemCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getItemCount", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
-
- return new Integer(m_combobox.getItemCount());
+ return getEventThreadQueuer().invokeAndWait("getItemCount", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() {
+ return m_combobox.getItemCount();
}
-
- })).intValue();
-
+ });
}
/**
@@ -162,8 +150,8 @@ public class ComboAdapter extends AbstractComboBoxAdapter {
*/
private void selectComboIndex(final int index) {
final Combo combo = m_combobox;
- getEventThreadQueuer().invokeAndWait("selectComboIndex", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ getEventThreadQueuer().invokeAndWait("selectComboIndex", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
combo.select(index);
Event selectionEvent = new Event();
selectionEvent.type = SWT.Selection;
@@ -179,13 +167,11 @@ public class ComboAdapter extends AbstractComboBoxAdapter {
* {@inheritDoc}
*/
public String[] getValues() {
- return (String[])getEventThreadQueuer().invokeAndWait(
- "getItem", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return m_combobox.getItems();
- }
+ return getEventThreadQueuer().invokeAndWait("getItem", //$NON-NLS-1$
+ new IRunnable<String[]>() {
+ public String[] run() {
+ return m_combobox.getItems();
+ }
});
}
-
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ControlAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ControlAdapter.java
index bdf3ecfb1..a1b15cb44 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ControlAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ControlAdapter.java
@@ -89,9 +89,9 @@ public class ControlAdapter extends WidgetAdapter
* {@inheritDoc}
*/
public String getPropteryValue(final String propertyname) {
- Object prop = getEventThreadQueuer().invokeAndWait("getProperty", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ String prop = getEventThreadQueuer().invokeAndWait("getProperty", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() throws StepExecutionException {
try {
return getRobot().getPropertyValue(
getRealComponent(), propertyname);
@@ -110,44 +110,35 @@ public class ControlAdapter extends WidgetAdapter
* {@inheritDoc}
*/
public boolean isShowing() {
- Boolean actual = (Boolean)getEventThreadQueuer()
- .invokeAndWait("isShowing", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_component.isVisible()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs;
+ return getEventThreadQueuer().invokeAndWait(
+ "isShowing", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_component.isVisible();
}
});
- return actual.booleanValue();
}
/**
* {@inheritDoc}
*/
public boolean isEnabled() {
-
- Boolean actual = (Boolean)getEventThreadQueuer()
- .invokeAndWait("isEnabled", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_component.isEnabled()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs;
+ return getEventThreadQueuer().invokeAndWait(
+ "isEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_component.isEnabled();
}
});
- return actual.booleanValue();
}
/**
* {@inheritDoc}
*/
public boolean hasFocus() {
- Boolean actual = (Boolean)getEventThreadQueuer()
- .invokeAndWait("hasFocus", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_component.isFocusControl()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs;
+ return getEventThreadQueuer().invokeAndWait(
+ "hasFocus", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_component.isFocusControl();
}
});
- return actual.booleanValue();
}
-
-
} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/LabelAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/LabelAdapter.java
index 6e985ba43..4de668b15 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/LabelAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/LabelAdapter.java
@@ -32,13 +32,12 @@ public class LabelAdapter extends ControlAdapter implements ITextComponent {
*/
public String getText() {
final Label label = (Label) getRealComponent();
- return (String)getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return CAPUtil.getWidgetText(label,
SwtUtils.removeMnemonics(label.getText()));
}
});
}
-
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ListAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ListAdapter.java
index 299caae34..1ff2eb4c7 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ListAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ListAdapter.java
@@ -46,13 +46,14 @@ public class ListAdapter extends ControlAdapter implements IListComponent {
* {@inheritDoc}
*/
public int[] getSelectedIndices() {
- return (int[])getEventThreadQueuer().invokeAndWait(
- "getSelectedIndices", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getSelectedIndices", new IRunnable<int[]>() { //$NON-NLS-1$
+ public int[] run() {
return m_list.getSelectionIndices();
}
});
}
+
/**
* {@inheritDoc}
*/
@@ -60,12 +61,11 @@ public class ListAdapter extends ControlAdapter implements IListComponent {
final int iVal = i.intValue();
scrollIndexToVisible(iVal);
- final Rectangle clickConstraints =
- (Rectangle)getEventThreadQueuer().invokeAndWait(
+ final Rectangle clickConstraints = getEventThreadQueuer().invokeAndWait(
"setClickConstraints", //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Rectangle>() {
- public Object run() throws StepExecutionException {
+ public Rectangle run() throws StepExecutionException {
Rectangle constraints = new Rectangle(0, 0, 0, 0);
int displayedItemCount = getDisplayedItemCount();
int numberBelowTop = 0;
@@ -96,62 +96,55 @@ public class ListAdapter extends ControlAdapter implements IListComponent {
co.setScrollToVisible(false));
}
+
/**
* {@inheritDoc}
*/
public String[] getSelectedValues() {
- return (String[])getEventThreadQueuer().invokeAndWait(
- "getSelectedValues", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getSelectedValues", new IRunnable<String[]>() { //$NON-NLS-1$
+ public String[] run() {
return m_list.getSelection();
}
});
}
/**
- * @return the number of items displayed in the list.
+ * @return the number of items displayed in the list.
*/
private int getDisplayedItemCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getDisplayedItemCount", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
+ return getEventThreadQueuer().invokeAndWait("getDisplayedItemCount", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
int listHeight = SwtUtils.getWidgetBounds(m_list).height;
int itemHeight = m_list.getItemHeight();
-
- return new Integer(listHeight / itemHeight);
+ return listHeight / itemHeight;
}
-
- })).intValue();
+ });
}
/**
- * @param index The index to make visible
+ * @param index
+ * The index to make visible
*/
private void scrollIndexToVisible(final int index) {
- getEventThreadQueuer().invokeAndWait(
- "scrollIndexToVisible", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
-
- m_list.setTopIndex(index);
-
- return null;
- }
-
- });
+ getEventThreadQueuer().invokeAndWait("scrollIndexToVisible", //$NON-NLS-1$
+ new IRunnable<Void>() {
+ public Void run() throws StepExecutionException {
+ m_list.setTopIndex(index);
+ return null;
+ }
+ });
}
/**
* {@inheritDoc}
*/
- public String[] getValues() {
- return (String[]) getEventThreadQueuer().invokeAndWait("findIndices", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
-
+ public String[] getValues() {
+ return getEventThreadQueuer().invokeAndWait("findIndices", //$NON-NLS-1$
+ new IRunnable<String[]>() {
+ public String[] run() {
+
final int listItemCount = m_list.getItemCount();
String[] values = new String[m_list.getItemCount()];
for (int i = 0; i < listItemCount; i++) {
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuAdapter.java
index 6d880794e..cdcf67511 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuAdapter.java
@@ -64,14 +64,12 @@ public class MenuAdapter extends AbstractComponentAdapter
* {@inheritDoc}
*/
public IMenuItemComponent[] getItems() {
-
- MenuItem[] items =
- (MenuItem[]) getEventThreadQueuer().invokeAndWait(
- "getItems", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_menu.getItems();
- }
- });
+ MenuItem[] items = getEventThreadQueuer().invokeAndWait(
+ "getItems", new IRunnable<MenuItem[]>() { //$NON-NLS-1$
+ public MenuItem[] run() {
+ return m_menu.getItems();
+ }
+ });
IMenuItemComponent[] adapters = new IMenuItemComponent[items.length];
for (int i = 0; i < items.length; i++) {
IMenuItemComponent menuItem = new MenuItemAdapter(items[i]);
@@ -79,16 +77,16 @@ public class MenuAdapter extends AbstractComponentAdapter
}
return adapters;
}
+
/**
* {@inheritDoc}
*/
public int getItemCount() {
- Integer itemCount = (Integer) getEventThreadQueuer().invokeAndWait(
- "getItemCount", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return new Integer(m_menu.getItemCount());
+ return getEventThreadQueuer().invokeAndWait(
+ "getItemCount", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() {
+ return m_menu.getItemCount();
}
});
- return itemCount.intValue();
}
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuItemAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuItemAdapter.java
index d0edcb250..14e49dd80 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuItemAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/MenuItemAdapter.java
@@ -97,9 +97,9 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* {@inheritDoc}
*/
public String getText() {
- return (String) getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return CAPUtil.getWidgetText(m_menuItem,
SwtUtils.removeMnemonics(m_menuItem.getText()));
}
@@ -110,15 +110,12 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* {@inheritDoc}
*/
public boolean isEnabled() {
- final Boolean isEnabled = (Boolean) getEventThreadQueuer()
- .invokeAndWait("isEnabled", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return m_menuItem.isEnabled() ? Boolean.TRUE
- : Boolean.FALSE;
- }
- });
- return isEnabled.booleanValue();
-
+ return getEventThreadQueuer().invokeAndWait(
+ "isEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return m_menuItem.isEnabled();
+ }
+ });
}
/**
@@ -135,14 +132,12 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* {@inheritDoc}
*/
public boolean isSelected() {
- final Boolean isSelected = (Boolean)getEventThreadQueuer()
- .invokeAndWait("isSelected", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return m_menuItem.getSelection()
- ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait(
+ "isSelected", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return m_menuItem.getSelection();
}
});
- return isSelected.booleanValue();
}
/**
@@ -160,15 +155,12 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* {@inheritDoc}
*/
public IMenuComponent getMenu() {
-
- Menu menu =
- (Menu) getEventThreadQueuer().invokeAndWait(
- "getItems", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_menuItem.getMenu();
- }
- });
-
+ Menu menu = getEventThreadQueuer().invokeAndWait(
+ "getItems", new IRunnable<Menu>() { //$NON-NLS-1$
+ public Menu run() {
+ return m_menuItem.getMenu();
+ }
+ });
return new MenuAdapter(menu);
}
@@ -177,9 +169,6 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* {@inheritDoc}
*/
public boolean hasSubMenu() {
-
-
-
if (getMenu() != null) {
return true;
}
@@ -193,15 +182,12 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* Otherwise <code>false</code>.
*/
public boolean isSeparator() {
- final Boolean isSeparator = (Boolean)getEventThreadQueuer()
- .invokeAndWait(
- ".isSeparator", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return (m_menuItem.getStyle() & SWT.SEPARATOR) != 0
- ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait(
+ ".isSeparator", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return (m_menuItem.getStyle() & SWT.SEPARATOR) != 0;
}
});
- return isSeparator.booleanValue();
}
/**
@@ -230,8 +216,8 @@ public class MenuItemAdapter extends AbstractComponentAdapter
final Display d = menuItem.getDisplay();
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("addMenuShownListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("addMenuShownListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
d.addFilter(SWT.Show, listener);
return null;
}
@@ -241,9 +227,9 @@ public class MenuItemAdapter extends AbstractComponentAdapter
// Cascading menus are opened with a mouse-over and
// may be closed by a click.
int clickCount = isMenuBarItem(menuItem) ? 1 : 0;
- Menu menu = (Menu)getEventThreadQueuer().invokeAndWait(
- "openSubMenu", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ Menu menu = getEventThreadQueuer().invokeAndWait(
+ "openSubMenu", new IRunnable<Menu>() { //$NON-NLS-1$
+ public Menu run() {
return menuItem.getMenu();
}
});
@@ -266,18 +252,17 @@ public class MenuItemAdapter extends AbstractComponentAdapter
}
} catch (InterruptedException e) { // ignore
} finally {
- queuer.invokeAndWait("removeMenuShownListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("removeMenuShownListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
d.removeFilter(SWT.Show, listener);
-
return null;
}
});
}
if (!lock.isReleased()) {
- String itemText = (String)getEventThreadQueuer().invokeAndWait(
- "getItemText", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ String itemText = getEventThreadQueuer().invokeAndWait(
+ "getItemText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() throws StepExecutionException {
if (menuItem != null && !menuItem.isDisposed()) {
return CAPUtil.getWidgetText(menuItem,
SwtUtils.removeMnemonics(
@@ -285,7 +270,6 @@ public class MenuItemAdapter extends AbstractComponentAdapter
}
return "unknown menu item"; //$NON-NLS-1$
}
-
});
itemText = SwtUtils.removeMnemonics(itemText);
throw new StepExecutionException(
@@ -304,21 +288,19 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* bar. Otherwise, <code>false</code>.
*/
private boolean isMenuBarItem(final MenuItem menuItem) {
- return ((Boolean)getEventThreadQueuer().invokeAndWait(
- "isMenuBarItem", new IRunnable() { //$NON-NLS-1$
+ return getEventThreadQueuer().invokeAndWait(
+ "isMenuBarItem", new IRunnable<Boolean>() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ public Boolean run() throws StepExecutionException {
if (menuItem != null && !menuItem.isDisposed()) {
Menu parent = menuItem.getParent();
if (parent != null && !parent.isDisposed()) {
- return (parent.getStyle() & SWT.BAR) != 0
- ? Boolean.TRUE : Boolean.FALSE;
+ return (parent.getStyle() & SWT.BAR) != 0;
}
}
- return Boolean.FALSE;
+ return false;
}
-
- })).booleanValue();
+ });
}
/**
@@ -378,10 +360,10 @@ public class MenuItemAdapter extends AbstractComponentAdapter
*/
private void clickMenuItem(IRobot robot, final MenuItem item,
int clickCount) {
- boolean isSecondInMenu = ((Boolean) getEventThreadQueuer()
+ boolean isSecondInMenu = getEventThreadQueuer()
.invokeAndWait(
- "isMenuBar", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ "isMenuBar", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
try {
if ((item.getParent()
.getParentMenu().getStyle()
@@ -394,8 +376,7 @@ public class MenuItemAdapter extends AbstractComponentAdapter
if (preparent != null) {
return (preparent.getStyle() & SWT.BAR)
- != 0
- ? Boolean.TRUE : Boolean.FALSE;
+ != 0;
}
}
} catch (NullPointerException ne) {
@@ -403,7 +384,7 @@ public class MenuItemAdapter extends AbstractComponentAdapter
}
return Boolean.FALSE;
}
- })).booleanValue();
+ });
if (isSecondInMenu) {
robot.click(item, null,
ClickOptions.create()
@@ -424,13 +405,12 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* @return bounds of MenuItem
*/
public Rectangle getMenuItemBounds() {
- Rectangle bounds = (Rectangle)getEventThreadQueuer().invokeAndWait(
- "getMenuItemBounds", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getMenuItemBounds", new IRunnable<Rectangle>() { //$NON-NLS-1$
+ public Rectangle run() {
return SwtUtils.getBounds(m_menuItem);
}
});
- return bounds;
}
/**
@@ -461,13 +441,11 @@ public class MenuItemAdapter extends AbstractComponentAdapter
event.type = SWT.Show;
getEventThreadQueuer().invokeAndWait(
- "openSubMenuProgramatically", new IRunnable() { //$NON-NLS-1$
- public Object run() {
-
+ "openSubMenuProgramatically", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
menu.notifyListeners(SWT.Show, event);
-
return null;
- }
+ }
});
try {
@@ -478,8 +456,8 @@ public class MenuItemAdapter extends AbstractComponentAdapter
sb.append("Component: "); //$NON-NLS-1$
getEventThreadQueuer().invokeAndWait(
- "getBounds", new IRunnable() { //$NON-NLS-1$
- public Object run()
+ "getBounds", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run()
throws StepExecutionException {
sb.append(menu);
// Return value not used
@@ -545,14 +523,13 @@ public class MenuItemAdapter extends AbstractComponentAdapter
sb.append("Component: "); //$NON-NLS-1$
getEventThreadQueuer().invokeAndWait(
- "getBounds", new IRunnable() { //$NON-NLS-1$
- public Object run()
- throws StepExecutionException {
- sb.append(menuItem);
- // Return value not used
- return null;
- }
- });
+ "getBounds", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
+ sb.append(menuItem);
+ // Return value not used
+ return null;
+ }
+ });
log.error(sb.toString(), re);
throw re;
@@ -590,13 +567,12 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* @see MenuItem#isEnabled()
*/
private boolean isMenuItemEnabled(final MenuItem menuItem) {
- final Boolean isEnabled = (Boolean)getEventThreadQueuer().invokeAndWait(
- MenuItemAdapter.class + ".isMenuItemEnabled", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return menuItem.isEnabled() ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait(
+ MenuItemAdapter.class + ".isMenuItemEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return menuItem.isEnabled();
}
});
- return isEnabled.booleanValue();
}
/**
@@ -606,13 +582,11 @@ public class MenuItemAdapter extends AbstractComponentAdapter
* @see MenuItem#isEnabled()
*/
private boolean isMenuEnabled(final Menu menu) {
- final Boolean isEnabled = (Boolean)getEventThreadQueuer().invokeAndWait(
- MenuItemAdapter.class + ".isMenuEnabled", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
- return menu.isEnabled() ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait(
+ MenuItemAdapter.class + ".isMenuEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() throws StepExecutionException {
+ return menu.isEnabled();
}
});
- return isEnabled.booleanValue();
}
-
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/StyledTextAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/StyledTextAdapter.java
index 89798bd8e..8324a3b8f 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/StyledTextAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/StyledTextAdapter.java
@@ -45,14 +45,13 @@ public class StyledTextAdapter extends ControlAdapter
* {@inheritDoc}
*/
public String getText() {
- String actual = (String)getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return CAPUtil.getWidgetText(
- m_styledText, m_styledText.getText());
+ return getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
+ return CAPUtil.getWidgetText(m_styledText,
+ m_styledText.getText());
}
});
- return actual;
}
/**
@@ -60,13 +59,12 @@ public class StyledTextAdapter extends ControlAdapter
*/
public void setSelection(final int start) {
getEventThreadQueuer().invokeAndWait("setSelection", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
m_styledText.setSelection(start);
return null;
}
});
-
}
/**
@@ -74,26 +72,24 @@ public class StyledTextAdapter extends ControlAdapter
*/
public void setSelection(final int start, final int end) {
getEventThreadQueuer().invokeAndWait("setSelection", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
m_styledText.setSelection(start, end);
return null;
}
});
-
}
/**
* {@inheritDoc}
*/
public String getSelectionText() {
- String actual = (String)getEventThreadQueuer().invokeAndWait(
- "getSelectionText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getSelectionText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return m_styledText.getSelectionText();
}
});
- return actual;
}
/**
@@ -119,8 +115,8 @@ public class StyledTextAdapter extends ControlAdapter
if (!totalText.equals(getSelectionText())) {
// the selection failed for some reason
getEventThreadQueuer().invokeAndWait("text.selectAll", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
m_styledText.selectAll();
return null;
}
@@ -140,14 +136,12 @@ public class StyledTextAdapter extends ControlAdapter
* {@inheritDoc}
*/
public boolean isEditable() {
- return ((Boolean)getEventThreadQueuer().invokeAndWait(
- "isEditable", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return m_styledText.getEditable()
- && m_styledText.getEnabled()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs
- }
- })).booleanValue();
+ return getEventThreadQueuer().invokeAndWait("isEditable", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return m_styledText.getEditable()
+ && m_styledText.getEnabled();
+ }
+ });
}
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TabFolderAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TabFolderAdapter.java
index 65f216ba1..e0cb8e69a 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TabFolderAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TabFolderAdapter.java
@@ -15,6 +15,7 @@ import org.eclipse.jubula.rc.common.exception.StepExecutionException;
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITabbedComponent;
import org.eclipse.jubula.rc.swt.tester.CAPUtil;
import org.eclipse.jubula.rc.swt.utils.SwtUtils;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
/**
@@ -42,24 +43,21 @@ public class TabFolderAdapter extends ControlAdapter
* {@inheritDoc}
*/
public int getTabCount() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getSelectedIndex", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
- return new Integer(m_tabFolder.getItemCount());
- }
- })).intValue();
+ return getEventThreadQueuer().invokeAndWait("getTabCount", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
+ return m_tabFolder.getItemCount();
+ }
+ });
}
/**
* {@inheritDoc}
*/
public String getTitleofTab(final int index) {
- return (String)getEventThreadQueuer().invokeAndWait(
- "verifyTextOfTabByIndex", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ return getEventThreadQueuer().invokeAndWait("getTitleofTab", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() throws StepExecutionException {
final TabItem item = m_tabFolder.getItem(index);
return CAPUtil.getWidgetText(item,
SwtUtils.removeMnemonics(item.getText()));
@@ -72,8 +70,8 @@ public class TabFolderAdapter extends ControlAdapter
*/
public Object getBoundsAt(final int index) {
return getEventThreadQueuer().invokeAndWait("getBoundsAt", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ new IRunnable<Rectangle>() {
+ public Rectangle run() throws StepExecutionException {
return SwtUtils.getRelativeWidgetBounds(
m_tabFolder.getItem(index), m_tabFolder);
}
@@ -84,27 +82,24 @@ public class TabFolderAdapter extends ControlAdapter
* {@inheritDoc}
*/
public boolean isEnabledAt(final int index) {
- return ((Boolean) getEventThreadQueuer().invokeAndWait("isEnabledAt", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
- return m_tabFolder.getItem(index).getControl()
- .isEnabled() ? Boolean.TRUE : Boolean.FALSE;
- }
- })).booleanValue();
+ return getEventThreadQueuer().invokeAndWait("isEnabledAt", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() throws StepExecutionException {
+ return m_tabFolder.getItem(index).getControl()
+ .isEnabled();
+ }
+ });
}
/**
* {@inheritDoc}
*/
public int getSelectedIndex() {
- return ((Integer)getEventThreadQueuer().invokeAndWait(
- "getSelectedIndex", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
- return new Integer(m_tabFolder.getSelectionIndex());
- }
- })).intValue();
+ return getEventThreadQueuer().invokeAndWait("getSelectedIndex", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
+ return m_tabFolder.getSelectionIndex();
+ }
+ });
}
-
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TableAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TableAdapter.java
index eaf0b725a..479e41c6f 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TableAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TableAdapter.java
@@ -58,31 +58,29 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
/** {@inheritDoc} */
public int getColumnCount() {
- Integer colCount = (Integer) getEventThreadQueuer().invokeAndWait(
- "getColumnCount", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return new Integer(m_table.getColumnCount());
+ return getEventThreadQueuer().invokeAndWait(
+ "getColumnCount", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() {
+ return m_table.getColumnCount();
}
});
- return colCount.intValue();
}
/** {@inheritDoc} */
public int getRowCount() {
- Integer itemCount = (Integer) getEventThreadQueuer().invokeAndWait(
- "getRowCount", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return new Integer(m_table.getItemCount());
+ return getEventThreadQueuer().invokeAndWait(
+ "getRowCount", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() {
+ return m_table.getItemCount();
}
});
- return itemCount.intValue();
}
/** {@inheritDoc} */
public String getCellText(final int row, final int column) {
- String cellText = (String)getEventThreadQueuer().invokeAndWait("getCellText", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait("getCellText", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() {
final TableItem item = m_table.getItem(row);
String value = CAPUtil.getWidgetText(item,
SwtToolkitConstants.WIDGET_TEXT_KEY_PREFIX
@@ -95,19 +93,17 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
return value;
}
});
- return cellText;
}
/** {@inheritDoc} */
public String getColumnHeaderText(final int colIdx) {
- String current = (String)getEventThreadQueuer().invokeAndWait("getColumnName", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait("getColumnName", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() {
final TableColumn column = m_table.getColumn(colIdx);
return CAPUtil.getWidgetText(column, column.getText());
}
});
- return current;
}
/** {@inheritDoc} */
@@ -122,32 +118,30 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
usrIdxCol);
} catch (NumberFormatException nfe) {
try {
- Boolean isVisible;
- isVisible = (Boolean)getEventThreadQueuer().invokeAndWait(
+ Boolean isVisible = getEventThreadQueuer().invokeAndWait(
"getColumnFromString", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return new Boolean(m_table.getHeaderVisible());
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return m_table.getHeaderVisible();
}
- });
+ });
if (!(isVisible.booleanValue())) {
throw new StepExecutionException("No Header", //$NON-NLS-1$
EventFactory.createActionError(
TestErrorEvent.NO_HEADER));
}
- Integer implCol;
- implCol = (Integer)getEventThreadQueuer().invokeAndWait(
- "getColumnFromString", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ Integer implCol = getEventThreadQueuer().invokeAndWait(
+ "getColumnFromString", new IRunnable<Integer>() { //$NON-NLS-1$
+ public Integer run() throws StepExecutionException {
for (int i = 0; i < m_table.getColumnCount(); i++) {
String colHeader = getColumnHeaderText(i);
if (MatchUtil.getInstance().match(
colHeader, col, operator)) {
- return new Integer (i);
+ return i;
}
}
- return new Integer (-2);
+ return -2;
}
});
column = implCol.intValue();
@@ -160,14 +154,13 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
/** {@inheritDoc} */
public String getRowText(final int rowIdx) {
- String current = (String)getEventThreadQueuer().invokeAndWait("getRowText", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait("getRowText", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() {
final TableItem row = m_table.getItem(rowIdx);
return CAPUtil.getWidgetText(row, row.getText());
}
});
- return current;
}
/** {@inheritDoc} */
@@ -177,14 +170,13 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
rowInt = IndexConverter.toImplementationIndex(
Integer.parseInt(row));
if (rowInt == -1) {
- Boolean isVisible;
- isVisible = (Boolean)getEventThreadQueuer().invokeAndWait(
+ Boolean isVisible = getEventThreadQueuer().invokeAndWait(
"getRowFromString", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return new Boolean(m_table.getHeaderVisible());
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return m_table.getHeaderVisible();
}
- });
+ });
if (!(isVisible.booleanValue())) {
throw new StepExecutionException("Header not visible", //$NON-NLS-1$
EventFactory.createActionError(
@@ -192,19 +184,18 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
}
}
} catch (NumberFormatException nfe) {
- Integer implRow;
- implRow = (Integer)getEventThreadQueuer().invokeAndWait(
+ Integer implRow = getEventThreadQueuer().invokeAndWait(
"getRowFromString", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
for (int i = 0; i < m_table.getItemCount(); i++) {
String cellTxt = getCellText(i, 0);
if (MatchUtil.getInstance().match(
cellTxt, row, operator)) {
- return new Integer(i);
+ return i;
}
}
- return new Integer(-2);
+ return -2;
}
});
rowInt = implRow.intValue();
@@ -214,80 +205,70 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
/** {@inheritDoc} */
public Rectangle getBounds() {
- Rectangle bounds = (Rectangle) getEventThreadQueuer()
- .invokeAndWait("getBounds", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
- return m_table.getBounds();
- }
- });
-
- return bounds;
+ return getEventThreadQueuer().invokeAndWait("getBounds", //$NON-NLS-1$
+ new IRunnable<Rectangle>() {
+ public Rectangle run() throws StepExecutionException {
+ org.eclipse.swt.graphics.Rectangle rect = m_table
+ .getBounds();
+ return new Rectangle(rect.x, rect.y, rect.width,
+ rect.height);
+ }
+ });
}
/** {@inheritDoc} */
public Rectangle getHeaderBounds(final int col) {
- Rectangle headerBounds = (Rectangle) getEventThreadQueuer()
- .invokeAndWait("getHeaderBounds", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
- org.eclipse.swt.graphics.Rectangle rect =
- m_table.getItem(0).getBounds(col);
- rect.y = m_table.getClientArea().y;
- return new Rectangle(rect.x, rect.y,
- rect.width, rect.height);
- }
- });
- return headerBounds;
+ return getEventThreadQueuer().invokeAndWait("getHeaderBounds", //$NON-NLS-1$
+ new IRunnable<Rectangle>() {
+ public Rectangle run() throws StepExecutionException {
+ org.eclipse.swt.graphics.Rectangle rect = m_table
+ .getItem(0).getBounds(col);
+ rect.y = m_table.getClientArea().y;
+ return new Rectangle(rect.x, rect.y, rect.width,
+ rect.height);
+ }
+ });
}
/** {@inheritDoc} */
public Cell getSelectedCell() throws StepExecutionException {
- Cell cell = (Cell) getEventThreadQueuer().invokeAndWait(
- "getSelectedSell", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ return getEventThreadQueuer().invokeAndWait(
+ "getSelectedSell", new IRunnable<Cell>() { //$NON-NLS-1$
+ public Cell run() throws StepExecutionException {
return TableSelectionTracker.getInstance()
.getSelectedCell(m_table);
}
});
- return cell;
}
/** {@inheritDoc} */
public boolean isHeaderVisible() {
- Boolean isVisible;
- isVisible = (Boolean)getEventThreadQueuer().invokeAndWait(
- "isHeaderVisible", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return new Boolean(m_table.getHeaderVisible());
+ return getEventThreadQueuer().invokeAndWait("isHeaderVisible", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return m_table.getHeaderVisible();
}
});
- return isVisible.booleanValue();
}
/** {@inheritDoc} */
public boolean isCellEditable(final int row, final int col) {
final Control cellEditor = (Control)
activateEditor(new Cell(row, col));
- boolean isEditable = ((Boolean)getEventThreadQueuer().invokeAndWait(
- "isCellEditable", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
-
- return isEditable(cellEditor)
- ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait("isCellEditable", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return isEditable(cellEditor);
}
- })).booleanValue();
- return isEditable;
+ });
}
/** {@inheritDoc} */
public boolean hasCellSelection() {
- TableItem[] selItems = (TableItem[])getEventThreadQueuer()
+ TableItem[] selItems = getEventThreadQueuer()
.invokeAndWait("hasCellSelection", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<TableItem[]>() {
+ public TableItem[] run() {
return m_table.getSelection();
}
});
@@ -301,8 +282,8 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
throws StepExecutionException {
final Table table = m_table;
getEventThreadQueuer().invokeAndWait("scrollCellToVisible", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
if (table.getColumnCount() > 0 || col > 0) {
table.showColumn(table.getColumn(col));
}
@@ -316,8 +297,8 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
getEventThreadQueuer(), m_table, row, col);
getEventThreadQueuer().invokeAndWait("getCellBoundsRelativeToParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
org.eclipse.swt.graphics.Point cellOriginRelativeToParent =
table.getDisplay().map(
table, table.getParent(),
@@ -332,17 +313,14 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
}
});
- Control parent = (Control)getEventThreadQueuer().invokeAndWait("getParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- table.getParent();
- return null;
- }
- });
-
+ Control parent = getEventThreadQueuer().invokeAndWait("getParent", //$NON-NLS-1$
+ new IRunnable<Control>() {
+ public Control run() {
+ return table.getParent();
+ }
+ });
- getRobot().scrollToVisible(
- parent, cellBoundsRelativeToParent);
+ getRobot().scrollToVisible(parent, cellBoundsRelativeToParent);
return getVisibleBounds(TableTester.getCellBounds(
getEventThreadQueuer(), m_table, row, col));
@@ -392,9 +370,8 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
org.eclipse.swt.graphics.Rectangle r =
(org.eclipse.swt.graphics.Rectangle)
getEventThreadQueuer().invokeAndWait("getVisibleCellBounds: " + cellBounds, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ new IRunnable<org.eclipse.swt.graphics.Rectangle>() {
+ public org.eclipse.swt.graphics.Rectangle run() {
return m_table.getClientArea();
}
});
@@ -427,16 +404,12 @@ public class TableAdapter extends ControlAdapter implements ITableComponent {
* <code>false</code>.
*/
private boolean invokeIsEditable(final Control cellEditor) {
-
- boolean isEditable = ((Boolean)getEventThreadQueuer().invokeAndWait(
- "getSelectedCell", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return isEditable(cellEditor)
- ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait("getSelectedCell", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return isEditable(cellEditor);
}
- })).booleanValue();
- return isEditable;
+ });
}
/**
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TextComponentAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TextComponentAdapter.java
index 1b710eb00..4021a6044 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TextComponentAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TextComponentAdapter.java
@@ -46,14 +46,13 @@ public class TextComponentAdapter extends ControlAdapter implements
* {@inheritDoc}
*/
public String getText() {
- String actual = (String)getEventThreadQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return CAPUtil.getWidgetText(m_textComponent,
m_textComponent.getText());
}
});
- return actual;
}
/**
@@ -61,13 +60,12 @@ public class TextComponentAdapter extends ControlAdapter implements
*/
public void setSelection(final int start) {
getEventThreadQueuer().invokeAndWait("setSelection", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
m_textComponent.setSelection(start);
return null;
}
});
-
}
/**
@@ -75,26 +73,24 @@ public class TextComponentAdapter extends ControlAdapter implements
*/
public void setSelection(final int start, final int end) {
getEventThreadQueuer().invokeAndWait("setSelection", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
m_textComponent.setSelection(start, end);
return null;
}
});
-
}
/**
* {@inheritDoc}
*/
public String getSelectionText() {
- String actual = (String)getEventThreadQueuer().invokeAndWait(
- "getSelectionText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getSelectionText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return m_textComponent.getSelectionText();
}
});
- return actual;
}
/**
@@ -120,8 +116,8 @@ public class TextComponentAdapter extends ControlAdapter implements
if (!totalText.equals(getSelectionText())) {
// the selection failed for some reason
getEventThreadQueuer().invokeAndWait("text.selectAll", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
m_textComponent.selectAll();
return null;
}
@@ -141,15 +137,12 @@ public class TextComponentAdapter extends ControlAdapter implements
* {@inheritDoc}
*/
public boolean isEditable() {
- return ((Boolean)getEventThreadQueuer().invokeAndWait(
- "isEditable", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- return m_textComponent.getEditable()
- && m_textComponent.getEnabled()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs
- }
- })).booleanValue();
+ return getEventThreadQueuer().invokeAndWait("isEditable", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return m_textComponent.getEditable()
+ && m_textComponent.getEnabled();
+ }
+ });
}
-
}
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ToolItemAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ToolItemAdapter.java
index 68f3a9d3e..5e2578256 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ToolItemAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/ToolItemAdapter.java
@@ -47,31 +47,27 @@ public class ToolItemAdapter extends WidgetAdapter implements
* implemented in CAPTestCommand.getImplClass. This method only checks
* that the item has not been disposed.
*/
- Boolean actual = ((Boolean)getEventThreadQueuer()
- .invokeAndWait("isShowing", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return m_item.isDisposed()
- ? Boolean.FALSE : Boolean.TRUE; // see findBugs
+ return getEventThreadQueuer().invokeAndWait(
+ "isShowing", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_item.isDisposed();
}
- }));
- return actual.booleanValue();
+ });
}
/**
* {@inheritDoc}
*/
public boolean isEnabled() {
- boolean isEnabled = ((Boolean)getEventThreadQueuer().invokeAndWait(
- "isEnabled", new IRunnable() { //$NON-NLS-1$
-
- public Object run() {
- return m_item.isEnabled()
- ? Boolean.TRUE : Boolean.FALSE;
+ return getEventThreadQueuer().invokeAndWait(
+ "isEnabled", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_item.isEnabled();
}
-
- })).booleanValue();
- return isEnabled;
+
+ });
}
+
/**
* {@inheritDoc}
*/
@@ -89,9 +85,9 @@ public class ToolItemAdapter extends WidgetAdapter implements
*/
public String getPropteryValue(final String propertyname) {
final Item bean = m_item;
- Object prop = getEventThreadQueuer().invokeAndWait("getProperty", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ String prop = getEventThreadQueuer().invokeAndWait("getProperty", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() throws StepExecutionException {
try {
return getRobot().getPropertyValue(bean, propertyname);
} catch (RobotException e) {
@@ -102,8 +98,7 @@ public class ToolItemAdapter extends WidgetAdapter implements
}
}
});
- final String propToStr = String.valueOf(prop);
- return propToStr;
+ return String.valueOf(prop);
}
/**
@@ -117,28 +112,23 @@ public class ToolItemAdapter extends WidgetAdapter implements
* {@inheritDoc}
*/
public String getText() {
- String value = (String)getEventThreadQueuer().invokeAndWait("getText", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ return getEventThreadQueuer().invokeAndWait("getText", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() throws StepExecutionException {
return SwtUtils.removeMnemonics(m_item.getText());
}
});
- return value;
}
/**
* {@inheritDoc}
*/
public boolean isSelected() {
- Boolean actual = (Boolean)getEventThreadQueuer()
- .invokeAndWait("isSelected", new IRunnable() { //$NON-NLS-1$
-
- public Object run() {
- return m_item.getSelection()
- ? Boolean.TRUE : Boolean.FALSE; // see findBugs;
+ return getEventThreadQueuer().invokeAndWait(
+ "isSelected", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return m_item.getSelection();
}
});
- return actual.booleanValue();
}
-
-}
+} \ No newline at end of file
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TreeAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TreeAdapter.java
index 00c033d3d..a2ded73d1 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TreeAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/TreeAdapter.java
@@ -15,6 +15,7 @@ import org.eclipse.jubula.rc.common.implclasses.tree.AbstractTreeOperationContex
import org.eclipse.jubula.rc.common.tester.adapter.interfaces.ITreeComponent;
import org.eclipse.jubula.rc.swt.tester.tree.TreeOperationContext;
import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
/**
* Implements the Tree interface for adapting a <code>SWT.Tree</code>
*
@@ -39,9 +40,9 @@ public class TreeAdapter extends ControlAdapter implements ITreeComponent {
* {@inheritDoc}
*/
public Object getRootNode() {
- return getEventThreadQueuer()
- .invokeAndWait("getRootNode", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ return getEventThreadQueuer().invokeAndWait(
+ "getRootNode", new IRunnable<TreeItem[]>() { //$NON-NLS-1$
+ public TreeItem[] run() {
return getTree().getItems();
}
});
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/WidgetAdapter.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/WidgetAdapter.java
index 67f9db788..5f0bb216d 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/WidgetAdapter.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/adapter/WidgetAdapter.java
@@ -73,8 +73,8 @@ public class WidgetAdapter extends AbstractComponentAdapter {
try {
CAPUtil.pressOrReleaseModifiers(modifier, true);
- getEventThreadQueuer().invokeAndWait("startDrag", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ getEventThreadQueuer().invokeAndWait("startDrag", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
// drag
robot.mousePress(dndHelper.getDragComponent(), null,
mouseButton);
@@ -207,13 +207,12 @@ public class WidgetAdapter extends AbstractComponentAdapter {
final Display d = component.getDisplay();
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("addPopupShownListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- d.addFilter(SWT.Show, listener);
-
- return null;
- }
- });
+ queuer.invokeAndWait("addPopupShownListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
+ d.addFilter(SWT.Show, listener);
+ return null;
+ }
+ });
try {
// showPopup must run in the current thread in order to
@@ -233,10 +232,9 @@ public class WidgetAdapter extends AbstractComponentAdapter {
} catch (InterruptedException e) {
// ignore
} finally {
- queuer.invokeAndWait("removePopupShownListeners", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("removePopupShownListeners", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
d.removeFilter(SWT.Show, listener);
-
return null;
}
});
@@ -259,22 +257,18 @@ public class WidgetAdapter extends AbstractComponentAdapter {
public void showToolTip(final String text, final int textSize,
final int timePerWord, final int windowWidth) {
- final Rectangle bounds = (Rectangle)getEventThreadQueuer()
- .invokeAndWait("showToolTip.getBounds", new IRunnable() { //$NON-NLS-1$
+ final Rectangle bounds = getEventThreadQueuer().invokeAndWait(
+ "showToolTip.getBounds", new IRunnable<Rectangle>() { //$NON-NLS-1$
+ public Rectangle run() {
+ return SwtUtils.getWidgetBounds(m_component);
+ }
+ });
- public Object run() {
- return SwtUtils.getWidgetBounds(m_component);
- }
- });
-
- SimulatedTooltip sp = (SimulatedTooltip)getEventThreadQueuer()
- .invokeAndWait("showToolTip.initToolTip", new IRunnable() { //$NON-NLS-1$
-
- public Object run() throws StepExecutionException {
+ SimulatedTooltip sp = getEventThreadQueuer().invokeAndWait("showToolTip.initToolTip", new IRunnable<SimulatedTooltip>() { //$NON-NLS-1$
+ public SimulatedTooltip run() throws StepExecutionException {
return new SimulatedTooltip(timePerWord, text,
windowWidth, textSize, bounds);
}
-
});
sp.start();
try {
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TableTreeOperationContext.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TableTreeOperationContext.java
index b965d4176..85be036c8 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TableTreeOperationContext.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TableTreeOperationContext.java
@@ -67,16 +67,13 @@ public class TableTreeOperationContext extends TreeOperationContext {
*/
public void clickNode(final TreeItem node, ClickOptions clickOps) {
scrollNodeToVisible(node);
-
org.eclipse.swt.graphics.Rectangle visibleItemBounds =
- (org.eclipse.swt.graphics.Rectangle)getQueuer().invokeAndWait(
- "getVisibleNodeBounds " + node, new IRunnable() { //$NON-NLS-1$
-
- public Object run() {
+ getQueuer().invokeAndWait(
+ "getVisibleNodeBounds " + node, new IRunnable<org.eclipse.swt.graphics.Rectangle>() { //$NON-NLS-1$
+ public org.eclipse.swt.graphics.Rectangle run() {
final Rectangle nodeBounds =
SwtPointUtil.toAwtRectangle(
SwtUtils.getRelativeBounds(node, m_column));
-
return SwtPointUtil.toSwtRectangle(
getVisibleRowBounds(nodeBounds));
}
@@ -93,19 +90,15 @@ public class TableTreeOperationContext extends TreeOperationContext {
*/
public String getNodeTextAtColumn(final TreeItem node) {
final int userIndex = IndexConverter.toUserIndex(m_column);
- String nodeText = (String)getQueuer().invokeAndWait(
- "getNodeText: " + node + " at column: " + userIndex, //$NON-NLS-1$ //$NON-NLS-2$
- new IRunnable() {
-
- public Object run() {
- return CAPUtil.getWidgetText(node,
- SwtToolkitConstants.WIDGET_TEXT_KEY_PREFIX
- + m_column, node.getText(m_column));
-
- }
- });
-
- return nodeText;
+ return getQueuer().invokeAndWait(
+ "getNodeText: " + node + " at column: " + userIndex, //$NON-NLS-1$ //$NON-NLS-2$
+ new IRunnable<String>() {
+ public String run() {
+ return CAPUtil.getWidgetText(node,
+ SwtToolkitConstants.WIDGET_TEXT_KEY_PREFIX
+ + m_column, node.getText(m_column));
+ }
+ });
}
/**
@@ -122,21 +115,19 @@ public class TableTreeOperationContext extends TreeOperationContext {
super.scrollNodeToVisible(node);
getQueuer().invokeAndWait("showColumn: " + node, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
getTree().showColumn(getTree().getColumn(m_column));
return null;
}
-
});
final Rectangle nodeBoundsRelativeToParent = getNodeBounds(node);
final Tree tree = getTree();
getQueuer().invokeAndWait("getNodeBoundsRelativeToParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
org.eclipse.swt.graphics.Point cellOriginRelativeToParent =
tree.getDisplay().map(
tree, tree.getParent(),
@@ -151,11 +142,10 @@ public class TableTreeOperationContext extends TreeOperationContext {
}
});
- Control parent = (Control) getQueuer().invokeAndWait("getParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- tree.getParent();
- return null;
+ Control parent = getQueuer().invokeAndWait("getParent", //$NON-NLS-1$
+ new IRunnable<Control>() {
+ public Control run() {
+ return tree.getParent();
}
});
@@ -168,11 +158,9 @@ public class TableTreeOperationContext extends TreeOperationContext {
*/
public Rectangle getNodeBounds(final TreeItem node) {
org.eclipse.swt.graphics.Rectangle r =
- (org.eclipse.swt.graphics.Rectangle)
getQueuer().invokeAndWait("getNodeBounds: " + node, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ new IRunnable<org.eclipse.swt.graphics.Rectangle>() {
+ public org.eclipse.swt.graphics.Rectangle run() {
Tree tree = getTree();
org.eclipse.swt.graphics.Rectangle bounds =
SwtUtils.getBounds(node, m_column);
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TreeOperationContext.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TreeOperationContext.java
index 1af49374a..a402e7fd1 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TreeOperationContext.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/tree/TreeOperationContext.java
@@ -78,11 +78,9 @@ public class TreeOperationContext
* {@inheritDoc}
*/
public String getRenderedText(final TreeItem node)
- throws StepExecutionException {
-
- return (String)getQueuer().invokeAndWait(
- "getText", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ throws StepExecutionException {
+ return getQueuer().invokeAndWait("getText", new IRunnable<String>() { //$NON-NLS-1$
+ public String run() {
return CAPUtil.getWidgetText(node, node.getText());
}
});
@@ -92,19 +90,18 @@ public class TreeOperationContext
* {@inheritDoc}
*/
public boolean isVisible(final TreeItem node) {
- Boolean visible = (Boolean)getQueuer().invokeAndWait("isVisible", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ return getQueuer().invokeAndWait("isVisible", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
TreeItem item = node;
boolean vis = true;
while (item != null && item.getParentItem() != null) {
vis = item.getParentItem().getExpanded();
item = item.getParentItem();
}
- return vis ? Boolean.TRUE : Boolean.FALSE;
+ return vis;
}
});
- return visible.booleanValue();
}
/**
@@ -112,17 +109,13 @@ public class TreeOperationContext
*/
public Rectangle getVisibleRowBounds(Rectangle rowBounds) {
org.eclipse.swt.graphics.Rectangle r =
- (org.eclipse.swt.graphics.Rectangle)
getQueuer().invokeAndWait("getVisibleRowBounds: " + rowBounds, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ new IRunnable<org.eclipse.swt.graphics.Rectangle>() {
+ public org.eclipse.swt.graphics.Rectangle run() {
Tree tree = getTree();
org.eclipse.swt.graphics.Rectangle visibleBounds =
tree.getClientArea();
-
return visibleBounds;
-
}
});
@@ -143,8 +136,8 @@ public class TreeOperationContext
log.debug("Collapsing node: " //$NON-NLS-1$
+ node);
}
- getQueuer().invokeAndWait("collapse", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ getQueuer().invokeAndWait("collapse", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
Event collapseEvent = new Event();
collapseEvent.time = (int)System.currentTimeMillis();
collapseEvent.type = SWT.Collapse;
@@ -177,11 +170,9 @@ public class TreeOperationContext
.getClassLoader());
getQueuer().invokeAndWait("Scroll Tree item: " + node //$NON-NLS-1$
- + " to visible", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ + " to visible", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
tree.showItem(node);
-
- // Return value not used
return null;
}
});
@@ -203,8 +194,8 @@ public class TreeOperationContext
log.debug("Node bounds : " + visibleNodeBounds); //$NON-NLS-1$
}
- getQueuer().invokeAndWait("expand", new IRunnable() { //$NON-NLS-1$
- public Object run() throws StepExecutionException {
+ getQueuer().invokeAndWait("expand", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() throws StepExecutionException {
Event expandEvent = new Event();
expandEvent.time = (int)System.currentTimeMillis();
@@ -215,7 +206,6 @@ public class TreeOperationContext
node.setExpanded(true);
tree.update();
- // Return value not used
return null;
}
});
@@ -232,9 +222,9 @@ public class TreeOperationContext
* {@inheritDoc}
*/
public TreeItem[] getRootNodes() {
- return (TreeItem[]) getQueuer().invokeAndWait("getRootNode", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ return getQueuer().invokeAndWait("getRootNode", //$NON-NLS-1$
+ new IRunnable<TreeItem[]>() {
+ public TreeItem[] run() {
return getTree().getItems();
}
});
@@ -247,15 +237,12 @@ public class TreeOperationContext
// FIXME zeb: Verify that getExpanded() works like I think it does:
// It should return false if any of the parent nodes are
// collapsed.
- return ((Boolean)getQueuer().invokeAndWait(
- "isExpanded: " + node, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
- return node.getExpanded() ? Boolean.TRUE : Boolean.FALSE;
- }
-
- })).booleanValue();
+ return getQueuer().invokeAndWait("isExpanded: " + node, //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() {
+ return node.getExpanded();
+ }
+ });
}
/**
@@ -269,10 +256,9 @@ public class TreeOperationContext
SwtUtils.waitForDisplayIdle(node.getDisplay());
org.eclipse.swt.graphics.Rectangle visibleRowBounds =
- (org.eclipse.swt.graphics.Rectangle)getQueuer().invokeAndWait(
- "getVisibleNodeBounds " + node, new IRunnable() { //$NON-NLS-1$
-
- public Object run() {
+ getQueuer().invokeAndWait(
+ "getVisibleNodeBounds " + node, new IRunnable<org.eclipse.swt.graphics.Rectangle>() { //$NON-NLS-1$
+ public org.eclipse.swt.graphics.Rectangle run() {
final Rectangle nodeBounds = getNodeBounds(node);
return SwtPointUtil.toSwtRectangle(
getVisibleRowBounds(nodeBounds));
@@ -290,8 +276,8 @@ public class TreeOperationContext
scrollNodeToVisible(node);
getQueuer().invokeAndWait(
- "selectNodeCheckbox", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ "selectNodeCheckbox", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
Tree tree = getTree();
boolean toggledValue = !node.getChecked();
node.setChecked(toggledValue);
@@ -315,13 +301,12 @@ public class TreeOperationContext
public void verifyCheckboxSelection(final TreeItem node,
final boolean checked) {
scrollNodeToVisible(node);
-
- Boolean checkSelected = ((Boolean)getQueuer().invokeAndWait(
- "verifyCheckboxSelection", new IRunnable() { //$NON-NLS-1$
- public Object run() {
- return new Boolean(node.getChecked());
- }
- }));
+ Boolean checkSelected = getQueuer().invokeAndWait(
+ "verifyCheckboxSelection", new IRunnable<Boolean>() { //$NON-NLS-1$
+ public Boolean run() {
+ return node.getChecked();
+ }
+ });
Verifier.equals(checked, checkSelected.booleanValue());
}
@@ -331,21 +316,19 @@ public class TreeOperationContext
*/
public void scrollNodeToVisible(final TreeItem node) {
getQueuer().invokeAndWait("showItem: " + node, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
getTree().showItem(node);
return null;
}
-
});
final Rectangle nodeBoundsRelativeToParent = getNodeBounds(node);
final Tree tree = getTree();
getQueuer().invokeAndWait("getNodeBoundsRelativeToParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
+ new IRunnable<Void>() {
+ public Void run() {
org.eclipse.swt.graphics.Point cellOriginRelativeToParent =
tree.getDisplay().map(
tree, tree.getParent(),
@@ -360,18 +343,15 @@ public class TreeOperationContext
}
});
- Control parent = (Control)getQueuer().invokeAndWait("getParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- tree.getParent();
- return null;
- }
- });
-
+ Control parent = getQueuer().invokeAndWait("getParent", //$NON-NLS-1$
+ new IRunnable<Control>() {
+ public Control run() {
+ return tree.getParent();
+ }
+ });
getRobot().scrollToVisible(parent,
SwtPointUtil.toSwtRectangle(nodeBoundsRelativeToParent));
-
}
/**
@@ -387,11 +367,11 @@ public class TreeOperationContext
return rootNodes[index];
}
- return (TreeItem) getQueuer().invokeAndWait(
+ return getQueuer().invokeAndWait(
"getChild: " + parent + "; With index: " + index, //$NON-NLS-1$ //$NON-NLS-2$
- new IRunnable() {
+ new IRunnable<TreeItem>() {
- public Object run() {
+ public TreeItem run() {
try {
return parent.getItem(index);
} catch (IllegalArgumentException iae) {
@@ -406,13 +386,11 @@ public class TreeOperationContext
* {@inheritDoc}
*/
public TreeItem getParent(final TreeItem child) {
- return (TreeItem) getQueuer().invokeAndWait("getParent: " + child, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ return getQueuer().invokeAndWait("getParent: " + child, //$NON-NLS-1$
+ new IRunnable<TreeItem>() {
+ public TreeItem run() {
return child.getParentItem();
}
-
});
}
@@ -427,15 +405,13 @@ public class TreeOperationContext
* {@inheritDoc}
*/
public TreeItem[] getSelectedNodes() {
- return (TreeItem[]) getQueuer().invokeAndWait("getSelectedNodes", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ return getQueuer().invokeAndWait("getSelectedNodes", //$NON-NLS-1$
+ new IRunnable<TreeItem[]>() {
+ public TreeItem[] run() {
TreeItem[] selectedItems = getTree().getSelection();
SelectionUtil.validateSelection(selectedItems);
return selectedItems;
}
-
});
}
@@ -446,13 +422,11 @@ public class TreeOperationContext
if (parent == null) {
return getRootNodes();
}
- return (TreeItem[]) getQueuer().invokeAndWait("getChildren: " + parent, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ return getQueuer().invokeAndWait("getChildren: " + parent, //$NON-NLS-1$
+ new IRunnable<TreeItem[]>() {
+ public TreeItem[] run() {
return parent.getItems();
}
-
});
}
@@ -463,14 +437,12 @@ public class TreeOperationContext
if (parent == null) {
return getRootNodes().length;
}
- return ((Integer)getQueuer().invokeAndWait("getChildren: " + parent, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
- return new Integer(parent.getItemCount());
- }
-
- })).intValue();
+ return getQueuer().invokeAndWait("getChildren: " + parent, //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() {
+ return parent.getItemCount();
+ }
+ });
}
/**
@@ -480,9 +452,9 @@ public class TreeOperationContext
final Collection<String> res = new ArrayList<String>();
getQueuer().invokeAndWait("getNodeText: " + node, //$NON-NLS-1$
- new IRunnable() {
+ new IRunnable<Void>() {
- public Object run() {
+ public Void run() {
int colCount = getTree().getColumnCount();
for (int i = 0; i < colCount; i++) {
@@ -512,11 +484,9 @@ public class TreeOperationContext
*/
public Rectangle getNodeBounds(final TreeItem node) {
org.eclipse.swt.graphics.Rectangle r =
- (org.eclipse.swt.graphics.Rectangle) getQueuer()
- .invokeAndWait("getNodeBounds: " + node, //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() {
+ getQueuer().invokeAndWait("getNodeBounds: " + node, //$NON-NLS-1$
+ new IRunnable<org.eclipse.swt.graphics.Rectangle>() {
+ public org.eclipse.swt.graphics.Rectangle run() {
Tree tree = getTree();
org.eclipse.swt.graphics.Rectangle bounds =
SwtUtils.getRelativeWidgetBounds(
@@ -534,14 +504,12 @@ public class TreeOperationContext
*/
public int getIndexOfChild(final TreeItem parent, final TreeItem child) {
if (parent != null) {
- return ((Integer) (getQueuer().invokeAndWait("getIndexOfChild", //$NON-NLS-1$
- new IRunnable() {
-
- public Object run() throws StepExecutionException {
- return new Integer(parent.indexOf(child));
+ return getQueuer().invokeAndWait("getIndexOfChild", //$NON-NLS-1$
+ new IRunnable<Integer>() {
+ public Integer run() throws StepExecutionException {
+ return parent.indexOf(child);
}
-
- }))).intValue();
+ });
}
TreeItem [] rootNodes = getRootNodes();
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/util/SimulatedTooltip.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/util/SimulatedTooltip.java
index e7e785f70..838db97e2 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/util/SimulatedTooltip.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/tester/util/SimulatedTooltip.java
@@ -124,26 +124,24 @@ public class SimulatedTooltip extends Thread {
+ ": managing started"); //$NON-NLS-1$
final IEventThreadQueuer queuer = new EventThreadQueuerSwtImpl();
- queuer.invokeAndWait("openSimulatedTooltipShell", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("openSimulatedTooltipShell", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
log.debug(Thread.currentThread().toString()
+ ": popup started"); //$NON-NLS-1$
openShell();
-
return null;
}
});
TimeUtil.delay(m_timeout);
- queuer.invokeAndWait("disposeSimulatedTooltipShell", new IRunnable() { //$NON-NLS-1$
- public Object run() {
+ queuer.invokeAndWait("disposeSimulatedTooltipShell", new IRunnable<Void>() { //$NON-NLS-1$
+ public Void run() {
if (m_dialog != null && !m_dialog.isDisposed()) {
m_dialog.dispose();
log.debug(Thread.currentThread().toString()
+ ": popup stopped"); //$NON-NLS-1$
}
-
return null;
}
});
diff --git a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/utils/SwtUtils.java b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/utils/SwtUtils.java
index af409c9c9..bfaacfe1a 100644
--- a/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/utils/SwtUtils.java
+++ b/org.eclipse.jubula.rc.swt/src/org/eclipse/jubula/rc/swt/utils/SwtUtils.java
@@ -114,9 +114,9 @@ public class SwtUtils {
*/
public static Widget invokeGetWidgetAtCursorLocation() {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- Widget widget = (Widget)evThreadQueuer.invokeAndWait("getWidgetAtCursorLocation", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ Widget widget = evThreadQueuer.invokeAndWait("getWidgetAtCursorLocation", //$NON-NLS-1$
+ new IRunnable<Widget>() {
+ public Widget run() throws StepExecutionException {
return getWidgetAtCursorLocation();
}
});
@@ -128,17 +128,17 @@ public class SwtUtils {
*/
public static Control getCursorControl() {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- return (Control) evThreadQueuer.invokeAndWait("getCursorControl", //$NON-NLS-1$
- new IRunnable() {
- public Object run() {
- Display disp = Display.getCurrent();
- if (disp == null || disp.isDisposed()) {
- return null;
+ return evThreadQueuer.invokeAndWait("getCursorControl", //$NON-NLS-1$
+ new IRunnable<Control>() {
+ public Control run() {
+ Display disp = Display.getCurrent();
+ if (disp == null || disp.isDisposed()) {
+ return null;
+ }
+
+ return disp.getCursorControl();
}
-
- return disp.getCursorControl();
- }
- });
+ });
}
/**
@@ -245,10 +245,10 @@ public class SwtUtils {
*/
public static Control checkControlParent(final Control control) {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- return (Control)evThreadQueuer.invokeAndWait("checkControlParent", //$NON-NLS-1$
- new IRunnable() {
+ return evThreadQueuer.invokeAndWait("checkControlParent", //$NON-NLS-1$
+ new IRunnable<Control>() {
- public Object run() throws StepExecutionException {
+ public Control run() throws StepExecutionException {
if (control != null && !control.isDisposed()) {
Control parent = control.getParent();
if (parent instanceof CCombo
@@ -271,9 +271,9 @@ public class SwtUtils {
*/
public static Widget getWidgetParent(final Widget widget) {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- Widget parent = (Widget)evThreadQueuer.invokeAndWait("getWidgetParent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ Widget parent = evThreadQueuer.invokeAndWait("getWidgetParent", //$NON-NLS-1$
+ new IRunnable<Widget>() {
+ public Widget run() throws StepExecutionException {
if (widget == null || widget.isDisposed()) {
return null;
}
@@ -431,17 +431,16 @@ public class SwtUtils {
final boolean recurse) {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- Widget [] widgets = (Widget[])evThreadQueuer.invokeAndWait("getWidgetChildren", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
- if (widget == null || widget.isDisposed()) {
- return new Widget [] {};
- }
+ Widget[] widgets = evThreadQueuer.invokeAndWait("getWidgetChildren", //$NON-NLS-1$
+ new IRunnable<Widget[]>() {
+ public Widget[] run() throws StepExecutionException {
+ if (widget == null || widget.isDisposed()) {
+ return new Widget[] {};
+ }
- return getWidgetChildrenImpl(widget,
- recurse);
- }
- });
+ return getWidgetChildrenImpl(widget, recurse);
+ }
+ });
return widgets;
}
@@ -1160,13 +1159,12 @@ public class SwtUtils {
*/
public static String toString(final Widget widget) {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- String widgetToStr = (String)evThreadQueuer.invokeAndWait("toString", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
- return String.valueOf(widget);
- }
- });
- return widgetToStr;
+ return evThreadQueuer.invokeAndWait("toString", //$NON-NLS-1$
+ new IRunnable<String>() {
+ public String run() throws StepExecutionException {
+ return String.valueOf(widget);
+ }
+ });
}
/**
@@ -1184,21 +1182,17 @@ public class SwtUtils {
* given widget
*
* @param widget the widget to check the mouse position for
- * @return true if mouse curser is inside the bounds, false otherwise.
+ * @return true if mouse cursor is inside the bounds, false otherwise.
*/
public static boolean isMouseCursorInWidget(final Widget widget) {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- boolean isInComponent = ((Boolean)evThreadQueuer.invokeAndWait(
- "isInComponent", //$NON-NLS-1$
- new IRunnable() {
- public Object run() throws StepExecutionException {
+ return evThreadQueuer.invokeAndWait("isInComponent", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
+ public Boolean run() throws StepExecutionException {
return SwtUtils.getWidgetBounds(widget).contains(
- widget.getDisplay().getCursorLocation())
- ? Boolean.TRUE : Boolean.FALSE;
+ widget.getDisplay().getCursorLocation());
}
-
- })).booleanValue();
- return isInComponent;
+ });
}
/**
@@ -1215,21 +1209,20 @@ public class SwtUtils {
final Widget eventWidget) {
IEventThreadQueuer evThreadQueuer = new EventThreadQueuerSwtImpl();
- return ((Boolean)evThreadQueuer.invokeAndWait("getWidgetChildren", //$NON-NLS-1$
- new IRunnable() {
+ return evThreadQueuer.invokeAndWait("getWidgetChildren", //$NON-NLS-1$
+ new IRunnable<Boolean>() {
- public Object run() throws StepExecutionException {
+ public Boolean run() throws StepExecutionException {
if (boundsWidget == null || boundsWidget.isDisposed()
|| eventWidget == null || eventWidget.isDisposed()) {
-
return Boolean.FALSE;
}
Rectangle widgetBounds = getWidgetBounds(boundsWidget);
boolean isInBounds = widgetBounds.equals(
widgetBounds.union(getWidgetBounds(eventWidget)));
- return isInBounds ? Boolean.TRUE : Boolean.FALSE;
+ return isInBounds;
}
- })).booleanValue();
+ });
}
/**

Back to the top