[jbosstools-commits] JBoss Tools SVN: r42671 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Jul 23 07:45:32 EDT 2012
Author: vpakan at redhat.com
Date: 2012-07-23 07:45:31 -0400 (Mon, 23 Jul 2012)
New Revision: 42671
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
Log:
Added getToolbarButtonWitTooltip() method as workaround for SWTBot method not working with Eclipse Juno.
Added: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java (rev 0)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java 2012-07-23 11:45:31 UTC (rev 42671)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.view;
+
+import org.apache.log4j.Logger;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+/**
+ * Represents JBoss Tools Palette View
+ * @author vpakan at redhat.com
+ *
+ */
+public class PaletteView extends ViewBase {
+ Logger log = Logger.getLogger(PaletteView.class);
+ public PaletteView() {
+ viewObject = ActionItem.View.JBossToolsWebJBossToolsPalette.LABEL;
+ }
+
+}
Property changes on: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/PaletteView.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java 2012-07-23 10:50:31 UTC (rev 42670)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ViewBase.java 2012-07-23 11:45:31 UTC (rev 42671)
@@ -1,6 +1,7 @@
package org.jboss.tools.ui.bot.ext.view;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
@@ -65,7 +66,11 @@
public SWTBotView show() {
return open.viewOpen(viewObject);
}
-
+ /**
+ * Get toolbar buttons contained within view
+ * It's workaround for Eclipse Juno where SWTBot is not able to find toolbar buttons of view
+ * @return
+ */
public List<SWTBotToolbarButton> getToolbarButtons() {
return UIThreadRunnable.syncExec(new ListResult<SWTBotToolbarButton>() {
@@ -106,4 +111,46 @@
}
});
}
+ /**
+ * Get first toolbar button contained within view with toolTip
+ * It's workaround for Eclipse Juno where SWTBot is not able to find toolbar buttons of view
+ * @param toolTip
+ * @param index
+ * @return
+ */
+ public SWTBotToolbarButton getToolbarButtonWitTooltip (String toolTip){
+ return getToolbarButtonWitTooltip(toolTip,0);
+ }
+ /**
+ * Get toolbar button contained within view with toolTip and order specified by index
+ * It's workaround for Eclipse Juno where SWTBot is not able to find toolbar buttons of view
+ * @param toolTip
+ * @param index
+ * @return
+ */
+ public SWTBotToolbarButton getToolbarButtonWitTooltip (String toolTip, int index){
+ SWTBotToolbarButton result = null;
+ List<SWTBotToolbarButton> tbList = getToolbarButtons();
+ if (tbList != null && tbList.size() > 0){
+ int indexFound = -1;
+ Iterator<SWTBotToolbarButton> itToolbarButtons = tbList.iterator();
+ while (result == null && itToolbarButtons.hasNext()){
+ SWTBotToolbarButton tbItem = itToolbarButtons.next();
+ if (toolTip.equals(tbItem.getToolTipText())){
+ indexFound++;
+ if(indexFound >= index){
+ result = tbItem;
+ }
+ }
+ }
+ }
+ if (result != null){
+ return result;
+ }
+ else{
+ throw new WidgetNotFoundException("Unable to find toolbar button with tooltip " +
+ toolTip + " within view " + viewObject.getName());
+ }
+
+ }
}
More information about the jbosstools-commits
mailing list