Author: jpeterka
Date: 2010-11-05 03:33:16 -0400 (Fri, 05 Nov 2010)
New Revision: 26274
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefContextMenuExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
Log:
Various additional GEF support added to 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-11-05
07:09:35 UTC (rev 26273)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-11-05
07:33:16 UTC (rev 26274)
@@ -22,7 +22,8 @@
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"
+ org.eclipse.zest.layouts;bundle-version="1.1.0",
+ org.eclipse.swtbot.eclipse.gef.finder;bundle-version="2.0.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: org.apache.log4j
@@ -30,6 +31,7 @@
org.jboss.tools.ui.bot.ext.config,
org.jboss.tools.ui.bot.ext.config.requirement,
org.jboss.tools.ui.bot.ext.entity,
+ org.jboss.tools.ui.bot.ext.gef,
org.jboss.tools.ui.bot.ext.gen,
org.jboss.tools.ui.bot.ext.helper,
org.jboss.tools.ui.bot.ext.parts,
@@ -39,3 +41,4 @@
org.jboss.tools.ui.bot.ext.zest
Bundle-Vendor: JBoss by Red Hat
Bundle-ClassPath: .
+Import-Package: org.eclipse.gef
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefContextMenuExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefContextMenuExt.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefContextMenuExt.java 2010-11-05
07:33:16 UTC (rev 26274)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.gef;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withRegex;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.instanceOf;
+
+import org.apache.log4j.Logger;
+import org.eclipse.swt.SWT;
+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.VoidResult;
+import org.eclipse.swtbot.swt.finder.results.WidgetResult;
+import org.hamcrest.Matcher;
+
+/**
+ * Context menu bot for GEF widgets. Improved version updated to work for GEF
+ * environment
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotGefContextMenuExt {
+
+ /**
+ * Default Constructor
+ *
+ * @param control
+ */
+
+ Menu menu;
+ Logger log = Logger.getLogger(SWTBotGefContextMenuExt.class);
+
+ public SWTBotGefContextMenuExt(Menu menu) {
+ this.menu = menu;
+ }
+
+ /**
+ * Invokes context menu sequence
+ *
+ * @param texts
+ */
+ public void clickMenu(final String... texts) {
+ log.debug("Clicking graph menu: "); //$NON-NLS-1$
+
+ // Run in UI Thread
+ final MenuItem menuItem = UIThreadRunnable
+ .syncExec(new WidgetResult<MenuItem>() {
+ public MenuItem run() {
+ // Get menu from control
+
+ MenuItem lastMenuItem = null;
+ lastMenuItem = getLastMenuItem(texts, menu);
+
+ // if last menu found, click and hide
+ if (lastMenuItem != null) {
+ log.debug("Final menu returned"); //$NON-NLS-1$
+ // Click
+ // clickOnMenuItem(lastMenuItem);
+ // Hide
+ // hideMenu(lastMenuItem.getParent());
+ } else
+ log.debug("Final menu not found"); //$NON-NLS-1$
+
+ return lastMenuItem;
+ }
+ });
+
+ // Async block to avoid blocking by raised dlgs, etc.
+ if (menuItem != null)
+ UIThreadRunnable.asyncExec(new VoidResult() {
+
+ public void run() {
+ clickOnMenuItem(menuItem);
+ // Hide
+ hideMenu(menuItem.getParent());
+
+ }
+ });
+
+ if (menuItem == null)
+ throw new WidgetNotFoundException("Unable to find menuitem"); //$NON-NLS-1$
+ log.debug("GEF Context menu " + texts[texts.length - 1] + "click
finished"); //$NON-NLS-1$
+
+ }
+
+ /**
+ * 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"); //$NON-NLS-1$
+
+ 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()
//$NON-NLS-1$
+ + " found"); //$NON-NLS-1$
+ 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),
withRegex("\\s*"
+ + text + "\\s*"));
+
+ showMenu(menu);
+ MenuItem[] items = menu.getItems();
+ log.debug("Menu items found:" + items.length + " items");
//$NON-NLS-1$ //$NON-NLS-2$
+ // menu item loops
+ for (MenuItem i : items) {
+ log.debug("Trying to match " + text + " with " + i.getText());
//$NON-NLS-1$ //$NON-NLS-2$
+ if (matcher.matches(i)) {
+ nextMenuItem = i;
+ log.debug("Next menu item with text:" + text + " found");
//$NON-NLS-1$ //$NON-NLS-2$
+ break;
+ }
+ }
+
+ return nextMenuItem;
+ }
+
+ /**
+ * Clicks on given menuitem. UIThread method
+ *
+ * @param menuItem
+ */
+ private void clickOnMenuItem(final MenuItem menuItem) {
+ System.out.println("Menuitem:" + menuItem); //$NON-NLS-1$
+ 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"); //$NON-NLS-1$
+
+ menuItem.notifyListeners(SWT.Selection, event);
+ log.debug("Event sent"); //$NON-NLS-1$
+ }
+
+ /**
+ * 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/gef/SWTBotGefContextMenuExt.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java 2010-11-05
07:33:16 UTC (rev 26274)
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.gef;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefFigureCanvas;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+
+/**
+ * Gef figure bot controler. It performs actions which are missing or works
+ * unreliably in standard SWTBot
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotGefFigure {
+
+ private IFigure figure;
+ private Logger log = Logger.getLogger(SWTBotGefFigure.class);
+ private SWTBotGefEditor editor;
+ private SWTBot bot;
+ private SWTBotGefFigureCanvas canvas;
+ private SWTBotGefEditPart part;
+
+ private SWTBotGefFigure(SWTBotGefEditor editor, SWTBotGefEditPart part,
+ IFigure figure) {
+ this.editor = editor;
+ this.bot = editor.bot();
+ this.canvas = SWTBotGefFinder.findCanvas(editor);
+ this.part = part;
+ this.figure = figure;
+ }
+
+ /**
+ * Default Constructor, requires gef editor and gef part
+ *
+ * @param editor
+ * @param part
+ */
+ public SWTBotGefFigure(SWTBotGefEditor editor, SWTBotGefEditPart part) {
+ this(editor, part, ((GraphicalEditPart) part.part()).getFigure());
+ }
+
+ /**
+ * Return figures bounds
+ */
+ public Rectangle getBounds() {
+ return getBounds(this.getFigure());
+ }
+
+ private Rectangle getBounds(IFigure figure) {
+ final Rectangle bounds = figure.getBounds().getCopy();
+ return bounds;
+ }
+
+ /**
+ * Perform log report for figure
+ */
+ public void logInfo() {
+ logInfo(this.figure, 1);
+ }
+
+ private void logInfo(IFigure figure, int level) {
+ Rectangle rect = getBounds(figure);
+
+ log.info("Figure relative level:" + level);
+ log.info("Figure clas:" + figure.getClass()); //$NON-NLS-1$
+ log.info("Figure bounds:" + rect.x + "," + rect.y + "," +
(rect.x + rect.width) + "," + (rect.y + rect.height)); //$NON-NLS //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ if (figure instanceof Label) {
+ Label label = (Label) figure;
+ log.info("Label text:" + label.getText());
+ }
+ log.info("--------------------------------------------------");
//$NON-NLS-1$
+ }
+
+ /**
+ * Perform log information for entire figure subtree
+ */
+ public void logTreeInfo() {
+ logTreeInfo(this.figure, 1);
+ }
+
+ private void logTreeInfo(IFigure figure, int level) {
+ @SuppressWarnings("unchecked")
+ List<IFigure> children = (List<IFigure>) figure.getChildren();
+ for (IFigure f : children) {
+ if (f.getChildren().isEmpty())
+ logInfo(f, level);
+ else
+ logTreeInfo(f, level + 1);
+ }
+ }
+
+ /**
+ * Use it carefully and inside UIThread only!
+ *
+ * @return
+ */
+ public IFigure getFigure() {
+ return this.figure;
+ }
+
+ /**
+ * Returns Label Figure which contains given text
+ *
+ * @param string
+ * @return
+ */
+ public SWTBotGefFigure labelFigure(String string) {
+ List<IFigure> figures = new ArrayList<IFigure>();
+ getSubFigures(this.figure, figures);
+ for (IFigure figure : figures) {
+ if (figure instanceof Label) {
+ Label label = (Label) figure;
+ log.info(label.getText());
+ if (label.getText().equalsIgnoreCase(string))
+ return new SWTBotGefFigure(editor, part, label);
+ }
+ }
+ throw new WidgetNotFoundException("No Label with " + string + "
found");
+ }
+
+ /**
+ * Returns text of Label Figure
+ *
+ * @return
+ */
+ public String getText() {
+ if (figure instanceof Label) {
+ return ((Label) figure).getText();
+ }
+ throw new WidgetNotFoundException("Widget is not Label type");
+ }
+
+ /**
+ * Performs setText action for Label figure in GEF editor
+ *
+ * @param str
+ */
+ public void setText(String str) {
+ part.select();
+ SWTBotGefMouse mouse = new SWTBotGefMouse(bot, canvas);
+ mouse.moveAndClick(this);
+ SWTBotText text = bot.text(0);
+ canvas.typeText(text.widget, str);
+ }
+
+ private void getSubFigures(IFigure figure, List<IFigure> figures) {
+ @SuppressWarnings("unchecked")
+ List<IFigure> children = (List<IFigure>) figure.getChildren();
+ for (IFigure f : children) {
+ if (f.getChildren().isEmpty())
+ figures.add(f);
+ else
+ getSubFigures(f, figures);
+ }
+ }
+
+ /**
+ * Calculates center point of the figure
+ *
+ * @return
+ */
+ public Point getCenter() {
+ Rectangle bounds = getBounds();
+ return new Point(bounds.x + bounds.width / 2, bounds.y + bounds.height
+ / 2);
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java 2010-11-05
07:33:16 UTC (rev 26274)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.gef;
+
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefFigureCanvas;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * SWTBotGefProvider provides some often conversion tasks for getting
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotGefFinder {
+
+ /**
+ * Returns Canvas from given GEF editor
+ *
+ * @param editor
+ * @return
+ */
+ public static SWTBotGefFigureCanvas findCanvas(final SWTBotGefEditor editor) {
+
+ SWTBotGefFigureCanvas canvas = null;
+
+ canvas = UIThreadRunnable.syncExec(new Result<SWTBotGefFigureCanvas>() {
+ public SWTBotGefFigureCanvas run() {
+ final IEditorPart ep = editor.getReference().getEditor(true);
+ GraphicalViewer graphicalViewer = (GraphicalViewer) ep
+ .getAdapter(GraphicalViewer.class);
+ final Control control = graphicalViewer.getControl();
+ if (control instanceof FigureCanvas) {
+ return new SWTBotGefFigureCanvas((FigureCanvas) control);
+ }
+ return null;
+ }
+ });
+
+ if (canvas == null) {
+ throw new WidgetNotFoundException(
+ "Unable to get Canvas from editor");
+ }
+ return canvas;
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefFinder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gef/SWTBotGefMouse.java 2010-11-05
07:33:16 UTC (rev 26274)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ui.bot.ext.gef;
+
+import org.apache.log4j.Logger;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefFigureCanvas;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+
+/**
+ * Mouse control for GEF figures
+ *
+ * @author jpeterka
+ *
+ */
+public class SWTBotGefMouse {
+
+ Logger log = Logger.getLogger(SWTBotGefMouse.class);
+ SWTBotGefFigureCanvas canvas;
+ SWTBot bot;
+ final int SLEEP = 100;
+
+ /**
+ * Constructor, requires bot and canvas
+ *
+ * @param bot
+ * @param canvas
+ */
+ public SWTBotGefMouse(final SWTBot bot, final SWTBotGefFigureCanvas canvas) {
+ this.canvas = canvas;
+ this.bot = bot;
+ }
+
+ private Canvas canvas() {
+ return canvas.widget;
+ }
+
+ /**
+ * Performs mouse move to particular location
+ *
+ * @param x
+ * @param y
+ */
+ public void move(final int x, final int y) {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseMove, x, y);
+ canvas().getDisplay().post(event);
+ }
+ });
+ }
+
+ /**
+ * Moves to given figure
+ *
+ * @param figure
+ */
+ public void move(SWTBotGefFigure figure) {
+ Point p = new Point();
+ getDisplayPosition(p, figure);
+ move(p.x, p.y);
+ }
+
+ /**
+ * Moves and click on given figure
+ *
+ * @param figure
+ */
+ public void moveAndClick(SWTBotGefFigure figure) {
+ move(figure);
+ click();
+ }
+
+ /**
+ * Calculates element position to display, call it from UI thread
+ */
+ private void getDisplayPosition(final Point point,
+ final SWTBotGefFigure figure) {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ int absX = canvas().toDisplay(figure.getFigure().getBounds().x,
+ figure.getFigure().getBounds().y).x;
+ int absY = canvas().toDisplay(figure.getFigure().getBounds().x,
+ figure.getFigure().getBounds().y).y;
+
+ log.info("Figure abs display position:" + absX + "," + absY);
+ point.x = absX + (figure.getFigure().getBounds().width / 2);
+ point.y = absY + (figure.getFigure().getBounds().height / 2);
+ }
+ });
+ }
+
+ /**
+ * Left click on give position
+ */
+ public void click() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseDown, 1);
+ canvas().getDisplay().post(event);
+ }
+ });
+ bot.sleep(SLEEP);
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ Event event = createEvent(SWT.MouseUp, 1);
+ canvas().getDisplay().post(event);
+ }
+ });
+ bot.sleep(SLEEP);
+ }
+
+ 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/gef/SWTBotGefMouse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain