Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2011-05-18 18:31:20 +0000
committerMartin Fluegge2011-05-18 18:31:20 +0000
commit5dce22978572c1c63ea1aa78c082f7d3a206b378 (patch)
treed9729e2e5385cd75451ed9cbaf6b114150d9b7ba
parente7cb0f6147cad1ff90fe26d0030b7e9c5ac12811 (diff)
downloadcdo-5dce22978572c1c63ea1aa78c082f7d3a206b378.tar.gz
cdo-5dce22978572c1c63ea1aa78c082f7d3a206b378.tar.xz
cdo-5dce22978572c1c63ea1aa78c082f7d3a206b378.zip
[333187] [Dawn] Provide integration for Ecore Tools
https://bugs.eclipse.org/bugs/show_bug.cgi?id=333187
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java55
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_333187_Test.java695
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java126
9 files changed, 887 insertions, 24 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java
index b388184bab..f9b4e20f10 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java
@@ -64,7 +64,6 @@ public class DawnEcoreCreationWizard extends EcoreCreationWizard
@Override
protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException
{
-
if (diagPage.isNewModel())
{
diagram = EcoreDiagramEditorUtil.createDiagram(diagPage.getDiagramModelURI(), diagPage.getDomainModelURI(),
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java
index 4fbb39766d..66ad7d101f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java
@@ -10,6 +10,7 @@
******************************************************************************/
package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part;
+import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
import org.eclipse.emf.cdo.dawn.ui.wizards.dialogs.CDOResourceNodeSelectionDialog;
import org.eclipse.emf.cdo.view.CDOView;
@@ -25,6 +26,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.window.Window;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
@@ -49,8 +52,21 @@ public class DawnEcoreCreationWizardPage extends EcoreCreationWizardPage
public void createControl(Composite parent)
{
super.createControl(parent);
- Text nameFd = (Text)getField("nameFd");
- nameFd.setEnabled(false);
+ final Text nameFd = (Text)getField("nameFd");
+ // nameFd.setEnabled(false);
+
+ nameFd.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ Text directoryFd = (Text)getField("directoryFd");
+ semanticModelURI = URI.createURI(directoryFd.getText() + nameFd.getText());
+ setPageComplete(validatePage());
+ }
+ });
+
+ URI domainModelURI = getDomainModelURI();
+ setModelURI(domainModelURI);
}
@Override
@@ -62,17 +78,22 @@ public class DawnEcoreCreationWizardPage extends EcoreCreationWizardPage
semanticModelURI = dialog.getResults();
if (semanticModelURI != null)
{
- Text directoryFd = (Text)getField("directoryFd");
- directoryFd.setText(semanticModelURI.toString());
-
- Text nameFd = (Text)getField("nameFd");
- nameFd.setText(semanticModelURI.lastSegment());
+ setModelURI(semanticModelURI);
loadModelFile();
}
}
}
+ private void setModelURI(URI semanticModelURI)
+ {
+ Text directoryFd = (Text)getField("directoryFd");
+ directoryFd.setText(semanticModelURI.toString().replace(semanticModelURI.lastSegment(), ""));
+
+ Text nameFd = (Text)getField("nameFd");
+ nameFd.setText(semanticModelURI.lastSegment());
+ }
+
@Override
protected void handleModelChoose()
{
@@ -128,7 +149,7 @@ public class DawnEcoreCreationWizardPage extends EcoreCreationWizardPage
return view.getResourceSet();
}
- Object getField(String name)
+ private Object getField(String name)
{
final Field fields[] = this.getClass().getSuperclass().getDeclaredFields();
for (int i = 0; i < fields.length; ++i)
@@ -157,6 +178,12 @@ public class DawnEcoreCreationWizardPage extends EcoreCreationWizardPage
setMessage(null);
setErrorMessage(null);
+ if (view.hasResource(getDomainModelURI().path()))
+ {
+ setErrorMessage("Resource already exists");
+ return false;
+ }
+
// if (isNewModel())
// {
// return validateNewModelGroup();
@@ -171,6 +198,18 @@ public class DawnEcoreCreationWizardPage extends EcoreCreationWizardPage
@Override
public URI getDomainModelURI()
{
+ if (semanticModelURI == null)
+ {
+ String authority = PreferenceConstants.getRepositoryName();
+ semanticModelURI = URI.createURI("cdo://" + authority + "/default.ecore");
+
+ int i = 2;
+ while (i < 30 && view.hasResource(semanticModelURI.path()))
+ {
+ semanticModelURI = URI.createURI("cdo://" + authority + "/" + "default" + i + ".ecore");
+ i++;
+ }
+ }
return semanticModelURI;
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF
index d550f39e1a..0fd5f62a39 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/META-INF/MANIFEST.MF
@@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.cdo.tests.ui;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.dawn.examples.acore.editor;bundle-version="[1.0.0,2.0.0)",
org.eclipse.emf.cdo.dawn.examples.acore.diagram;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.gmf.ui;bundle-version="1.0.0"
+ org.eclipse.emf.cdo.dawn.codegen.dawngenmodel.gmf.ui;bundle-version="1.0.0",
+ org.eclipse.emf.ecoretools.diagram;bundle-version="[0.10.0,1.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java
index 721b1b48a6..5f6a61f7a2 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AbstractDawnUITest.java
@@ -89,12 +89,19 @@ public abstract class AbstractDawnUITest<T extends SWTWorkbenchBot> extends Abst
protected boolean resourceExists(String resourcePath)
{
- CDOSession session = openSession();
- CDOView view = session.openView();
+ try
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
- CDOResource resource = view.getResource(resourcePath);
+ CDOResource resource = view.getResource(resourcePath);
- return resource != null ? true : false;
+ return resource != null ? true : false;
+ }
+ catch (Exception ex)
+ {
+ return false;
+ }
}
protected void createNode(String type, int xPosition, int yPosition, SWTGefBot bot, SWTBotGefEditor editor)
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java
index c0d6664fcd..e04464f185 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/AllTestsDawnUISWTBot.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.dawn.tests;
import org.eclipse.emf.cdo.dawn.tests.bugzillas.Bugzilla_321024_Test;
+import org.eclipse.emf.cdo.dawn.tests.bugzillas.Bugzilla_333187_Test;
import org.eclipse.emf.cdo.dawn.tests.bugzillas.Bugzilla_333291_Test;
import org.eclipse.emf.cdo.dawn.tests.ui.DawnPreferencesTest;
import org.eclipse.emf.cdo.dawn.tests.ui.DawnProjectExplorerTest;
@@ -45,14 +46,15 @@ public class AllTestsDawnUISWTBot extends ConfigTestSuite
protected void initConfigSuites(TestSuite parent)
{
addScenario(parent, COMBINED, MEM, TCP, NATIVE);
- addScenario(parent, COMBINED, MEM_BRANCHES, TCP, NATIVE);
- addScenario(parent, COMBINED, MEM, TCP, LEGACY);
- addScenario(parent, COMBINED, MEM_BRANCHES, TCP, LEGACY);
+ // addScenario(parent, COMBINED, MEM_BRANCHES, TCP, NATIVE);
+ // addScenario(parent, COMBINED, MEM, TCP, LEGACY);
+ // addScenario(parent, COMBINED, MEM_BRANCHES, TCP, LEGACY);
}
@Override
protected void initTestClasses(List<Class<? extends ConfigTest>> testClasses)
{
+
/******************** GMF **********************/
testClasses.add(DawnPreferencesTest.class);
testClasses.add(DawnCreationWizardSWTBotTest.class);
@@ -70,5 +72,7 @@ public class AllTestsDawnUISWTBot extends ConfigTestSuite
/******************** Bugzilla **********************/
testClasses.add(Bugzilla_321024_Test.class);
testClasses.add(Bugzilla_333291_Test.class);
+ testClasses.add(Bugzilla_333187_Test.class);
+ // testClasses.add(Bugzilla_345858_Test.class);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_333187_Test.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_333187_Test.java
new file mode 100644
index 0000000000..5ce1c03f2c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/bugzillas/Bugzilla_333187_Test.java
@@ -0,0 +1,695 @@
+/**
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.tests.bugzillas;
+
+import org.eclipse.emf.cdo.dawn.tests.AbstractDawnGEFTest;
+import org.eclipse.emf.cdo.dawn.tests.ui.util.DawnEcoreTestUtil;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EDataTypeImpl;
+import org.eclipse.emf.ecore.impl.EEnumImpl;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+/**
+ * @author Martin Fluegge
+ */
+@CleanRepositoriesBefore
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class Bugzilla_333187_Test extends AbstractDawnGEFTest
+{
+ private static final String DOMAIN_FILE_NAME = "Domain file name: ";
+
+ @Test
+ public void testCreateNewEcoreToolsDiagram() throws Exception
+ {
+ getBot().menu("File").menu("New").menu("Other...").click();
+
+ SWTBotShell shell = getBot().shell("New");
+ shell.activate();
+ getBot().tree().expandNode("Dawn Examples").select(DawnEcoreTestUtil.CREATION_WIZARD_NAME_GMF);
+ getBot().button("Next >").click();
+ sleep(1000);
+ getBot().button("Finish").click();
+ SWTBotGefEditor editor = getBot().gefEditor("default");
+ assertNotNull(editor);
+ editor.close();
+ {
+ assertEquals(true, resourceExists("/default.ecore"));
+ assertEquals(true, resourceExists("/default.ecorediag"));
+ }
+ }
+
+ @Test
+ public void testCreateNewEcoreDiagramWrongResourceName() throws Exception
+ {
+ getBot().menu("File").menu("New").menu("Other...").click();
+
+ SWTBotShell shell = getBot().shell("New");
+ shell.activate();
+ getBot().tree().expandNode("Dawn Examples").select(DawnEcoreTestUtil.CREATION_WIZARD_NAME_GMF);
+ getBot().button("Next >").click();
+ sleep(6000);
+ shell = getBot().shell("New Ecore Diagram");
+ shell.activate();
+
+ SWTBotText fileNameLabel = getBot().textWithLabel(DOMAIN_FILE_NAME);
+ fileNameLabel.setText("");
+
+ fileNameLabel.setFocus();
+ fileNameLabel.typeText("x", 500);
+ assertEquals(false, getBot().button("Next >").isEnabled());
+ getBot().button("Cancel").click();
+ }
+
+ @Test
+ public void testCreateNewEcoreDiagramChangeResourceName() throws Exception
+ {
+ getBot().menu("File").menu("New").menu("Other...").click();
+
+ SWTBotShell shell = getBot().shell("New");
+ shell.activate();
+ getBot().tree().expandNode("Dawn Examples").select(DawnEcoreTestUtil.CREATION_WIZARD_NAME_GMF);
+ getBot().button("Next >").click();
+ sleep(6000);
+ shell = getBot().shell("New Ecore Diagram");
+ shell.activate();
+
+ SWTBotText fileNameLabel = getBot().textWithLabel(DOMAIN_FILE_NAME);
+ fileNameLabel.setText("");
+
+ fileNameLabel.setFocus();
+ fileNameLabel.typeText("default2.ecore", 50);
+
+ assertEquals(true, getBot().button("Finish").isEnabled());
+
+ getBot().button("Finish").click();
+ SWTBotGefEditor editor = getBot().gefEditor("default2");
+ assertNotNull(editor);
+ editor.close();
+ {
+ assertEquals(true, resourceExists("/default2.ecore"));
+ assertEquals(true, resourceExists("/default2.ecorediag"));
+ }
+ }
+
+ @Test
+ public void testCreateNewEcoreDiagramSetResourceInDialog() throws Exception
+ {
+ getBot().menu("File").menu("New").menu("Other...").click();
+
+ SWTBotShell shell = getBot().shell("New");
+ shell.activate();
+ getBot().tree().expandNode("Dawn Examples").select(DawnEcoreTestUtil.CREATION_WIZARD_NAME_GMF);
+ getBot().button("Next >").click();
+
+ shell = getBot().shell("New Ecore Diagram");
+ shell.activate();
+
+ getBot().button("Browse...").click();
+
+ // activate the selection window
+ // shell = getBot().shells()[3];
+ // shell.activate();
+
+ SWTBotText fileNameLabel = getBot().textWithLabel("Resource name:");
+ fileNameLabel.setText("test.ecore");
+ getBot().button("OK").click();
+
+ SWTBotText fileSemanticNameLabel = getBot().textWithLabel(DOMAIN_FILE_NAME);
+ assertEquals("test.ecore", fileSemanticNameLabel.getText());
+
+ getBot().button("Finish").click();
+
+ SWTBotGefEditor editor = getBot().gefEditor("test");
+ assertNotNull(editor);
+ editor.close();
+
+ {
+ assertEquals(true, resourceExists("/test.ecore"));
+ assertEquals(true, resourceExists("/test.ecorediag"));
+ }
+ }
+
+ @Test
+ public void testCreateNewEcoreDiagramSetResourceInDialogAndSelectFolder() throws Exception
+ {
+ {
+ CDOSession session = openSession();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ CDOTransaction transaction = session.openTransaction(resourceSet);
+
+ final URI uri = URI.createURI("cdo:/folder/dummy");
+ resourceSet.createResource(uri);
+ transaction.commit();
+ }
+
+ getBot().menu("File").menu("New").menu("Other...").click();
+
+ SWTBotShell shell = getBot().shell("New");
+ shell.activate();
+ getBot().tree().expandNode("Dawn Examples").select(DawnEcoreTestUtil.CREATION_WIZARD_NAME_GMF);
+ getBot().button("Next >").click();
+
+ shell = getBot().shell("New Ecore Diagram");
+ shell.activate();
+
+ getBot().button("Browse...").click();
+
+ SWTBotTree tree = getBot().tree(0);
+ selectFolder(tree.getAllItems(), "folder", false);
+
+ SWTBotText fileNameLabel = getBot().textWithLabel("Resource name:");
+ fileNameLabel.setText("test.ecore");
+ getBot().button("OK").click();
+
+ SWTBotText resourcePathLabel = getBot().text(0);
+ assertEquals("cdo://repo1/folder/", resourcePathLabel.getText());
+
+ SWTBotText fileSemanticNameLabel = getBot().textWithLabel(DOMAIN_FILE_NAME);
+ assertEquals("test.ecore", fileSemanticNameLabel.getText());
+
+ getBot().button("Finish").click();
+ SWTBotGefEditor editor = getBot().gefEditor("test");
+ assertNotNull(editor);
+ editor.close();
+
+ {
+ assertEquals(true, resourceExists("/folder/test.ecore"));
+ assertEquals(true, resourceExists("/folder/test.ecorediag"));
+ }
+ }
+
+ @Test
+ public void testCreateNewEcoreToolsDiagramAndAddElements() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 150, 250, "C", getBot(), editor);
+
+ editor.saveAndClose();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ assertEquals(3, epackage.getEClassifiers().size());
+
+ Character name = 'A';
+
+ for (EClassifier aClass : epackage.getEClassifiers())
+ {
+ assertEquals(name.toString(), aClass.getName());
+ name++;
+ }
+ }
+ }
+
+ @Test
+ public void testCreateNewDawnDiagramAndAddElementsWithEdges() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 150, 250, "C", getBot(), editor);
+
+ createEdge(DawnEcoreTestUtil.E_REFERENCE, 100, 100, 250, 100, editor);
+ createEdge(DawnEcoreTestUtil.E_REFERENCE, 100, 100, 150, 250, editor);
+
+ List<SWTBotGefEditPart> connectionEditParts = DawnEcoreTestUtil.getAllTargetConnections(editor);
+
+ assertEquals(2, connectionEditParts.size());
+
+ editor.save();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ assertEquals(3, epackage.getEClassifiers().size());
+
+ Character name = 'A';
+
+ for (EClassifier aClass : epackage.getEClassifiers())
+ {
+ assertEquals(name.toString(), aClass.getName());
+ name++;
+ }
+ view.close();
+ }
+ }
+
+ @Test
+ public void testEClassChangeName() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+
+ editor.save();
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(1, epackage.getEClassifiers().size());
+
+ EClassifier eClassifier = epackage.getEClassifiers().get(0);
+
+ assertEquals("A", eClassifier.getName());
+
+ session.close();
+ }
+
+ typeTextToFocusedWidget("B", getBot(), true);
+ editor.save();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(1, epackage.getEClassifiers().size());
+
+ EClassifier eClassifier = epackage.getEClassifiers().get(0);
+
+ assertEquals("B", eClassifier.getName());
+
+ session.close();
+ }
+ }
+
+ @Test
+ public void testEClassWithEAttributes() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+
+ editor.save();
+
+ editor.activateTool(DawnEcoreTestUtil.E_ATTRIBUTE);
+ editor.click(100, 100);
+ typeTextToFocusedWidget("name", getBot(), true);
+ editor.save();
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ EClass eClass = (EClass)epackage.getEClassifiers().get(0);
+
+ assertEquals("A", eClass.getName());
+ EList<EAttribute> eAttributes = eClass.getEAttributes();
+ assertEquals(1, eAttributes.size());
+ assertEquals("name", eAttributes.get(0).getName());
+ }
+ }
+
+ @Test
+ public void testEClassWithEOperation() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+
+ editor.save();
+
+ editor.activateTool(DawnEcoreTestUtil.E_OPERATION);
+ editor.click(100, 100);
+ typeTextToFocusedWidget("operation", getBot(), true);
+ editor.save();
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ EClass eClass = (EClass)epackage.getEClassifiers().get(0);
+
+ assertEquals("A", eClass.getName());
+ EList<EOperation> eOperations = eClass.getEOperations();
+ assertEquals(1, eOperations.size());
+ assertEquals("operation", eOperations.get(0).getName());
+ }
+ }
+
+ @Test
+ public void testDiagramWithInheritance() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 150, 250, "C", getBot(), editor);
+
+ createEdge(DawnEcoreTestUtil.INHERITANCE, 100, 100, 250, 100, editor);
+ createEdge(DawnEcoreTestUtil.INHERITANCE, 100, 100, 150, 250, editor);
+
+ List<SWTBotGefEditPart> connectionEditParts = DawnEcoreTestUtil.getAllTargetConnections(editor);
+
+ assertEquals(2, connectionEditParts.size());
+ editor.save();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ assertEquals(3, epackage.getEClassifiers().size());
+
+ EClass eClass1 = (EClass)epackage.getEClassifiers().get(0);
+ EClass eClass2 = (EClass)epackage.getEClassifiers().get(1);
+ EClass eClass3 = (EClass)epackage.getEClassifiers().get(2);
+
+ assertEquals(eClass2, eClass1.getEAllSuperTypes().get(0));
+ assertEquals(eClass3, eClass1.getEAllSuperTypes().get(1));
+
+ view.close();
+ }
+ }
+
+ @Test
+ public void testEDataType() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_DATATYPE, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_DATATYPE, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_DATATYPE, 150, 250, "C", getBot(), editor);
+ editor.saveAndClose();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ assertEquals(3, epackage.getEClassifiers().size());
+
+ Character name = 'A';
+
+ for (EClassifier eType : epackage.getEClassifiers())
+ {
+ assertEquals(EDataTypeImpl.class, eType.getClass());
+ assertEquals(name.toString(), eType.getName());
+ name++;
+ }
+ }
+ }
+
+ @Test
+ public void testEAnnotation() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_ANNOTATION, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_ANNOTATION, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_ANNOTATION, 150, 250, "C", getBot(), editor);
+ editor.saveAndClose();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ EList<EAnnotation> eAnnotations = epackage.getEAnnotations();
+ assertEquals(3, eAnnotations.size());
+
+ Character name = 'A';
+
+ for (EAnnotation eAnnotation : eAnnotations)
+ {
+ assertEquals(name.toString(), eAnnotation.getSource());
+ name++;
+ }
+ }
+ }
+
+ @Test
+ public void testEENum() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_ENUM, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_ENUM, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_ENUM, 150, 250, "C", getBot(), editor);
+ editor.saveAndClose();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ assertEquals(3, epackage.getEClassifiers().size());
+
+ Character name = 'A';
+
+ for (EClassifier eEnum : epackage.getEClassifiers())
+ {
+ assertEquals(EEnumImpl.class, eEnum.getClass());
+ assertEquals(name.toString(), eEnum.getName());
+ name++;
+ }
+ }
+ }
+
+ @Test
+ public void testEPackage() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_PACKAGE, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_PACKAGE, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_PACKAGE, 150, 250, "C", getBot(), editor);
+ editor.saveAndClose();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ EList<EObject> contents = semanticResource.getContents();
+ assertEquals(1, contents.size());
+
+ EPackage ePackage = (EPackage)contents.get(0);
+ Character name = 'A';
+
+ for (EPackage eSubPackage : ePackage.getESubpackages())
+ {
+ assertEquals(name.toString(), eSubPackage.getName());
+ assertEquals(ePackage, eSubPackage.getESuperPackage());
+ name++;
+ }
+ }
+ }
+
+ @Test
+ public void testDiagramWithClassAndEAnnotations() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_CLASS, 100, 100, "A", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_ANNOTATION, 250, 100, "B", getBot(), editor);
+ createNodeWithLabel(DawnEcoreTestUtil.E_ANNOTATION, 150, 250, "C", getBot(), editor);
+
+ createEdge(DawnEcoreTestUtil.E_ANNOTATION_LINK, 250, 100, 100, 100, editor);
+ createEdge(DawnEcoreTestUtil.E_ANNOTATION_LINK, 150, 250, 100, 100, editor);
+
+ List<SWTBotGefEditPart> connectionEditParts = DawnEcoreTestUtil.getAllTargetConnections(editor);
+
+ assertEquals(2, connectionEditParts.size());
+ editor.save();
+
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ Diagram diagram = (Diagram)diagramResource.getContents().get(0);
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ assertEquals(3, diagram.getChildren().size());
+ assertEquals(1, epackage.getEClassifiers().size());
+
+ // EClass eClass1 = (EClass)epackage.getEClassifiers().get(0);
+ // EList<EAnnotation> eAnnotations = eClass1.getEAnnotations();
+ // assertEquals(2, eAnnotations.size());
+ //
+ // Character name = 'B';
+ //
+ // for (EAnnotation annotation : eAnnotations)
+ // {
+ // assertEquals(name.toString(), annotation.getSource());
+ // assertEquals(eClass1, annotation.getEModelElement());
+ // name++;
+ // }
+
+ view.close();
+ }
+ }
+
+ @Test
+ public void testEAnnotationWithDetailEntry() throws Exception
+ {
+ SWTBotGefEditor editor = DawnEcoreTestUtil.openNewEcoreToolsEditor("default.ecore", getBot());
+ assertNotNull(editor);
+
+ createNodeWithLabel(DawnEcoreTestUtil.E_ANNOTATION, 100, 100, "A", getBot(), editor);
+ editor.activateTool(DawnEcoreTestUtil.DETAILS_ENTRY);
+ editor.click(100, 100);
+ typeTextToFocusedWidget("name", getBot(), true);
+ editor.save();
+ {
+ CDOSession session = openSession();
+ CDOView view = session.openView();
+
+ CDOResource diagramResource = view.getResource("/default.ecorediag");
+ CDOResource semanticResource = view.getResource("/default.ecore");
+
+ assertNotNull(diagramResource);
+ assertNotNull(semanticResource);
+
+ EPackage epackage = (EPackage)semanticResource.getContents().get(0);
+
+ EAnnotation eAnnotation = epackage.getEAnnotations().get(0);
+
+ assertEquals("A", eAnnotation.getSource());
+ assertEquals(1, eAnnotation.getDetails().size());
+ view.close();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java
index 251f0f7c96..4b57e297e8 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardSWTBotTest.java
@@ -133,8 +133,8 @@ public class DawnCreationWizardSWTBotTest extends AbstractDawnGEFTest
SWTBotText fileSemanticNameLabel = getBot().textWithLabel(resourceFieldLabel);
assertEquals("notational.acore", fileSemanticNameLabel.getText());
- fileNameLabel = getBot().textWithLabel(resourceFieldLabel);
- fileNameLabel.setText("semantic.acore");
+ fileSemanticNameLabel = getBot().textWithLabel(resourceFieldLabel);
+ fileSemanticNameLabel.setText("semantic.acore");
fileSemanticNameLabel = getBot().textWithLabel(resourceFieldLabel);
assertEquals("semantic.acore", fileSemanticNameLabel.getText());
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardTest.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardTest.java
index 69e484014f..5ec3414584 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardTest.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/gmf/DawnCreationWizardTest.java
@@ -38,10 +38,8 @@ import java.lang.reflect.Method;
*/
public class DawnCreationWizardTest extends AbstractCDOTest
{
-
public void testCreationWizardSetWrongDiagramName() throws Exception
{
-
CDOSession session = openSession();
CDOConnectionUtil.instance.openView(session);
diff --git a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java
index 7a920c3c5a..b0da13495b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.tests/src/org/eclipse/emf/cdo/dawn/tests/ui/util/DawnEcoreTestUtil.java
@@ -17,14 +17,17 @@ import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput;
import org.eclipse.emf.cdo.dawn.ui.helper.EditorDescriptionHelper;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
@@ -32,6 +35,11 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.hamcrest.Description;
+
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Martin Fluegge
*/
@@ -41,18 +49,40 @@ public class DawnEcoreTestUtil
public static final String CREATION_WIZARD_NAME_EMF = "Dawn Ecore Model";
+ public static final String E_CLASS = "EClass";
+
+ public static final String E_REFERENCE = "EReference";
+
+ public static final String E_ATTRIBUTE = "EAttribute";
+
+ public static final String E_OPERATION = "EOperation";
+
+ public static final String INHERITANCE = "Inheritance";
+
+ public static final String E_DATATYPE = "EDataType";
+
+ public static final String E_PACKAGE = "EPackage";
+
+ public static final String E_ANNOTATION = "EAnnotation";
+
+ public static final String E_ENUM = "EEnum";
+
+ public static final String E_ANNOTATION_LINK = "EAnnotation link";
+
+ public static final String DETAILS_ENTRY = "Details Entry";
+
private static String resourceFieldLabel = org.eclipse.emf.cdo.dawn.ui.messages.Messages.DawnCreateNewResourceWizardPage_6;
- public static SWTBotGefEditor openNewEcoreGMFEditor(String diagramResourceName, SWTGefBot bot)
+ public static SWTBotGefEditor openNewEcoreToolsEditor(String diagramResourceName, SWTGefBot bot)
{
bot.menu("File").menu("New").menu("Other...").click();
SWTBotShell shell = bot.shell("New");
shell.activate();
- bot.tree().expandNode("Dawn Examples").select(CREATION_WIZARD_NAME_GMF);
+ bot.tree().expandNode("Dawn Examples").select(DawnEcoreTestUtil.CREATION_WIZARD_NAME_GMF);
bot.button("Next >").click();
bot.button("Finish").click();
- SWTBotGefEditor editor = bot.gefEditor(diagramResourceName);
+ SWTBotGefEditor editor = bot.gefEditor("default");
return editor;
}
@@ -148,4 +178,94 @@ public class DawnEcoreTestUtil
}
return false;
}
+
+ public static List<SWTBotGefEditPart> getAllConnections(final SWTBotGefEditor editor)
+ {
+ List<SWTBotGefEditPart> aClassEditParts = editor.editParts(new AbstractMatcher<AClassEditPart>()
+ {
+ @Override
+ protected boolean doMatch(Object item)
+ {
+ if (item instanceof EClassEditPart)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public void describeTo(Description description)
+ {
+ }
+ });
+
+ List<SWTBotGefEditPart> ret = new ArrayList<SWTBotGefEditPart>();
+ for (SWTBotGefEditPart editPart : aClassEditParts)
+ {
+ ret.addAll(editPart.sourceConnections());
+ }
+
+ for (SWTBotGefEditPart editPart : aClassEditParts)
+ {
+ ret.addAll(editPart.targetConnections());
+ }
+
+ return ret;
+ }
+
+ public static List<SWTBotGefEditPart> getAllSourceConnections(final SWTBotGefEditor editor)
+ {
+ List<SWTBotGefEditPart> aClassEditParts = editor.editParts(new AbstractMatcher<AClassEditPart>()
+ {
+ @Override
+ protected boolean doMatch(Object item)
+ {
+ if (item instanceof EClassEditPart)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public void describeTo(Description description)
+ {
+ }
+ });
+
+ List<SWTBotGefEditPart> ret = new ArrayList<SWTBotGefEditPart>();
+ for (SWTBotGefEditPart editPart : aClassEditParts)
+ {
+ ret.addAll(editPart.sourceConnections());
+ }
+
+ return ret;
+ }
+
+ public static List<SWTBotGefEditPart> getAllTargetConnections(final SWTBotGefEditor editor)
+ {
+ List<SWTBotGefEditPart> aClassEditParts = editor.editParts(new AbstractMatcher<AClassEditPart>()
+ {
+ @Override
+ protected boolean doMatch(Object item)
+ {
+ if (item instanceof EClassEditPart)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public void describeTo(Description description)
+ {
+ }
+ });
+
+ List<SWTBotGefEditPart> ret = new ArrayList<SWTBotGefEditPart>();
+
+ for (SWTBotGefEditPart editPart : aClassEditParts)
+ {
+ ret.addAll(editPart.targetConnections());
+ }
+
+ return ret;
+ }
}

Back to the top