[jbosstools-commits] JBoss Tools SVN: r43128 - branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Aug 21 06:54:11 EDT 2012


Author: ljelinko
Date: 2012-08-21 06:54:10 -0400 (Tue, 21 Aug 2012)
New Revision: 43128

Modified:
   branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java
Log:
Added activation of workbench shell (fix for windows)

Modified: branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java
===================================================================
--- branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java	2012-08-21 10:53:40 UTC (rev 43127)
+++ branches/jbosstools-3.3.x/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/PreferencesDialog.java	2012-08-21 10:54:10 UTC (rev 43128)
@@ -1,6 +1,8 @@
 package org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences;
 
+import org.apache.log4j.Logger;
 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
 import org.jboss.tools.ui.bot.ext.SWTBotExt;
 import org.jboss.tools.ui.bot.ext.SWTBotFactory;
 import org.jboss.tools.ui.bot.ext.gen.ActionItem.Preference;
@@ -8,6 +10,8 @@
 
 public class PreferencesDialog {
 
+	private static final Logger log = Logger.getLogger(PreferencesDialog.class);
+	
 	protected void open(String... path){
 		SWTBotExt bot = SWTBotFactory.getBot();
 		try {
@@ -16,10 +20,25 @@
 		} catch (WidgetNotFoundException e){
 			// ok
 		}
+		activateWorkbenchShell();
 		IPreference preference = Preference.create(path);
 		SWTBotFactory.getOpen().preferenceOpen(preference);
 	}
 	
+	public void activateWorkbenchShell(){
+		log.info("Trying to activate workbench shell");
+		SWTBotShell[] shells = SWTBotFactory.getBot().shells();
+		if (shells.length == 1){
+			log.info("Only one shell present, assuming it's workbench and activating");
+			shells[0].activate();
+		} else {
+			log.info("More than one shell present");
+			for (SWTBotShell shell : shells){
+				log.info(shell.getText());
+			}
+		}
+	}
+	
 	public void ok(){
 		SWTBotFactory.getBot().button("OK").click();
 	}



More information about the jbosstools-commits mailing list