Author: vpakan(a)redhat.com
Date: 2011-11-29 09:11:20 -0500 (Tue, 29 Nov 2011)
New Revision: 36728
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java
Log:
Support Context Menu within SWTBotEditor.
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java 2011-11-29
13:50:59 UTC (rev 36727)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/ContextMenuHelper.java 2011-11-29
14:11:20 UTC (rev 36728)
@@ -32,6 +32,7 @@
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
@@ -322,6 +323,37 @@
clickContextMenu(parentControl, texts);
}
+ /**
+ * Clicks the context menu matching the text.
+ * @param editor editor containing requested Context Menu
+ * @param index index of StyledText widget containing requested
+ * Context Menu within editor
+ * @param text
+ * the text on the context menu.
+ * @throws WidgetNotFoundException
+ * if the widget is not found.
+ */
+ public static void clickContextMenu(final SWTBotEditor editor,
+ int index,
+ final String... texts) {
+ editor.setFocus();
+ clickContextMenu(editor.bot().styledText(index), texts);
+
+ }
+ /**
+ * Clicks the context menu matching the text.
+ * @param editor editor containing requested Context Menu
+ * @param text
+ * the text on the context menu.
+ * @throws WidgetNotFoundException
+ * if the widget is not found.
+ */
+ public static void clickContextMenu(final SWTBotEditor editor,
+ final String... texts) {
+
+ clickContextMenu(editor,0, texts);
+
+ }
private static void click(final MenuItem menuItem) {
final Event event = new Event();
Show replies by date