Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java')
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java28
1 files changed, 27 insertions, 1 deletions
diff --git a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java
index 0475fffa..ec2a960b 100644
--- a/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java
+++ b/org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008,2010 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
* Ketan Patel - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259837
+ * Jesper S Møller - https://bugs.eclipse.org/bugs/show_bug.cgi?id=322668
*******************************************************************************/
package org.eclipse.swtbot.swt.finder.waits;
@@ -15,8 +16,10 @@ package org.eclipse.swtbot.swt.finder.waits;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.hamcrest.Matcher;
/**
@@ -43,6 +46,21 @@ public abstract class Conditions {
}
/**
+ * Gets the condition for checking trees have the proper number of rows. Useful in cases where the tree is populated
+ * continuously from a non UI thread.
+ *
+ * @param tree the tree
+ * @param rowCount the number of rows that the tree must have, in order for {@link ICondition#test()} to evaluate to
+ * <code>true</code>.
+ * @return <code>true</code> if the tree has the number of rows specified. Otherwise <code>false</code>.
+ * @throws IllegalArgumentException Thrown if the row count is less then 1.
+ * @since 2.0
+ */
+ public static ICondition treeHasRows(SWTBotTree tree, int rowCount) {
+ return new TreeHasRows(tree, rowCount);
+ }
+
+ /**
* Gets the condition for checking if shells have closed. Useful in cases where a shell takes long to close.
*
* @param shell the shell to monitor.
@@ -112,4 +130,12 @@ public abstract class Conditions {
return new WaitForMenu(shell, matcher);
}
+ /**
+ * @param widget the widget
+ * @return a condition that waits until the widget is enabled.
+ * @since 2.0
+ */
+ public static ICondition widgetIsEnabled(AbstractSWTBot<? extends Widget> widget){
+ return new WidgetIsEnabledCondition(widget);
+ }
}

Back to the top