Author: jgargula
Date: 2012-01-25 10:43:20 -0500 (Wed, 25 Jan 2012)
New Revision: 38170
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java
Log:
Added method which return all checkBoxes
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java 2012-01-25
14:55:19 UTC (rev 38169)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotExt.java 2012-01-25
15:43:20 UTC (rev 38170)
@@ -12,13 +12,17 @@
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withStyle;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withText;
import static org.junit.Assert.fail;
+import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
@@ -26,12 +30,14 @@
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
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.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.Section;
+import org.hamcrest.Matcher;
import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
@@ -240,4 +246,23 @@
return null;
}
+
+ /**
+ * Returns current displayed checkboxes.
+ * There are included disabled checkboxes as well
+ * therefore it is necessary to check their states before use of them.
+ *
+ * @return List of current displayed checkboxes.
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public List<SWTBotCheckBox> checkBoxes() {
+ List<SWTBotCheckBox> checkBoxes = new ArrayList<SWTBotCheckBox>();
+ Matcher matcher = allOf(widgetOfType(Button.class), withStyle(SWT.CHECK,
"SWT.CHECK"));
+ for (Object widget : widgets(matcher)) {
+ if (widget != null) {
+ checkBoxes.add(new SWTBotCheckBox((Button) widget));
+ }
+ }
+ return checkBoxes;
+ }
}
Show replies by date