[jbosstools-commits] JBoss Tools SVN: r22786 - in trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: types and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jun 14 09:55:14 EDT 2010


Author: lzoubek at redhat.com
Date: 2010-06-14 09:55:13 -0400 (Mon, 14 Jun 2010)
New Revision: 22786

Modified:
   trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareViews.java
   trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
   trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
Log:
SWTBot Extensions : added consoleView.switchConsole

Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareViews.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareViews.java	2010-06-14 12:41:39 UTC (rev 22785)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/PrepareViews.java	2010-06-14 13:55:13 UTC (rev 22786)
@@ -6,6 +6,7 @@
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.jboss.tools.ui.bot.ext.SWTTestExt;
 import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
 
 /**
  * this is a special requirement which should run only once, main aim of this is  to prepare
@@ -27,14 +28,14 @@
 				return new Vector<String>();
 			}
 			public String getName() {
-				return "Welcome";
+				return IDELabel.View.WELCOME;
 			}});
 		
 		// force console view not to steal focus when something happens
 		try {
 		SWTBotView consoleView = SWTTestExt.console.show();
-		consoleView.toolbarToggleButton("Show Console When Standard Out Changes").deselect();
-		consoleView.toolbarToggleButton("Show Console When Standard Error Changes").deselect();
+		consoleView.toolbarToggleButton(IDELabel.ConsoleView.BUTTON_SHOW_WHEN_STDOUT_CHANGES_TOOLTIP).deselect();
+		consoleView.toolbarToggleButton(IDELabel.ConsoleView.BUTTON_SHOW_WHEN_STDERR_CHANGES_TOOLTIP).deselect();
 		} catch (Exception ex) {
 			// do nothing since buttons must not always be available 
 		}

Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java	2010-06-14 12:41:39 UTC (rev 22785)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java	2010-06-14 13:55:13 UTC (rev 22786)
@@ -400,6 +400,9 @@
    public static class ConsoleView {
 
      public static final String BUTTON_CLEAR_CONSOLE_TOOLTIP = "Clear Console";
+     public static final String BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP = "Display Selected Console";
+     public static final String BUTTON_SHOW_WHEN_STDOUT_CHANGES_TOOLTIP = "Show Console When Standard Out Changes";
+     public static final String BUTTON_SHOW_WHEN_STDERR_CHANGES_TOOLTIP = "Show Console When Standard Error Changes";
      
    }
    

Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java	2010-06-14 12:41:39 UTC (rev 22785)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ConsoleView.java	2010-06-14 13:55:13 UTC (rev 22786)
@@ -11,9 +11,14 @@
 package org.jboss.tools.ui.bot.ext.view;
 
 import org.apache.log4j.Logger;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
+import org.hamcrest.core.IsAnything;
 import org.jboss.tools.ui.bot.ext.gen.ActionItem.View.GeneralConsole;
 import org.jboss.tools.ui.bot.ext.types.IDELabel;
 /**
@@ -63,6 +68,27 @@
       // Do nothing Clear Console button is not available 
     }
 	}
+	/**
+	 * switches content displayed in cosole (see 'Display Selected Console' toolbar button)
+	 * if content cannot be switched (e.g. only one console is displayed in view or console name does not match given
+	 * String param) return false
+	 * @param containedInonsoleName String contained in name of console to switch on
+	 */
+	public boolean switchConsole(String containedInonsoleName) {
+		SWTBotView consoleView = show();
+		SWTBotToolbarDropDownButton button = consoleView.toolbarDropDownButton(IDELabel.ConsoleView.BUTTON_DISPLAY_SELECTED_CONSOLE_TOOLTIP);
+		if (button.isEnabled()) {
+			for (SWTBotMenu menu : button.menuItems(new IsAnything<MenuItem>())) 
+			{
+				if (menu.getText().contains(containedInonsoleName)) {
+					log.info("Switching consoleView to display '"+menu.getText()+"'. console");
+					menu.click();
+					return true;
+				}
+			}
+		}
+		return false;
+	}
 	
 	public String getConsoleText (long sleepTime , long timeOut , boolean quitWhenNoChange){
 	  



More information about the jbosstools-commits mailing list