[jbosstools-commits] JBoss Tools SVN: r43090 - branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Aug 17 07:14:44 EDT 2012


Author: ljelinko
Date: 2012-08-17 07:14:44 -0400 (Fri, 17 Aug 2012)
New Revision: 43090

Modified:
   branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java
Log:
Added code for activation of shell

Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java	2012-08-17 10:26:57 UTC (rev 43089)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/perspective/OpenPerspectiveTask.java	2012-08-17 11:14:44 UTC (rev 43090)
@@ -29,22 +29,30 @@
 
 	@Override
 	public void perform() {
-		log.info("Opening wizard");
+		activateWorkbenchShell();
+		log.info("Opening perspective");
 		log.info("All shells: ");
 		for (SWTBotShell shell : SWTBotFactory.getBot().shells()){
 			log.info(shell.getText() + ": " + shell);
 			log.info("Is active: " + shell.isActive());
 		}
 		getBot().waitUntil(widgetIsEnabled(getBot().menu("Window")), TaskDuration.NORMAL.getTimeout());
-		log.info("Opening wizard");
-		log.info("All shells: ");
-		for (SWTBotShell shell : SWTBotFactory.getBot().shells()){
-			log.info(shell.getText() + ": " + shell);
-			log.info("Is active: " + shell.isActive());
-		}
 		SWTBotFactory.getOpen().perspective(perspective);
 	}
 	
+	public void activateWorkbenchShell(){
+		SWTBotShell[] shells = 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());
+			}
+		}
+	}
+	
 	@Override
 	public SWTBot getBot() {
 		return SWTBotFactory.getBot();



More information about the jbosstools-commits mailing list