Author: vpakan(a)redhat.com
Date: 2010-03-19 07:49:17 -0400 (Fri, 19 Mar 2010)
New Revision: 20927
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
Log:
Added new methods related to shell/
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2010-03-19
09:03:43 UTC (rev 20926)
+++
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java 2010-03-19
11:49:17 UTC (rev 20927)
@@ -27,6 +27,7 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
import org.jboss.tools.ui.bot.ext.types.JobLists;
import org.jboss.tools.ui.bot.ext.types.JobState;
@@ -370,4 +371,47 @@
return parts[index + 1] + File.separator + projectName;
}
+ /**
+ * Returns true if shell with shellTitle is active
+ * @param shellTitle
+ * @param bot
+ * @return
+ */
+ public static boolean isShellActive(String shellTitle, SWTWorkbenchBot bot){
+ boolean isShellActive = false;
+ try {
+ bot.shell(shellTitle).activate();
+ isShellActive = true;
+ } catch (WidgetNotFoundException e) {
+ }
+ return isShellActive;
+ }
+ /**
+ * Returns true if shell with shellTitle is active
+ * @param shellTitle
+ * @return
+ */
+ public boolean isShellActive(String shellTitle){
+ return SWTUtilExt.isShellActive(shellTitle,bot);
+ }
+ /**
+ * Closes shell with shellTitle if shell is active
+ * @param shellTitle
+ * @param bot
+ * @return
+ */
+ public static void closeShellWhenActive(String shellTitle, SWTWorkbenchBot bot){
+ try {
+ bot.shell(shellTitle).close();
+ } catch (WidgetNotFoundException e) {
+ }
+ }
+ /**
+ * Closes shell with shellTitle if shell is active
+ * @param shellTitle
+ * @return
+ */
+ public void closeShellWhenActive(String shellTitle){
+ SWTUtilExt.closeShellWhenActive(shellTitle,bot);
+ }
}
\ No newline at end of file
Show replies by date