Author: psrna
Date: 2010-11-25 07:07:02 -0500 (Thu, 25 Nov 2010)
New Revision: 26931
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StyledTextHelper.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidCanvas.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidFigure.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidTFigure.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidUmlFigure.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTTeiidBot.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
Log:
* StyledTextHelper
* org.jboss.tools.ui.bot.ext.teiid
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-25
12:00:24 UTC (rev 26930)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2010-11-25
12:07:02 UTC (rev 26931)
@@ -23,7 +23,8 @@
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.swtbot.eclipse.gef.finder;bundle-version="2.0.0"
+ org.eclipse.swtbot.eclipse.gef.finder;bundle-version="2.0.0",
+ org.eclipse.gef;bundle-version="3.6.1"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: org.apache.log4j
@@ -36,6 +37,7 @@
org.jboss.tools.ui.bot.ext.gen,
org.jboss.tools.ui.bot.ext.helper,
org.jboss.tools.ui.bot.ext.parts,
+ org.jboss.tools.ui.bot.ext.teiid,
org.jboss.tools.ui.bot.ext.types,
org.jboss.tools.ui.bot.ext.view,
org.jboss.tools.ui.bot.ext.widgets,
@@ -43,4 +45,8 @@
Bundle-Vendor: JBoss by Red Hat
Bundle-ClassPath: .,
resources/drv/hsqldb.jar
-Import-Package: org.eclipse.gef
+Import-Package: com.metamatrix.modeler.diagram.ui.figure,
+ com.metamatrix.modeler.diagram.ui.notation.uml.figure,
+ com.metamatrix.modeler.transformation.ui,
+ com.metamatrix.modeler.transformation.ui.figure,
+ org.eclipse.gef
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StyledTextHelper.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StyledTextHelper.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StyledTextHelper.java 2010-11-25
12:07:02 UTC (rev 26931)
@@ -0,0 +1,52 @@
+package org.jboss.tools.ui.bot.ext.helper;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+
+/**
+ *
+ * @author psrna
+ *
+ */
+public class StyledTextHelper {
+
+ /**
+ * Mouse click on current caret position
+ */
+ public static void mouseClickOnCaret(final StyledText widget){
+
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ widget.forceFocus();
+
+ int caret_x = widget.getCaret().getLocation().x;
+ int caret_y = widget.getCaret().getLocation().y;
+
+ // Move mouse
+ Event event = new Event();
+ event.type = SWT.MouseMove;
+ event.x = widget.toDisplay(caret_x, caret_y).x;
+ event.y = widget.toDisplay(caret_x, caret_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);
+
+ }
+ });
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/helper/StyledTextHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidCanvas.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidCanvas.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidCanvas.java 2010-11-25
12:07:02 UTC (rev 26931)
@@ -0,0 +1,170 @@
+package org.jboss.tools.ui.bot.ext.teiid;
+
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.IFigure;
+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.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
+
+import com.metamatrix.modeler.diagram.ui.notation.uml.figure.UmlClassifierFigure;
+import com.metamatrix.modeler.diagram.ui.notation.uml.figure.UmlClassifierHeader;
+import com.metamatrix.modeler.transformation.ui.figure.TransformationFigure;
+
+
+
+/**
+ *
+ * @author psrna
+ *
+ */
+public class SWTBotTeiidCanvas extends AbstractSWTBotControl<FigureCanvas> {
+
+ Logger log = Logger.getLogger(FigureCanvas.class);
+
+
+ public SWTBotTeiidCanvas(FigureCanvas canvas) {
+ super(canvas);
+ }
+
+ public SWTBotTeiidUmlFigure figure(final String name){
+
+ UmlClassifierFigure figure = UIThreadRunnable
+ .syncExec(new Result<UmlClassifierFigure>() {
+
+ @SuppressWarnings("unchecked")
+ private UmlClassifierFigure find(List<IFigure> figures){
+ UmlClassifierFigure result;
+
+ for(IFigure f : figures){
+
+ if(f instanceof UmlClassifierFigure){
+ if(((UmlClassifierFigure) f).getLabelFigure()
+ .getText().equals(name)){
+ return (UmlClassifierFigure) f;
+ }
+ }
+ result = find(f.getChildren());
+
+ if(result != null)
+ return result;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public UmlClassifierFigure run() {
+ return find(widget.getContents().getChildren());
+ }
+
+ });
+ if(figure != null)
+ return new SWTBotTeiidUmlFigure(figure, widget);
+ else
+ throw new WidgetNotFoundException("Cannot find figure with the name:" +
name);
+ }
+
+ public SWTBotTeiidTFigure tFigure(){
+
+ TransformationFigure figure = UIThreadRunnable
+ .syncExec(new Result<TransformationFigure>() {
+
+
+ @SuppressWarnings("unchecked")
+ private TransformationFigure find(List<IFigure> figures){
+ TransformationFigure result;
+
+ for(IFigure f : figures){
+
+ if(f instanceof TransformationFigure)
+ return (TransformationFigure) f;
+
+ result = find(f.getChildren());
+
+ if(result != null)
+ return result;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public TransformationFigure run() {
+ return find(widget.getContents().getChildren());
+ }
+
+ });
+ if(figure != null)
+ return new SWTBotTeiidTFigure(figure, widget);
+ else
+ throw new WidgetNotFoundException("Cannot find Transformation Figure");
+ }
+
+
+
+ /**
+ * Debug method
+ */
+ public void debugCanvas(){
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+
+ @SuppressWarnings("unchecked")
+ public void printAllChildren(List<IFigure> figures, final int level){
+
+ for(int i=0; i<level; i++){
+ System.out.print(" ");
+ }
+ for(IFigure f : figures){
+ log.info("Child:" + f.getClass() + " {{SUPERCLASS:" +
f.getClass().getSuperclass() + "}}");
+ printAllChildren(f.getChildren(), level+1);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void printUmlClassifierFigures(List<IFigure> figures){
+ for(IFigure f : figures){
+ if(f instanceof UmlClassifierFigure)
+ log.info("UMLFIGURE:" + ((UmlClassifierFigure)
f).getLabelFigure().getText());
+ printUmlClassifierFigures(f.getChildren());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void printUmlClassifierHeaderFigures(List<IFigure> figures){
+ for(IFigure f : figures){
+ if(f instanceof UmlClassifierHeader)
+ log.info("UMLHEADER:" + ((UmlClassifierHeader)
f).getNameLabel().getText());
+ printUmlClassifierFigures(f.getChildren());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void run() {
+ log.info("*****************************************************************************");
+ FigureCanvas c = widget;
+ //printAllChildren(c.getContents().getChildren(), 0);
+ log.info("UmlClassifierFigure:");
+ printUmlClassifierFigures(c.getContents().getChildren());
+
+ log.info("-----------------------------------------------------------------------------");
+
+ log.info("UmlClassifierHeaders:");
+ printUmlClassifierHeaderFigures(c.getContents().getChildren());
+
+ log.info("*****************************************************************************");
+
+ }
+ });
+
+
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidCanvas.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidFigure.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidFigure.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidFigure.java 2010-11-25
12:07:02 UTC (rev 26931)
@@ -0,0 +1,26 @@
+package org.jboss.tools.ui.bot.ext.teiid;
+
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.swt.SWT;
+import org.eclipse.draw2d.geometry.Point;
+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.widgets.AbstractSWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
+import org.eclipse.ui.internal.handlers.WizardHandler.New;
+
+import com.metamatrix.modeler.diagram.ui.notation.uml.figure.UmlClassifierFigure;
+import com.metamatrix.modeler.transformation.ui.figure.TransformationFigure;
+
+public abstract class SWTBotTeiidFigure extends AbstractSWTBot<FigureCanvas>{
+
+
+
+ public SWTBotTeiidFigure(FigureCanvas c){
+ super(c);
+ }
+
+ abstract public void doubleClick();
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidTFigure.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidTFigure.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidTFigure.java 2010-11-25
12:07:02 UTC (rev 26931)
@@ -0,0 +1,22 @@
+package org.jboss.tools.ui.bot.ext.teiid;
+
+import org.eclipse.draw2d.FigureCanvas;
+
+import com.metamatrix.modeler.transformation.ui.figure.TransformationFigure;
+
+public class SWTBotTeiidTFigure extends SWTBotTeiidFigure{
+
+ private TransformationFigure tFig;
+
+ public SWTBotTeiidTFigure(TransformationFigure fig, FigureCanvas c) {
+ super(c);
+ tFig = fig;
+ }
+
+ @Override
+ public void doubleClick() {
+ doubleClickXY(tFig.getBounds().getCenter().x,
+ tFig.getBounds().getCenter().y);
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidTFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidUmlFigure.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidUmlFigure.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidUmlFigure.java 2010-11-25
12:07:02 UTC (rev 26931)
@@ -0,0 +1,72 @@
+package org.jboss.tools.ui.bot.ext.teiid;
+
+import org.eclipse.draw2d.FigureCanvas;
+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 com.metamatrix.modeler.diagram.ui.notation.uml.figure.UmlClassifierFigure;
+
+public class SWTBotTeiidUmlFigure extends SWTBotTeiidFigure{
+
+ private UmlClassifierFigure fig;
+
+ public SWTBotTeiidUmlFigure(UmlClassifierFigure fig, FigureCanvas c) {
+ super(c);
+ this.fig = fig;
+ }
+
+ @Override
+ public void doubleClick() {
+ /*
+ System.err.println("SWTBotTeiidUmlFigure:" +
fig.getLabelFigure().getText());
+ System.err.println("SWTBotTeiidUmlFigure.LabelBounds:" +
fig.getLabelFigure().getBounds());
+ System.err.println("SWTBotTeiidUmlFigure.nameBounds:" +
fig.getNameFigure().getBounds());
+
+
+ doubleClickXY(fig.getLabelFigure().getBounds().getCenter().x,
fig.getLabelFigure().getBounds().getCenter().y);
+ //doubleClickXY(fig.getNameFigure().getBounds().getCenter().x,
fig.getNameFigure().getBounds().getCenter().y);
+ */
+ /*
+ UIThreadRunnable.syncExec(new VoidResult() {
+
+ @Override
+ public void run() {
+ //widget.forceFocus();
+
+
+ // Move mouse
+ Event event = new Event();
+ event.type = SWT.MouseMove;
+ event.x = widget.toDisplay(fig.getLabelFigure().getBounds().getCenter().x,
fig.getLabelFigure().getBounds().getCenter().y).x;
+ event.y = widget.toDisplay(fig.getLabelFigure().getBounds().getCenter().x,
fig.getLabelFigure().getBounds().getCenter().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);
+ // 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);
+
+ }
+ });
+ */
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTBotTeiidUmlFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTTeiidBot.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTTeiidBot.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTTeiidBot.java 2010-11-25
12:07:02 UTC (rev 26931)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.teiid;
+
+import java.util.List;
+
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
+
+
+
+/**
+ * SWTBot extension for Teiid Designer support.
+ *
+ * @author psrna
+ *
+ */
+public class SWTTeiidBot extends SWTWorkbenchBot {
+
+
+ public SWTBotTeiidCanvas getTeiidCanvas(int index) {
+ List<? extends FigureCanvas> canvases =
getFinder().findControls(WidgetMatcherFactory.widgetOfType(FigureCanvas.class));
+ SWTBotTeiidCanvas canvas = new SWTBotTeiidCanvas(canvases.get(0));
+ return canvas;
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/teiid/SWTTeiidBot.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain