Author: ljelinko
Date: 2011-12-15 08:54:25 -0500 (Thu, 15 Dec 2011)
New Revision: 37353
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java
Log:
Created
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/task/debug/WriteAllWidgets.java 2011-12-15
13:54:25 UTC (rev 37353)
@@ -0,0 +1,56 @@
+package org.jboss.tools.portlet.ui.bot.task.debug;
+
+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.asyncExec;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.hamcrest.Matcher;
+import org.jboss.tools.portlet.ui.bot.task.AbstractSWTTask;
+
+public class WriteAllWidgets extends AbstractSWTTask {
+
+ private Matcher<? extends Widget> matcher;
+
+ private Widget widget;
+
+ public WriteAllWidgets(Matcher<? extends Widget> matcher) {
+ super();
+ this.matcher = matcher;
+ }
+
+ public WriteAllWidgets(Widget widget, Matcher<? extends Widget> matcher) {
+ super();
+ this.matcher = matcher;
+ this.widget = widget;
+ }
+
+ @Override
+ public void perform() {
+ final List<? extends Widget> widgets = getBot().widgets(matcher,
getParentWidget());
+
+ asyncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ writeWidgets(widgets);
+ }
+ });
+ }
+
+ private Widget getParentWidget() {
+ if (widget == null){
+ return getBot().activeShell().widget;
+ }
+ return widget;
+ }
+
+ private void writeWidgets(List<? extends Widget> widgets){
+ System.out.println("List of current widgets");
+ for (Widget w : widgets){
+ System.out.println(w);
+ }
+ System.out.println("End of list");
+ }
+}
Show replies by date