Author: jpeterka
Date: 2010-10-25 09:20:33 -0400 (Mon, 25 Oct 2010)
New Revision: 26029
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestConnection.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestContextMenu.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestGraph.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestNode.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTZestBot.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
Log:
Zest support for bot added into SWTBotExt
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-10-25
11:23:54 UTC (rev 26028)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-10-25
13:20:33 UTC (rev 26029)
@@ -19,7 +19,10 @@
org.junit4;bundle-version="4.5.0",
org.eclipse.jdt.core;bundle-version="3.5.0",
org.eclipse.ui.editors;bundle-version="3.5.0",
- org.eclipse.core.resources;bundle-version="3.5.0"
+ org.eclipse.core.resources;bundle-version="3.5.0",
+ org.eclipse.draw2d;bundle-version="3.6.1",
+ org.eclipse.zest.core;bundle-version="1.2.0",
+ org.eclipse.zest.layouts;bundle-version="1.1.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Eclipse-RegisterBuddy: org.apache.log4j
@@ -32,6 +35,7 @@
org.jboss.tools.ui.bot.ext.parts,
org.jboss.tools.ui.bot.ext.types,
org.jboss.tools.ui.bot.ext.view,
- org.jboss.tools.ui.bot.ext.widgets
+ org.jboss.tools.ui.bot.ext.widgets,
+ org.jboss.tools.ui.bot.ext.zest
Bundle-Vendor: JBoss by Red Hat
Bundle-ClassPath: .
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestConnection.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestConnection.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestConnection.java 2010-10-25
13:20:33 UTC (rev 26029)
@@ -0,0 +1,70 @@
+package org.jboss.tools.ui.bot.ext.zest;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+
+/**
+ * SWTBot zest connnection bot
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotZestConnection extends AbstractSWTBot<GraphConnection> {
+
+
+ /**
+ * Default Constructor
+ * @param connection
+ */
+ public SWTBotZestConnection(GraphConnection connection) {
+ super(connection);
+ }
+
+ /**
+ * Provides click above Zest Connection
+ */
+ @Override
+ public AbstractSWTBot<GraphConnection> click() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ public void run() {
+ // Get midpoint
+ Graph graph = widget.getGraphModel();
+ PointList pl = widget.getConnectionFigure().getPoints();
+ Point midpoint = pl.getMidpoint();
+
+ Event event = new Event();
+ event.type = SWT.MouseMove;
+ event.x = graph.toDisplay(midpoint.x, midpoint.y).x;
+ event.y = graph.toDisplay(midpoint.x, midpoint.y).y;
+ widget.getDisplay().post(event);
+
+ event = new Event();
+ event.type = SWT.MouseDown;
+ event.button = 1;
+ widget.getDisplay().post(event);
+
+ event = new Event();
+ event.type = SWT.MouseUp;
+ event.button = 1;
+ widget.getDisplay().post(event);
+ }
+ });
+ return this;
+ }
+
+ /**
+ * Returns context menu of connection
+ * @return
+ */
+ public SWTBotZestContextMenu contextMenu() {
+ return new SWTBotZestContextMenu(widget.getGraphModel());
+ }
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestConnection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestContextMenu.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestContextMenu.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestContextMenu.java 2010-10-25
13:20:33 UTC (rev 26029)
@@ -0,0 +1,168 @@
+package org.jboss.tools.ui.bot.ext.zest;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.instanceOf;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.hamcrest.Matcher;
+
+/**
+ * Context menu bot for Zest widgets
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotZestContextMenu extends AbstractSWTBot<Control> {
+
+ /**
+ * Default Constructor
+ *
+ * @param control
+ */
+ SWTBotZestContextMenu(Control control) {
+ super(control);
+ }
+
+ /**
+ * Invokes context menu sequence
+ *
+ * @param texts
+ */
+ public void clickMenu(final String... texts) {
+ log.debug("Clicking graph menu: ");
+
+ // Run in UI Thread
+ final MenuItem menuItem = UIThreadRunnable
+ .syncExec(new WidgetResult<MenuItem>() {
+ public MenuItem run() {
+ // Get menu from control
+
+ Menu menu = widget.getMenu();
+
+ MenuItem lastMenuItem = null;
+ lastMenuItem = getLastMenuItem(texts, menu);
+
+ log.debug("Final menu returned");
+ // if last menu found, click and hide
+ if (lastMenuItem != null) {
+ // Click
+ clickOnMenuItem(lastMenuItem);
+ // Hide
+ hideMenu(lastMenuItem.getParent());
+ }
+ return lastMenuItem;
+ }
+ });
+ if (menuItem == null)
+ throw new WidgetNotFoundException("Unable to find menuitem");
+
+ }
+
+ /**
+ * Gets last menitem on menuitem hierary. UIThread methods
+ *
+ * @param text
+ */
+ private MenuItem getLastMenuItem(String[] texts, Menu menu) {
+
+ if (menu == null)
+ throw new WidgetNotFoundException("No context menu found");
+
+ Menu nextMenu = menu;
+ MenuItem nextMenuItem = null;
+ for (String text : texts) {
+ // Get next menu
+ nextMenuItem = null;
+
+ nextMenuItem = getNextMenuItem(text, nextMenu);
+ // Set menu as next menu item menu
+ if (nextMenuItem == null) {
+ hideMenu(nextMenu);
+ return null;
+ } else {
+ log.debug("next menu for menu item " + nextMenuItem.getText()
+ + " found");
+ nextMenu = nextMenuItem.getMenu();
+ }
+ }
+ return nextMenuItem;
+ }
+
+ /**
+ * Gets next menuitem of given text. UIThread method
+ *
+ * @param text
+ * @param menu
+ * @return
+ */
+ @SuppressWarnings("unchecked")
+ private MenuItem getNextMenuItem(String text, Menu menu) {
+
+ MenuItem nextMenuItem = null;
+
+ Matcher<?> matcher = allOf(instanceOf(MenuItem.class),
+ withMnemonic(text));
+
+ showMenu(menu);
+ MenuItem[] items = menu.getItems();
+ log.debug("Menu items found:" + items.length + " items");
+ // menu item loops
+ for (MenuItem i : items) {
+ log.debug("Trying to match " + text + " with " + i.getText());
+ if (matcher.matches(i)) {
+ nextMenuItem = i;
+ log.debug("Next menu item with text:" + text + " found");
+ break;
+ }
+ }
+
+ return nextMenuItem;
+ }
+
+ /**
+ * Clicks on given menuitem. UIThread method
+ *
+ * @param menuItem
+ */
+ private void clickOnMenuItem(final MenuItem menuItem) {
+ System.out.println("Menuitem:" + menuItem);
+ final Event event = new Event();
+ event.time = (int) System.currentTimeMillis();
+ event.widget = menuItem;
+ event.display = menuItem.getDisplay();
+ event.type = SWT.Selection;
+
+ log.debug("Click event generated");
+
+ menuItem.notifyListeners(SWT.Selection, event);
+ log.debug("Event sent");
+ }
+
+ /**
+ * Hides menu including all predecessor. UIThread method
+ *
+ * @param menu
+ */
+ private static void hideMenu(final Menu menu) {
+ menu.notifyListeners(SWT.Hide, new Event());
+ if (menu.getParentMenu() != null) {
+ hideMenu(menu.getParentMenu());
+ }
+ }
+
+ /**
+ * Shows menu. UIThread method
+ */
+ private void showMenu(final Menu menu) {
+ menu.notifyListeners(SWT.Show, new Event());
+ }
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestContextMenu.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestGraph.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestGraph.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestGraph.java 2010-10-25
13:20:33 UTC (rev 26029)
@@ -0,0 +1,223 @@
+package org.jboss.tools.ui.bot.ext.zest;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.draw2d.EventDispatcher;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * Zest Graph Model bot
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotZestGraph extends AbstractSWTBotControl<Graph> {
+
+ Logger log = Logger.getLogger(SWTBotZestGraph.class);
+
+ protected EventDispatcher eventDispatcher;
+
+ public SWTBotZestGraph(Graph g) {
+ super(g);
+ eventDispatcher = g.getLightweightSystem().getRootFigure()
+ .internalGetEventDispatcher();
+ }
+
+ /**
+ * Performs click above Bot zest Graph
+ */
+ @Override
+ protected AbstractSWTBot<Graph> click() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ public void run() {
+ // Move mouse
+ Event event = new Event();
+ event.type = SWT.MouseMove;
+ event.x = widget.toDisplay(widget.getLocation().x, widget
+ .getLocation().y).x;
+ event.y = widget.toDisplay(widget.getLocation().x, widget
+ .getLocation().y).y;
+ widget.getDisplay().post(event);
+ // Mouse down
+ event = new Event();
+ event.type = SWT.MouseDown;
+ event.button = 1;
+ widget.getDisplay().post(event);
+ // Mouse Up
+ event = new Event();
+ event.type = SWT.MouseUp;
+ event.button = 1;
+ widget.getDisplay().post(event);
+ }
+ });
+ return this;
+ }
+
+ /**
+ *
+ * @param nodeText
+ * @return
+ */
+ public SWTBotZestNode node(final String nodeText) {
+
+ GraphNode node = UIThreadRunnable
+ .syncExec(new WidgetResult<GraphNode>() {
+
+ @SuppressWarnings("unchecked")
+ public GraphNode run() {
+ List<GraphNode> nodes = widget.getNodes();
+ for (GraphNode n : nodes) {
+
+ System.out.println(n.getText());
+ if (n.getText().equals(nodeText))
+ return n;
+ }
+ return null;
+ }
+ });
+ return new SWTBotZestNode(node);
+ }
+
+ /***
+ * Returns Graph connection given by index
+ *
+ * @param index
+ * @return
+ */
+ public SWTBotZestConnection connection(final int index) {
+ GraphConnection connection = UIThreadRunnable
+ .syncExec(new WidgetResult<GraphConnection>() {
+
+ @SuppressWarnings("unchecked")
+ public GraphConnection run() {
+ List<GraphConnection> connections = widget
+ .getConnections();
+ if (connections.size() > index - 1) {
+ return connections.get(index);
+ }
+ throw new WidgetNotFoundException(
+ "Connection widget not found");
+ }
+ });
+ return new SWTBotZestConnection(connection);
+ }
+
+ /**
+ * Returns SWTBotZestConnection given by two Zest Nodes
+ * @param node1
+ * @param node2
+ * @return
+ */
+ public SWTBotZestConnection connection(final SWTBotZestNode node1,
+ final SWTBotZestNode node2) {
+ GraphConnection connection = UIThreadRunnable
+ .syncExec(new WidgetResult<GraphConnection>() {
+
+ @SuppressWarnings("unchecked")
+ public GraphConnection run() {
+ List<GraphConnection> connections = widget
+ .getConnections();
+
+ for (GraphConnection c : connections) {
+ log.info("Node1" + node1.widget.getText());
+ log.info("Node2" + node2.widget.getText());
+ log.info("Source" + c.getSource().getText());
+ log.info("Destination"
+ + c.getDestination().getText());
+ if ((c.getSource().getText().equals(node1.widget
+ .getText()))
+ && (c.getDestination().getText()
+ .equals(node2.widget.getText())))
+ return c;
+ }
+
+ throw new WidgetNotFoundException(
+ "Connection widget not found");
+ }
+ });
+ return new SWTBotZestConnection(connection);
+ }
+
+ /**
+ * Debug method, logs graph related informations
+ */
+ public void debugGraph() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ @SuppressWarnings("unchecked")
+ public void run() {
+ // Graph Info
+ log
+ .info("********************************************************************************");
+
+ Graph g = widget;
+ log.info("Graph Nodes:" + g.getNodes().size());
+ log.info("Graph Connections" + g.getConnections().size());
+
+ Point leftUpper = new Point(g.getBounds().x, g.getBounds().y);
+ Point rightLower = new Point(g.getBounds().x
+ + g.getBounds().width, g.getBounds().y
+ + g.getBounds().height);
+ int gXtoDisp = widget.toDisplay(leftUpper.x, leftUpper.y).x;
+ int gYtoDisp = widget.toDisplay(leftUpper.x, leftUpper.y).y;
+
+ log.info("Graph position:[" + gXtoDisp + "," + gYtoDisp
+ + "] -> [" + rightLower.x + "," + rightLower.y +
"]");
+ log
+ .info("********************************************************************************");
+
+ // List Connections
+ List<GraphConnection> connections = widget.getConnections();
+ for (int i = 0; i < connections.size(); i++) {
+ GraphConnection c = connections.get(i);
+
+ PointList pl = c.getConnectionFigure().getPoints();
+ Point midpoint = pl.getMidpoint();
+ int mXtoDisp = widget.toDisplay(midpoint.x, midpoint.y).x;
+ int mYtoDisp = widget.toDisplay(midpoint.x, midpoint.y).y;
+
+ log.info("Connection:" + i + "[" + mXtoDisp + ","
+ + mYtoDisp + "]" + ",Text:" + c.getText()
+ + ",Tooltip:" + c.getTooltip());
+
+ }
+ // List Nodes
+ List<GraphNode> nodes = widget.getNodes();
+ for (int i = 0; i < nodes.size(); i++) {
+ GraphNode n = nodes.get(i);
+ int nXtoDisp = widget.toDisplay(n.getLocation().x, n
+ .getLocation().y).x;
+ int nYtoDisp = widget.toDisplay(n.getLocation().x, n
+ .getLocation().y).y;
+
+ log.info("Node:" + i + "[" + nXtoDisp + "," +
nYtoDisp
+ + "],Text:" + n.getText() + ",Tooltip:"
+ + n.getTooltip());
+ }
+ log
+ .info("********************************************************************************");
+ }
+ });
+ }
+
+ /**
+ * Returns Context menu
+ * @return
+ */
+ public SWTBotZestContextMenu contextMenu() {
+ return new SWTBotZestContextMenu(widget);
+ }
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestGraph.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestNode.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestNode.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestNode.java 2010-10-25
13:20:33 UTC (rev 26029)
@@ -0,0 +1,157 @@
+package org.jboss.tools.ui.bot.ext.zest;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBot;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphNode;
+
+/**
+ * Provides SWTBot feature for Zest Node
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotZestNode extends AbstractSWTBot<GraphNode> {
+
+ public SWTBotZestNode(GraphNode node) {
+ super(node);
+ }
+
+ /**
+ * Calculates element position to display, call it from UI thread
+ */
+ private void getDisplayPosition(Point point) {
+
+ Graph graph = widget.getGraphModel();
+
+ int absX = graph.toDisplay(widget.getLocation().x,
+ widget.getLocation().y).x;
+ int absY = graph.toDisplay(widget.getLocation().x,
+ widget.getLocation().y).y;
+
+ log.info("Node display position:" + absX + "," + absY);
+ point.x = absX;
+ point.y = absY;
+ }
+
+ /**
+ * Provides click on Zest Node
+ */
+ @Override
+ public AbstractSWTBot<GraphNode> click() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ public void run() {
+
+ Point p = new Point();
+ getDisplayPosition(p);
+
+ Event event = createEvent(SWT.MouseMove, p.x, p.y);
+ widget.getDisplay().post(event);
+
+ event = createEvent(SWT.MouseDown, 1);
+ widget.getDisplay().post(event);
+
+ event = createEvent(SWT.MouseUp, 1);
+ widget.getDisplay().post(event);
+ }
+ });
+ return this;
+ }
+
+ /**
+ * Provides dragTo method for Node. Node will be moved relatively according
+ * to x,y
+ *
+ * @param x
+ * relative points how element will be moved in x axis
+ * @param y
+ * relative points how element will be moved in y axis
+ * @throws InterruptedException
+ */
+ public void dragTo(int x, int y) throws InterruptedException {
+
+ final Point point = new Point();
+
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ getDisplayPosition(point);
+ }
+ });
+
+ log.info("Drag from:" + point.x + "," + point.y);
+ log.info("Drop to:" + (point.x + x) + "," + (point.y + y));
+ mouseDrag(point.x, point.y, point.x + x, point.y + y);
+ }
+
+ /**
+ * Returns SWTBotZestContextMenu, contextMenu
+ *
+ * @return
+ */
+ public SWTBotZestContextMenu contextMenu() {
+ return new SWTBotZestContextMenu(widget.getGraphModel());
+ }
+
+ /**
+ * Provides drag and drop of node in absolute positions
+ *
+ * @param fromXPosition
+ * @param fromYPosition
+ * @param toXPosition
+ * @param toYPosition
+ * @throws InterruptedException
+ */
+ public void mouseDrag(final int fromXPosition, final int fromYPosition,
+ final int toXPosition, final int toYPosition)
+ throws InterruptedException {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseMove, fromXPosition,
+ fromYPosition);
+ widget.getDisplay().post(event);
+ }
+ });
+ Thread.sleep(100);
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseDown, 1);
+ widget.getDisplay().post(event);
+ }
+ });
+ Thread.sleep(100);
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseMove, toXPosition,
+ toYPosition);
+ widget.getDisplay().post(event);
+ }
+ });
+ Thread.sleep(100);
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseUp, 1);
+ widget.getDisplay().post(event);
+ }
+ });
+ }
+
+ private Event createEvent(int type, int x, int y) {
+ Event event = new Event();
+ event.type = type;
+ event.x = x;
+ event.y = y;
+ return event;
+ }
+
+ private Event createEvent(int type, int button) {
+ Event event = new Event();
+ event.type = type;
+ event.button = button;
+ return event;
+ }
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTBotZestNode.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTZestBot.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTZestBot.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTZestBot.java 2010-10-25
13:20:33 UTC (rev 26029)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Obeo
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Mariot Chauvin <mariot.chauvin(a)obeo.fr> - initial API and implementation
+ *******************************************************************************/
+
+package org.jboss.tools.ui.bot.ext.zest;
+
+import java.util.List;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.zest.core.widgets.Graph;
+
+/**
+ * SWTBot extension for Zest Graph support. May be deprecated,removed when
+ * Zest support is officially added into official SWTBot
+ * @author jpeterka
+ *
+ */
+public class SWTZestBot extends SWTWorkbenchBot {
+
+
+ /**
+ * Create SWTBotZestGraph
+ * @param index index of zest graph. Usually zero.
+ * @return the SWTbot zest graph instance
+ */
+ public SWTBotZestGraph getZestGraph(int index) {
+ List<? extends Graph> graphs =
getFinder().findControls(WidgetMatcherFactory.widgetOfType(Graph.class));
+ SWTBotZestGraph graph = new SWTBotZestGraph(graphs.get(0));
+ return graph;
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/zest/SWTZestBot.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain