aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-01-19 14:26:30 (EST)
committermgolubev2012-01-19 14:26:30 (EST)
commit5db2a608d58a747949a93a42891f2534537ac7d8 (patch)
tree4bcb663a9ed973550d530f99226eb0c6b3f9e8ce
parent0e4a3c5c86390605cd394ce13746860ac24d930c (diff)
downloadorg.eclipse.gmf-tooling-5db2a608d58a747949a93a42891f2534537ac7d8.zip
org.eclipse.gmf-tooling-5db2a608d58a747949a93a42891f2534537ac7d8.tar.gz
org.eclipse.gmf-tooling-5db2a608d58a747949a93a42891f2534537ac7d8.tar.bz2
[QVTo bridge] Updated Header/Copyright form
-rw-r--r--plugins/org.eclipse.gmf.bridge.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.gmf.bridge.ui/src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java120
-rw-r--r--plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/QVTDiagramGenModelTransformer.java10
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Actions.qvto2
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/DiagramRunTimeModel.qvto2
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto9
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto10
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Map2GenMappings.qvto15
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto11
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto10
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Navigator.qvto2
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/PreferencePages.qvto2
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/PropertySheet.qvto2
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/RichClientPlatformApp.qvto2
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto5
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto10
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto10
-rw-r--r--plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareAbstractTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareTestSupport.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonAudtisTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonCompartmentRefNodeTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonFullTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonLinksTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonNodeLabelsTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformModeledViewmapTest.java10
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelAbstractTest.java652
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelOperationSupport.java450
28 files changed, 233 insertions, 1182 deletions
diff --git a/plugins/org.eclipse.gmf.bridge.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.bridge.ui/META-INF/MANIFEST.MF
index 41352a7..d2bea26 100644
--- a/plugins/org.eclipse.gmf.bridge.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.bridge.ui/META-INF/MANIFEST.MF
@@ -19,6 +19,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
org.eclipse.gmf.map.edit;bundle-version="[2.0.0,3.0.0)",
org.eclipse.emf.codegen.ecore.ui;bundle-version="[2.3.0,3.0.0)",
org.eclipse.emf.importer;bundle-version="[2.3.0,3.0.0)",
+ org.eclipse.m2m.qvt.oml;bundle-version="[3.0.0,4.0.0)",
org.eclipse.m2m.qvt.oml.runtime;bundle-version="[2.0.0,4.0.0)"
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.gmf.internal.bridge.resolver;x-internal:=true,
diff --git a/plugins/org.eclipse.gmf.bridge.ui/src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java b/plugins/org.eclipse.gmf.bridge.ui/src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java
index 6a70f06..a905e3c 100644
--- a/plugins/org.eclipse.gmf.bridge.ui/src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java
+++ b/plugins/org.eclipse.gmf.bridge.ui/src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java
@@ -14,9 +14,8 @@ package org.eclipse.gmf.internal.bridge.transform;
import java.io.IOException;
import java.net.URL;
import java.text.MessageFormat;
-import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -49,7 +48,7 @@ import org.eclipse.gmf.internal.bridge.genmodel.DiagramRunTimeModelHelper;
import org.eclipse.gmf.internal.bridge.genmodel.GenModelProducer;
import org.eclipse.gmf.internal.bridge.genmodel.InnerClassViewmapProducer;
import org.eclipse.gmf.internal.bridge.genmodel.ModeledViewmapProducer;
-import org.eclipse.gmf.internal.bridge.genmodel.RuntimeGenModelAccess;
+import org.eclipse.gmf.internal.bridge.genmodel.QVTDiagramGenModelTransformer;
import org.eclipse.gmf.internal.bridge.genmodel.ViewmapProducer;
import org.eclipse.gmf.internal.bridge.naming.gen.GenNamingMediatorImpl;
import org.eclipse.gmf.internal.bridge.ui.Plugin;
@@ -57,25 +56,26 @@ import org.eclipse.gmf.internal.codegen.util.GMFGenConfig;
import org.eclipse.gmf.internal.common.migrate.ModelLoadHelper;
import org.eclipse.gmf.internal.common.reconcile.Reconciler;
import org.eclipse.gmf.mappings.Mapping;
-import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper;
-import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper.ModelExtent;
-import org.eclipse.m2m.qvt.oml.runtime.util.QvtoTransformationHelper.TransfExecutionResult;
+import org.eclipse.m2m.qvt.oml.BasicModelExtent;
+import org.eclipse.m2m.qvt.oml.ExecutionContextImpl;
+import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
+import org.eclipse.m2m.qvt.oml.TransformationExecutor;
//[artem] XXX Why it's in the bridge.ui???
public class TransformToGenModelOperation {
-
+
private URI myGMFGenModelURI;
private TransformOptions myOptions;
private Mapping myMapping;
private GenModelDetector myGMDetector;
private GenModel myGenModel;
-
+
private Diagnostic myMapmodelValidationResult = Diagnostic.CANCEL_INSTANCE;
private Diagnostic myGMFGenValidationResult = Diagnostic.CANCEL_INSTANCE;
private IStatus myStaleGenmodelStatus = Status.CANCEL_STATUS;
private final ResourceSet myResourceSet;
-
+
public TransformToGenModelOperation(ResourceSet rs) {
assert rs != null;
myResourceSet = rs;
@@ -85,7 +85,7 @@ public class TransformToGenModelOperation {
public TransformOptions getOptions() {
return myOptions;
}
-
+
public URI getGenURI() {
return this.myGMFGenModelURI;
}
@@ -105,14 +105,14 @@ public class TransformToGenModelOperation {
Mapping getMapping() {
return this.myMapping;
}
-
+
private void setMapping(Mapping m, Diagnostic validationResult) {
this.myMapping = m;
this.myMapmodelValidationResult = validationResult;
myGMDetector = (m != null) ? new GenModelDetector(m) : null;
myGenModel = null;
}
-
+
private void setGMFGenValidationResult(Diagnostic validationResult) {
this.myGMFGenValidationResult = validationResult;
}
@@ -120,7 +120,7 @@ public class TransformToGenModelOperation {
public GenModelDetector getGenModelDetector() {
return myGMDetector;
}
-
+
public Diagnostic getGMFGenValidationResult() {
return this.myGMFGenValidationResult;
}
@@ -128,7 +128,7 @@ public class TransformToGenModelOperation {
public Diagnostic getMapmodelValidationResult() {
return this.myMapmodelValidationResult;
}
-
+
public IStatus getStaleGenmodelStatus() {
return this.myStaleGenmodelStatus;
}
@@ -176,7 +176,7 @@ public class TransformToGenModelOperation {
}
}
}
-
+
public GenModel findGenmodel() throws CoreException {
IStatus detect;
try {
@@ -242,7 +242,7 @@ public class TransformToGenModelOperation {
}
}
}
-
+
public IStatus executeTransformation(IProgressMonitor pm) {
IProgressMonitor monitor = null;
Diagnostic validation = Diagnostic.CANCEL_INSTANCE;
@@ -270,13 +270,17 @@ public class TransformToGenModelOperation {
if (Plugin.needsReconcile()) {
handlePreReconcileHooks(genEditor);
reconcile(genEditor);
- handlePostReconcileHooks(genEditor);
+ handlePostReconcileHooks(genEditor);
+ }
+ if (hasExtensionTransformation(getMapping().eResource().getURI())) {
+ executeExtensionTransformation(getMapping().eResource().getURI(), genEditor);
}
GenNamingMediatorImpl namer = new GenNamingMediatorImpl();
namer.setMode(GenNamingMediatorImpl.Mode.COLLECT_NAMES);
namer.traverse(genEditor); // collect reconciled names
namer.setMode(GenNamingMediatorImpl.Mode.DISPENSE_NAMES);
namer.traverse(genEditor); // dispense names to new elements
+
monitor.worked(20);
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
@@ -313,27 +317,35 @@ public class TransformToGenModelOperation {
}
}
+ protected boolean hasExtensionTransformation(URI uri) {
+ final URI transfURI = uri.trimFileExtension().appendFileExtension("qvto");
+ final TransformationExecutor executor = new TransformationExecutor(transfURI);
+ Diagnostic diag = executor.loadTransformation();
+ return diag.getCode() == Diagnostic.OK;
+ }
+
+ protected void executeExtensionTransformation(URI uri, GenEditorGenerator result) {
+ final URI transfURI = uri.trimFileExtension().appendFileExtension("qvto");
+ final TransformationExecutor executor = new TransformationExecutor(transfURI);
+ final ExecutionContextImpl context = new ExecutionContextImpl();
+ executor.execute(context, new BasicModelExtent(Arrays.asList(new GenEditorGenerator[]{result})));
+ }
+
protected void handlePreReconcileHooks(GenEditorGenerator result) {
if (getOptions().getPreReconcileTransform() != null) {
- try {
- URI transfURI = URI.createURI(getOptions().getPreReconcileTransform().toExternalForm());
- new QvtoTransformationHelper(transfURI).executeTransformation(Collections.<EObject>singletonList(result), Collections.<String, Object>emptyMap(), getResourceSet());
- } catch (CoreException ex) {
- Plugin.log(ex);
- }
+ URI transfURI = URI.createURI(getOptions().getPreReconcileTransform().toExternalForm());
+ final TransformationExecutor executor = new TransformationExecutor(transfURI);
+ final ExecutionContextImpl context = new ExecutionContextImpl();
+ executor.execute(context, new BasicModelExtent(Arrays.asList(new GenEditorGenerator[]{result})));
}
}
protected void handlePostReconcileHooks(GenEditorGenerator result) {
if (getOptions().getPostReconcileTransform() != null) {
- try {
- URI transfURI = URI.createURI(getOptions().getPostReconcileTransform().toExternalForm());
- List<EObject> in = Collections.<EObject>singletonList(result);
- Map<String, Object> props = Collections.<String, Object>emptyMap();
- new QvtoTransformationHelper(transfURI).executeTransformation(in, props, getResourceSet());
- } catch (CoreException ex) {
- Plugin.log(ex);
- }
+ URI transfURI = URI.createURI(getOptions().getPostReconcileTransform().toExternalForm());
+ final TransformationExecutor executor = new TransformationExecutor(transfURI);
+ final ExecutionContextImpl context = new ExecutionContextImpl();
+ executor.execute(context, new BasicModelExtent(Arrays.asList(new GenEditorGenerator[]{result})));
}
}
@@ -343,7 +355,7 @@ public class TransformToGenModelOperation {
throw new IllegalStateException(Messages.TransformToGenModelOperation_e_null_mapping);
}
}
-
+
static IStatus getFirst(Diagnostic d) {
if (d == null) {
return Status.OK_STATUS;
@@ -355,7 +367,7 @@ public class TransformToGenModelOperation {
return BasicDiagnostic.toIStatus(children.get(0));
}
}
-
+
private DiagramRunTimeModelHelper detectRunTimeModel() {
return new BasicDiagramRunTimeModelHelper();
}
@@ -378,32 +390,27 @@ public class TransformToGenModelOperation {
private GenModelProducer createGenModelProducer(VisualIdentifierDispenserProvider idDespenser) {
if (getOptions().getMainTransformation() != null) {
- final Map<String, Object> configProps = new HashMap<String, Object>();
- configProps.put("useMapMode", getOptions().getUseMapMode());
- configProps.put("useFullRunTime", getOptions().getUseRuntimeFigures());
- configProps.put("rcp", getOptions().getGenerateRCP());
+ final ExecutionContextImpl context = new ExecutionContextImpl();
+ context.setConfigProperty("rcp", getOptions().getGenerateRCP());
+ context.setConfigProperty("useMapMode", getOptions().getUseMapMode());
+ context.setConfigProperty("useFullRunTime", getOptions().getUseRuntimeFigures());
+ context.setConfigProperty("useInTransformationCodeGen", getOptions().getUseInTransformationCodeGen());
+
+ final QVTDiagramGenModelTransformer transformer = new QVTDiagramGenModelTransformer(getResourceSet());
+
return new GenModelProducer() {
public GenEditorGenerator process(Mapping mapping, IProgressMonitor progress) throws CoreException {
progress.beginTask(null, 1);
try {
- URI transfURI = URI.createURI(getOptions().getMainTransformation().toExternalForm());
- QvtoTransformationHelper helper = new QvtoTransformationHelper(transfURI);
- ArrayList<EObject> args = new ArrayList<EObject>(5);
- args.add(mapping);
- args.add(getGenModel());
- RuntimeGenModelAccess runtimeAccess = new RuntimeGenModelAccess();
- runtimeAccess.ensure();
- args.add(runtimeAccess.genPackage() == null ? null : runtimeAccess.genPackage().getGenModel());
- TransfExecutionResult result = helper.executeTransformation(args, configProps, getResourceSet());
+ final BasicModelExtent output = new BasicModelExtent();
+ final ExecutionDiagnostic result = transformer.transform(mapping, getGenModel(), output, context);
+
if (Plugin.printTransformationConsole()) {
- System.err.println(result.getConsoleOutput());
+ System.err.println(result.getMessage());
}
- for (ModelExtent me : result.getOutModelExtents()) {
- for (EObject r : me.getAllRootElements()) {
- if (r instanceof GenEditorGenerator) {
- return (GenEditorGenerator) r;
- }
- }
+ if(result.getSeverity() == Diagnostic.OK) {
+ List<EObject> outObjects = output.getContents();
+ return outObjects.get(0) instanceof GenEditorGenerator ? (GenEditorGenerator) outObjects.get(0) : null;
}
throw new CoreException(new Status(IStatus.ERROR, Plugin.getPluginID(), "Transformation has no out parameter of GenEditorGenerator type"));
} finally {
@@ -420,7 +427,7 @@ public class TransformToGenModelOperation {
t.setEMFGenModel(getGenModel());
}
return new GenModelProducer() {
-
+
public GenEditorGenerator process(Mapping mapping, IProgressMonitor progress) {
progress.beginTask(null, 1);
try {
@@ -434,6 +441,8 @@ public class TransformToGenModelOperation {
}
}
+
+
private void reconcile(GenEditorGenerator genBurdern) {
GenEditorGenerator old = null;
Resource resource = null;
@@ -522,6 +531,9 @@ public class TransformToGenModelOperation {
private static void updateExternalReferences(GenEditorGenerator newEditorGenerator, final GenEditorGenerator oldEditorGenerator, List<EObject> allContentButOldGenerator) {
// find references from rest of the content to old generator
final Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = new ExternalCrossReferencer(allContentButOldGenerator) {
+
+ private static final long serialVersionUID = 4383601037841211175L;
+
@Override
protected boolean crossReference(EObject object, EReference reference, EObject crossReferencedEObject) {
return super.crossReference(object, reference, crossReferencedEObject) && EcoreUtil.isAncestor(oldEditorGenerator, crossReferencedEObject);
diff --git a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/QVTDiagramGenModelTransformer.java b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/QVTDiagramGenModelTransformer.java
index 41a8222..d8510a8 100644
--- a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/QVTDiagramGenModelTransformer.java
+++ b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/QVTDiagramGenModelTransformer.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.internal.bridge.genmodel;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Actions.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Actions.qvto
index 107434a..297eab2 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Actions.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Actions.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/DiagramRunTimeModel.qvto b/plugins/org.eclipse.gmf.bridge/transforms/DiagramRunTimeModel.qvto
index 531c220..e69055f 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/DiagramRunTimeModel.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/DiagramRunTimeModel.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
index 33eee0e..0f2ae2f 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Identity.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
@@ -15,16 +15,9 @@ modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
--- modeltype TRACE uses trace('http://www.eclipse.org/gmf/2006/Trace');
-
---import gmf.TraceModelFacade;
library Identity;
---main() {
--- mapModel.rootObjects()![GMFMAP::Mapping].visualIdentity();
---}
-
-- *************************************************************************************
-- Visual ID
-- *************************************************************************************
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto
index 209486a..f92f7dc 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2009 Borland Software Corporation
+/**
+ * Copyright (c) 2009 Borland Software Corporation & others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,8 +8,8 @@
*
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
+ * Guillaume Hillairet (Montages A.G.)
*/
--- import transformations. To be replaced with access keyword, once supported
import Map2GenUtil;
import Map2GenMappings;
import DiagramRunTimeModel;
@@ -30,11 +30,7 @@ modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel');
--- modeltype TRACE uses trace('http://www.eclipse.org/gmf/2006/Trace');
---
--- Next attempt to author GMFMap-to-GMFGen transformation
---
transformation Map2Gen(in mapModel: GMFMAP, in domainGenModel: GENMODEL, in diagramRuntimeGenModel: GENMODEL, out gmfgenModel: GMFGEN)
access Map2GenUtil;
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Map2GenMappings.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Map2GenMappings.qvto
index ced5c40..909de88 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Map2GenMappings.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Map2GenMappings.qvto
@@ -1,4 +1,16 @@
-import Map2GenUtil;
+/**
+ * Copyright (c) 2009 Borland Software Corporation & 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Guillaume Hillairet (Montages A.G.)
+ */
+ import Map2GenUtil;
library Map2GenMappings;
@@ -8,7 +20,6 @@ modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel');
--- modeltype TRACE uses trace('http://www.eclipse.org/gmf/2006/Trace');
property mapRoot : GMFMAP::Mapping = null;
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto
index 3168384..d2f42dd 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Map2GenUtil.qvto
@@ -1,4 +1,13 @@
-
+/**
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*/
modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
modeltype GENMODEL uses genmodel('http://www.eclipse.org/emf/2002/GenModel');
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto b/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
index 6b8aef1..fed2b43 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/ModeledViewmaps.qvto
@@ -1,3 +1,13 @@
+/**
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*/
modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype GMFGRAPH uses gmfgraph('http://www.eclipse.org/gmf/2006/GraphicalDefinition');
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Navigator.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Navigator.qvto
index af0d3f2..9a12aac 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Navigator.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Navigator.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/PreferencePages.qvto b/plugins/org.eclipse.gmf.bridge/transforms/PreferencePages.qvto
index e3a051e..4320588 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/PreferencePages.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/PreferencePages.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/PropertySheet.qvto b/plugins/org.eclipse.gmf.bridge/transforms/PropertySheet.qvto
index f5f8fa7..7c9c23e 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/PropertySheet.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/PropertySheet.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/RichClientPlatformApp.qvto b/plugins/org.eclipse.gmf.bridge/transforms/RichClientPlatformApp.qvto
index bd53b0f..952f30b 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/RichClientPlatformApp.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/RichClientPlatformApp.qvto
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright (c) 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto b/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
index 47a8252..05ab8db 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/Viewmaps.qvto
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2009 Borland Software Corporation
+/**
+ * Copyright (c) 2009 Borland Software Corporation & others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Artem Tikhomirov (Borland) - initial API and implementation
+ * Guillaume Hillairet (Montages A.G.)
*/
import xpt.XpandFacade;
import Map2GenUtil;
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto b/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto
index df9a547..d81bd3d 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/migration/Diff2Qvt.qvto
@@ -1,3 +1,13 @@
+/**
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*/
modeltype DIFF uses diff('http://www.eclipse.org/emf/compare/diff/1.1');
modeltype QVT uses qvtoperational::expressions('http://www.eclipse.org/QVT/1.0.0/Operational');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto b/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto
index 4342dc0..3e30424 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/util/GmfGenUtil.qvto
@@ -1,3 +1,13 @@
+/**
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*/
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');
diff --git a/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto b/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto
index d7bee16..eeedb4f 100644
--- a/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto
+++ b/plugins/org.eclipse.gmf.bridge/transforms/util/TraceUtil.qvto
@@ -1,3 +1,13 @@
+/**
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*/
modeltype TRACE uses trace('http:///www.eclipse.org/m2m/qvt/operational/trace.ecore');
modeltype GMFMAP uses mappings('http://www.eclipse.org/gmf/2006/mappings');
modeltype GMFGEN uses gmfgen('http://www.eclipse.org/gmf/2009/GenModel');
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareAbstractTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareAbstractTest.java
index 1ab9fee..0fa62bf 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareAbstractTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareAbstractTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
import org.eclipse.emf.common.util.BasicEList;
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareTestSupport.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareTestSupport.java
index a4abda6..f2a5da1 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareTestSupport.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformCompareTestSupport.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
import java.io.IOException;
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonAudtisTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonAudtisTest.java
index 4769ac2..cddf789 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonAudtisTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonAudtisTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
public class QvtTransformComparisonAudtisTest extends QvtTransformCompareAbstractTest {
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonCompartmentRefNodeTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonCompartmentRefNodeTest.java
index 7d52dc5..d7289ea 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonCompartmentRefNodeTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonCompartmentRefNodeTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
public class QvtTransformComparisonCompartmentRefNodeTest extends QvtTransformCompareAbstractTest {
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonFullTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonFullTest.java
index 33b66c9..154cee5 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonFullTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonFullTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
public class QvtTransformComparisonFullTest extends QvtTransformCompareAbstractTest {
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonLinksTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonLinksTest.java
index 62e6917..a76e30c 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonLinksTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonLinksTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
public class QvtTransformComparisonLinksTest extends QvtTransformCompareAbstractTest {
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonNodeLabelsTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonNodeLabelsTest.java
index bf8b5b3..a4bb0a5 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonNodeLabelsTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformComparisonNodeLabelsTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
public class QvtTransformComparisonNodeLabelsTest extends QvtTransformCompareAbstractTest {
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformModeledViewmapTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformModeledViewmapTest.java
index 122a03c..f5bbf61 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformModeledViewmapTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/QvtTransformModeledViewmapTest.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+* Copyright (c) 2011, 2012 Montages A.G.
+* 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:
+* Guillaume Hillairet (Montages A.G.) : initial implementation
+*******************************************************************************/
package org.eclipse.gmf.tests.tr;
import org.eclipse.emf.common.util.EList;
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelAbstractTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelAbstractTest.java
deleted file mode 100644
index 30661a6..0000000
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelAbstractTest.java
+++ /dev/null
@@ -1,652 +0,0 @@
-package org.eclipse.gmf.tests.tr;
-
-import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.gmf.codegen.gmfgen.Behaviour;
-import org.eclipse.gmf.codegen.gmfgen.ElementType;
-import org.eclipse.gmf.codegen.gmfgen.GenAuditContainer;
-import org.eclipse.gmf.codegen.gmfgen.GenAuditContext;
-import org.eclipse.gmf.codegen.gmfgen.GenAuditRoot;
-import org.eclipse.gmf.codegen.gmfgen.GenAuditRule;
-import org.eclipse.gmf.codegen.gmfgen.GenChildNode;
-import org.eclipse.gmf.codegen.gmfgen.GenCompartment;
-import org.eclipse.gmf.codegen.gmfgen.GenContextMenu;
-import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
-import org.eclipse.gmf.codegen.gmfgen.GenDiagramUpdater;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorView;
-import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase;
-import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderContainer;
-import org.eclipse.gmf.codegen.gmfgen.GenLink;
-import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel;
-import org.eclipse.gmf.codegen.gmfgen.GenNavigator;
-import org.eclipse.gmf.codegen.gmfgen.GenNavigatorChildReference;
-import org.eclipse.gmf.codegen.gmfgen.GenNode;
-import org.eclipse.gmf.codegen.gmfgen.GenNodeLabel;
-import org.eclipse.gmf.codegen.gmfgen.GenParserImplementation;
-import org.eclipse.gmf.codegen.gmfgen.GenParsers;
-import org.eclipse.gmf.codegen.gmfgen.GenPlugin;
-import org.eclipse.gmf.codegen.gmfgen.GenPropertySheet;
-import org.eclipse.gmf.codegen.gmfgen.GenPropertyTab;
-import org.eclipse.gmf.codegen.gmfgen.GenTopLevelNode;
-import org.eclipse.gmf.codegen.gmfgen.LabelModelFacet;
-import org.eclipse.gmf.codegen.gmfgen.LinkModelFacet;
-import org.eclipse.gmf.codegen.gmfgen.Palette;
-import org.eclipse.gmf.codegen.gmfgen.ToolGroup;
-import org.eclipse.gmf.codegen.gmfgen.ToolGroupItem;
-import org.eclipse.gmf.codegen.gmfgen.Viewmap;
-
-public abstract class TransformToGenModelAbstractTest extends TransformToGenModelOperationSupport {
-
- public TransformToGenModelAbstractTest(String name) {
- super(name);
- }
-
- public void testGenAuditRoot() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenAuditRoot(expected, actual);
- }
-
- public void testGenTopLevelNode() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenTopLevelNode(expected, actual);
- }
-
- public void testGenChildNode() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenChildNode(expected, actual);
- }
-
- public void testGenLink() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenLink(expected, actual);
- }
-
- public void testGenNavigator() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenNavigator(expected, actual);
- }
-
- public void testGenNavigatorChildReferences() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenNavigatorChildReferences(expected, actual);
- }
-
- public void testGenPlugin() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenPlugin(expected, actual);
- }
-
- public void testGenPropertySheet() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenPropertySheet(expected, actual);
- }
-
- public void testGenPropertySheetTabs() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenPropertySheetTabs(expected, actual);
- }
-
- public void testGenDiagramPalette() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestDiagramPalette(expected, actual);
- }
-
- public void testGenDiagramPaletteToolGroup() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestDiagramPaletteToolGroup(expected, actual);
- }
-
- public void testGenDiagramUpdater() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenDiagramUpdater(expected, actual);
- }
-
- public void testGenEditorView() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenEditorView(expected, actual);
- }
-
- public void testLabelGenParsers() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestLabelGenParsers(expected, actual);
- }
-
- public void testGenContextMenu() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenContextMenu(expected, actual);
- }
-
- public void testGenDiagramAttributes() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenDiagramAttributes(expected, actual);
- }
-
- public void testGenExpressionProviderContainer() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenExpressionProviderContainer(expected, actual);
- }
-
- public void testGenCompartments() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenDiagramCompartments(expected, actual);
- }
-
- public void testGenDiagramBehaviour() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenDiagramBehaviour(expected, actual);
- }
-
- public void testGenDiagramAssistantNodes() {
- GenEditorGenerator expected = executeBaseTransformation();
- GenEditorGenerator actual = executeQvtTransformation();
-
- doTestGenDiagramAssistantNodes(expected, actual);
- }
-
- protected void doTestGenDiagramAttributes(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenDiagram baseDiagram = expectedGenEditor.getDiagram();
- GenDiagram qvtDiagram = actualGenEditor.getDiagram();
-
- checkObjectAttributes(baseDiagram, qvtDiagram);
- }
-
- protected void doTestGenAuditRoot(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenAuditRoot baseAudit = expectedGenEditor.getAudits();
- GenAuditRoot qvtAudit = actualGenEditor.getAudits();
-
- if (baseAudit == null) {
- assertNull(qvtAudit);
- } else {
- assertNotNull(qvtAudit);
-
- checkObjectAttributes(baseAudit, qvtAudit);
-
- EList<GenAuditRule> expR = baseAudit.getRules();
- EList<GenAuditRule> actR = qvtAudit.getRules();
- assertEquals(expR.size(), actR.size());
- for (int i=0; i<expR.size(); i++) {
- GenAuditRule exp = expR.get(i);
- GenAuditRule act = actR.get(i);
-
- checkObjectAttributes(exp, act);
- }
-
- EList<GenAuditContext> expCtx = baseAudit.getClientContexts();
- EList<GenAuditContext> actCtx = qvtAudit.getClientContexts();
-
- assertEquals(expCtx.size(), actCtx.size());
- for (int i=0;i<expCtx.size();i++) {
- GenAuditContext exp = expCtx.get(i);
- GenAuditContext act = findActualCtx(exp, actCtx);
- assertNotNull(act);
-
- checkObjectAttributes(exp, act);
- }
-
- EList<GenAuditContainer> expCt = baseAudit.getCategories();
- EList<GenAuditContainer> actCt = qvtAudit.getCategories();
-
- assertEquals(expCt.size(), actCt.size());
- for (int i=0;i<expCt.size();i++) {
- GenAuditContainer exp = expCt.get(i);
- GenAuditContainer act = actCt.get(i);
-
- checkObjectAttributes(exp, act);
- }
- }
- }
-
- protected void doTestGenTopLevelNode(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenDiagram expectedDiagram = expectedGenEditor.getDiagram();
- GenDiagram actualDiagram = actualGenEditor.getDiagram();
-
- assertNotNull(expectedDiagram);
- assertNotNull(actualDiagram);
-
- EList<GenTopLevelNode> expected = expectedDiagram.getTopLevelNodes();
- EList<GenTopLevelNode> actual = actualDiagram.getTopLevelNodes();
-
- assertEquals(expected.size(), actual.size());
- for (int i=0;i<expected.size();i++) {
-
- GenTopLevelNode expectedNode = expected.get(i);
- GenTopLevelNode actualNode = actual.get(i);
-
- checkNodeAttributes(expectedNode, actualNode);
-
- assertEquals(expectedNode.getChildNodes().size(), actualNode.getChildNodes().size());
-
- if (expectedNode.getViewmap() == null)
- assertNull(actualNode.getViewmap());
- else {
- assertNotNull(actualNode.getViewmap());
- Viewmap expViewmap = expectedNode.getViewmap();
- Viewmap actViewmap = actualNode.getViewmap();
-
- assertEquals(expViewmap.getRequiredPluginIDs(), actViewmap.getRequiredPluginIDs());
- checkObjectAttributes(expViewmap, actViewmap);
- }
-
- assertEquals(expectedNode.getLabels().size(), actualNode.getLabels().size());
-
- for (int j=0;j<expectedNode.getLabels().size(); j++) {
- GenNodeLabel expectedLabel = expectedNode.getLabels().get(j);
- GenNodeLabel actualLabel = actualNode.getLabels().get(j);
-
- assertEquals(expectedLabel.getVisualID(), actualLabel.getVisualID());
- checkObjectAttributes(expectedLabel, actualLabel);
-
- if (expectedLabel.getViewmap() == null)
- assertNull(actualLabel.getViewmap());
- else {
- assertNotNull(actualLabel.getViewmap());
- Viewmap expViewmap = expectedLabel.getViewmap();
- Viewmap actViewmap = actualLabel.getViewmap();
-
- checkObjectAttributes(expViewmap, actViewmap);
- }
- }
- }
- }
-
- protected void checkNodeAttributes(GenNode expectedNode, GenNode actualNode) {
- assertEquals(expectedNode.getVisualID(), actualNode.getVisualID());
- assertEquals(expectedNode.getUniqueIdentifier(), actualNode.getUniqueIdentifier());
-
- assertEquals(expectedNode.getClassNamePrefix(), actualNode.getClassNamePrefix());
- assertEquals(expectedNode.getClassNameSuffux(), actualNode.getClassNameSuffux());
-
- System.out.println(expectedNode.getCanonicalEditPolicyQualifiedClassName() + " ---- " + actualNode.getCanonicalEditPolicyQualifiedClassName());
-
-// assertEquals(expectedNode.getCanonicalEditPolicyClassName(), actualNode.getCanonicalEditPolicyClassName());
- assertEquals(expectedNode.getCanonicalEditPolicyQualifiedClassName(), actualNode.getCanonicalEditPolicyQualifiedClassName());
-
- assertEquals(expectedNode.getCreateCommandClassName(), actualNode.getCreateCommandClassName());
- assertEquals(expectedNode.getCreateCommandQualifiedClassName(), actualNode.getCreateCommandQualifiedClassName());
- assertEquals(expectedNode.getEditPartClassName(), actualNode.getEditPartClassName());
- assertEquals(expectedNode.getEditPartQualifiedClassName(), actualNode.getEditPartQualifiedClassName());
- assertEquals(expectedNode.getGraphicalNodeEditPolicyClassName(), actualNode.getGraphicalNodeEditPolicyClassName());
- assertEquals(expectedNode.getGraphicalNodeEditPolicyQualifiedClassName(), actualNode.getGraphicalNodeEditPolicyQualifiedClassName());
- assertEquals(expectedNode.getItemSemanticEditPolicyClassName(), actualNode.getItemSemanticEditPolicyClassName());
- assertEquals(expectedNode.getItemSemanticEditPolicyQualifiedClassName(), actualNode.getItemSemanticEditPolicyQualifiedClassName());
- assertEquals(expectedNode.getNotationViewFactoryClassName(), actualNode.getNotationViewFactoryClassName());
- assertEquals(expectedNode.getNotationViewFactoryQualifiedClassName(), actualNode.getNotationViewFactoryQualifiedClassName());
- assertEquals(expectedNode.getPrimaryDragEditPolicyQualifiedClassName(), actualNode.getPrimaryDragEditPolicyQualifiedClassName());
- }
-
- protected void doTestGenChildNode(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenDiagram expectedDiagram = expectedGenEditor.getDiagram();
- GenDiagram actualDiagram = actualGenEditor.getDiagram();
-
- assertNotNull(expectedDiagram);
- assertNotNull(actualDiagram);
-
- EList<GenChildNode> expected = expectedDiagram.getChildNodes();
- EList<GenChildNode> actual = actualDiagram.getChildNodes();
-
- assertEquals(expected.size(), actual.size());
- for (int i=0;i<expected.size();i++) {
- GenChildNode expectedNode = expected.get(i);
- GenChildNode actualNode = getChildNodeByVisualID(expectedNode.getVisualID(), actual);
- assertNotNull(actualNode);
-
- System.out.println(expectedNode.getCanonicalEditPolicyQualifiedClassName());
- System.out.println(actualNode.getCanonicalEditPolicyQualifiedClassName());
-
- checkNodeAttributes(expectedNode, actualNode);
-
- ElementType expectedType = expectedNode.getElementType();
- ElementType actualType = actualNode.getElementType();
-
- assertEquals(expectedType.getDisplayName(), actualType.getDisplayName());
- assertEquals(expectedType.getUniqueIdentifier(), actualType.getUniqueIdentifier());
- assertEquals(expectedType.getDiagramElement().getUniqueIdentifier(), actualType.getDiagramElement().getUniqueIdentifier());
-
- assertEquals(expectedNode.getAssistantNodes().size(), actualNode.getAssistantNodes().size());
-
- EList<Behaviour> expectedBehaviour = expectedNode.getBehaviour();
- EList<Behaviour> actualBehaviour = actualNode.getBehaviour();
-
- assertEquals(expectedBehaviour.size(), actualBehaviour.size());
-
- EList<GenNodeLabel> expLabel = expectedNode.getLabels();
- EList<GenNodeLabel> actLabel = actualNode.getLabels();
-
- assertEquals(expLabel.size(), actLabel.size());
-
- for (int j=0;j<expLabel.size();j++) {
- GenNodeLabel l = expLabel.get(j);
- GenNodeLabel ll = actLabel.get(j);
-
- assertEquals(l.getVisualID(), ll.getVisualID());
-
- LabelModelFacet expFacet = l.getModelFacet();
- LabelModelFacet actFacet = l.getModelFacet();
-
- assertEquals(expFacet.eContainingFeature(), actFacet.eContainingFeature());
- }
-
-
- }
- }
-
- protected void doTestGenLink(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenDiagram expectedDiagram = expectedGenEditor.getDiagram();
- GenDiagram actualDiagram = actualGenEditor.getDiagram();
-
- assertNotNull(expectedDiagram);
- assertNotNull(actualDiagram);
-
- EList<GenLink> expected = expectedDiagram.getLinks();
- EList<GenLink> actual = actualDiagram.getLinks();
-
- assertEquals(expected.size(), actual.size());
-
- for (int i=0;i<expected.size();i++) {
- GenLink expLink = expected.get(i);
- GenLink actLink = expected.get(i);
- checkObjectAttributes(expLink, actLink);
-
- LinkModelFacet expFacet = expLink.getModelFacet();
- LinkModelFacet actFacet = expLink.getModelFacet();
- checkObjectAttributes(expFacet, actFacet);
- assertEquals(expFacet.getSourceType(), actFacet.getSourceType());
- assertEquals(expFacet.eContainingFeature(), actFacet.eContainingFeature());
- assertEquals(expFacet.getTargetType(), actFacet.getTargetType());
-
- EList<GenLinkLabel> expLabels = expLink.getLabels();
- EList<GenLinkLabel> actLabels = actLink.getLabels();
- assertEquals(expLabels.size(), actLabels.size());
- }
- }
-
- protected void doTestGenNavigator(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenNavigator baseNavigator = expectedGenEditor.getNavigator();
- GenNavigator qvtNavigator = actualGenEditor.getNavigator();
-
- checkObjectAttributes(baseNavigator, qvtNavigator);
- }
-
- protected void doTestGenNavigatorChildReferences(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenNavigator expected = expectedGenEditor.getNavigator();
- GenNavigator actual = actualGenEditor.getNavigator();
-
- if (expected == null)
- assertNull(actual);
- else {
- assertNotNull(actual);
-
- assertTrue(expected.eResource().getContents().size() == 1);
- assertTrue(actual.eResource().getContents().size() == 1);
-
- EList<GenNavigatorChildReference> exp = expected.getChildReferences();
- EList<GenNavigatorChildReference> act = actual.getChildReferences();
-
- EList<GenNavigatorChildReference> found = new BasicEList<GenNavigatorChildReference>();
- assertEquals(exp.size(), act.size());
- for (int i=0; i<exp.size();i++) {
- GenNavigatorChildReference expRef = exp.get(i);
- GenNavigatorChildReference actualRef = findSameChildReference(expRef, act, found);
-
- assertNotNull(actualRef);
-
- if (!found.contains(actualRef)) {
- found.add(actualRef);
- checkObjectAttributes(expRef, actualRef);
- }
- }
- assertEquals(exp.size(), found.size());
- }
- }
-
- protected void doTestDiagramPalette(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- Palette expected = expectedGenEditor.getDiagram().getPalette();
- Palette actual = actualGenEditor.getDiagram().getPalette();
-
- checkObjectAttributes(expected, actual);
- }
-
- protected void doTestDiagramPaletteToolGroup(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- Palette basePalette = expectedGenEditor.getDiagram().getPalette();
- Palette qvtPalette = actualGenEditor.getDiagram().getPalette();
-
- if (basePalette == null) {
- assertNull(qvtPalette);
- } else {
- assertNotNull(qvtPalette);
-
- EList<ToolGroup> expected = basePalette.getGroups();
- EList<ToolGroup> actual = qvtPalette.getGroups();
-
- assertEquals(expected.size(), actual.size());
-
- for (int i=0;i<expected.size(); i++) {
- ToolGroup exp = expected.get(i);
- ToolGroup act = actual.get(i);
-
- checkObjectAttributes(exp, act);
-
- EList<ToolGroupItem> expItems = exp.getEntries();
- EList<ToolGroupItem> actItems = act.getEntries();
-
- assertEquals(expItems.size(), actItems.size());
-
- for (int j=0;j<expItems.size();j++) {
- checkObjectAttributes(expItems.get(i), actItems.get(i));
-
- }
- }
- }
- }
-
- //
- // Plugin
- //
-
- protected void doTestGenPlugin(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenPlugin basePlugin = expectedGenEditor.getPlugin();
- GenPlugin qvtPlugin = actualGenEditor.getPlugin();
-
- checkObjectAttributes(basePlugin, qvtPlugin);
- checkContainedObjects(basePlugin, qvtPlugin);
- }
-
- //
- // Editor
- //
-
- protected void doTestGenEditorView(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenEditorView baseEditor = expectedGenEditor.getEditor();
- GenEditorView qvtEditor = actualGenEditor.getEditor();
-
- checkObjectAttributes(baseEditor, qvtEditor);
-
- GenEditorGenerator baseEditorGen = baseEditor.getEditorGen();
- GenEditorGenerator qvtEditorGen = qvtEditor.getEditorGen();
-
- checkObjectAttributes(baseEditorGen, qvtEditorGen);
-
-// checkContainedObjects(baseEditorGen, qvtEditorGen);
- }
-
- //
- // DiagramUpdater
- //
-
- protected void doTestGenDiagramUpdater(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenDiagramUpdater baseUpdater = expectedGenEditor.getDiagramUpdater();
- GenDiagramUpdater qvtUpdater = actualGenEditor.getDiagramUpdater();
-
- checkObjectAttributes(baseUpdater, qvtUpdater);
- checkContainedObjects(baseUpdater, qvtUpdater);
- }
-
- //
- // PropertySheet
- //
-
- protected void doTestGenPropertySheet(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenPropertySheet basePropSheet = expectedGenEditor.getPropertySheet();
- GenPropertySheet qvtPropSheet = actualGenEditor.getPropertySheet();
-
- assertEquals(basePropSheet.getLabelProviderClassName(), qvtPropSheet.getLabelProviderClassName());
- assertEquals(basePropSheet.getLabelProviderQualifiedClassName(), qvtPropSheet.getLabelProviderQualifiedClassName());
-
- assertEquals(basePropSheet.getPackageName(), qvtPropSheet.getPackageName());
-
- checkObjectAttributes(basePropSheet, qvtPropSheet);
- checkContainedObjects(basePropSheet, qvtPropSheet);
- }
-
- protected void doTestGenPropertySheetTabs(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenPropertySheet expected = expectedGenEditor.getPropertySheet();
- GenPropertySheet actual = actualGenEditor.getPropertySheet();
-
- if (expected == null)
- assertNull(actual);
- else {
- EList<GenPropertyTab> exp = expected.getTabs();
- EList<GenPropertyTab> act = actual.getTabs();
-
- assertEquals(exp.size(), act.size());
- for (int i=0; i<exp.size();i++) {
- checkObjectAttributes(exp.get(i), act.get(i));
- }
-
- checkContainedObjects(expected, actual);
- }
- }
-
- protected void doTestLabelGenParsers(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenParsers baseParser = expectedGenEditor.getLabelParsers();
- GenParsers qvtParser = actualGenEditor.getLabelParsers();
-
- checkObjectAttributes(baseParser, qvtParser);
-
- EList<GenParserImplementation> expected = baseParser.getImplementations();
- EList<GenParserImplementation> actual = qvtParser.getImplementations();
-
- assertEquals(expected.size(), actual.size());
- for (int i=0;i<expected.size();i++) {
- GenParserImplementation expectImpl = expected.get(i);
- GenParserImplementation actualImpl = findParserImpl(expectImpl, actual);
- assertNotNull(actualImpl);
- checkObjectAttributes(expectImpl, actualImpl);
- }
- }
-
- protected void doTestGenContextMenu(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- EList<GenContextMenu> baseContexts = expectedGenEditor.getContextMenus();
- EList<GenContextMenu> qvtContexts = actualGenEditor.getContextMenus();
-
- assertEquals(baseContexts.size(), qvtContexts.size());
-
- for (int i=0; i<baseContexts.size(); i++) {
- assertEquals(baseContexts.get(i).getID(), qvtContexts.get(i).getID());
-
- checkObjectAttributes(baseContexts.get(i), qvtContexts.get(i));
- checkContainedObjects(baseContexts.get(i), qvtContexts.get(i));
- }
- }
-
- //
- // ExpressionProviderContainer
- //
-
- protected void doTestGenExpressionProviderContainer(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- GenExpressionProviderContainer baseExpr = expectedGenEditor.getExpressionProviders();
- GenExpressionProviderContainer qvtExpr = actualGenEditor.getExpressionProviders();
-
- if (baseExpr == null) {
- assertNull(qvtExpr);
- } else {
- assertNotNull(qvtExpr);
-
- checkObjectAttributes(baseExpr, qvtExpr);
-
- EList<GenExpressionProviderBase> expected = baseExpr.getProviders();
- EList<GenExpressionProviderBase> actual = baseExpr.getProviders();
-
- assertEquals(expected.size(), actual.size());
- for (int i=0;i<expected.size();i++) {
- GenExpressionProviderBase exp = expected.get(i);
- GenExpressionProviderBase act = findGenExpressionProviderBase(exp, actual);
- assertNotNull(act);
- checkObjectAttributes(exp, act);
- }
- }
- }
-
- protected void doTestGenDiagramAssistantNodes(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- EList<GenNode> expected = expectedGenEditor.getDiagram().getAssistantNodes();
- EList<GenNode> actual = actualGenEditor.getDiagram().getAssistantNodes();
-
- assertEquals(expected.size(), actual.size());
-
- for (int i=0; i<expected.size();i++) {
- checkObjectAttributes(expected.get(i), actual.get(i));
- }
- }
-
- protected void doTestGenDiagramBehaviour(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- EList<Behaviour> expected = expectedGenEditor.getDiagram().getBehaviour();
- EList<Behaviour> actual = actualGenEditor.getDiagram().getBehaviour();
-
- assertEquals(expected.size(), actual.size());
- for (int i=0; i<expected.size();i++) {
- checkObjectAttributes(expected.get(i), actual.get(i));
- checkContainedObjects(expected.get(i), actual.get(i));
- }
- }
-
- protected void doTestGenDiagramCompartments(GenEditorGenerator expectedGenEditor, GenEditorGenerator actualGenEditor) {
- EList<GenCompartment> expected = expectedGenEditor.getDiagram().getCompartments();
- EList<GenCompartment> actual = actualGenEditor.getDiagram().getCompartments();
-
- assertEquals(expected.size(), actual.size());
- for (int i=0; i<expected.size();i++) {
- checkObjectAttributes(expected.get(i), actual.get(i));
- checkContainedObjects(expected.get(i), actual.get(i));
- }
- }
-
-}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelOperationSupport.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelOperationSupport.java
deleted file mode 100644
index ef6d609..0000000
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/tr/TransformToGenModelOperationSupport.java
+++ /dev/null
@@ -1,450 +0,0 @@
-package org.eclipse.gmf.tests.tr;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.gmf.codegen.gmfgen.GenAuditContext;
-import org.eclipse.gmf.codegen.gmfgen.GenChildNode;
-import org.eclipse.gmf.codegen.gmfgen.GenCommonBase;
-import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
-import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase;
-import org.eclipse.gmf.codegen.gmfgen.GenNavigatorChildReference;
-import org.eclipse.gmf.codegen.gmfgen.GenParserImplementation;
-import org.eclipse.gmf.codegen.gmfgen.LabelModelFacet;
-import org.eclipse.gmf.codegen.gmfgen.ValueExpression;
-import org.eclipse.gmf.internal.bridge.transform.GenModelDetector;
-import org.eclipse.gmf.internal.bridge.transform.TransformToGenModelOperation;
-import org.eclipse.gmf.internal.common.URIUtil;
-import org.eclipse.gmf.mappings.Mapping;
-import org.eclipse.gmf.tests.ConfiguredTestCase;
-
-public class TransformToGenModelOperationSupport extends ConfiguredTestCase {
-
- protected static String FOLDER_MODELS = "models"; //$NON-NLS-1$
- protected static String FILE_BASE = "test"; //$NON-NLS-1$
- protected static String FILE_EXT_ECORE = "ecore"; //$NON-NLS-1$
- protected static String FILE_EXT_GMFGEN = "gmfgen"; //$NON-NLS-1$
- protected static String FILE_EXT_GMFGRAPH = "gmfgraph"; //$NON-NLS-1$
- protected static String FILE_EXT_GMFMAP = "gmfmap"; //$NON-NLS-1$
- protected static String FILE_EXT_GMFTOOL = "gmftool"; //$NON-NLS-1$
-
- protected IProject myProject;
-
- protected String testFolder = "platform:/plugin/org.eclipse.gmf.tests/models/tests"; //$NON-NLS-1$
-
- protected String test1 = "test-1"; //$NON-NLS-1$
- protected String test2 = "test-2"; //$NON-NLS-1$
- protected String test3 = "test-3"; //$NON-NLS-1$
- protected String test4 = "test-4"; //$NON-NLS-1$
- protected String modelName;
- protected String emf_model_uri;
- protected String gen_model_uri;
- protected String tool_model_uri;
- protected String graph_model_uri;
- protected String map_model_uri;
-
- public TransformToGenModelOperationSupport(String name) {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- myProject = createProject();
- }
-
- @Override
- protected void tearDown() throws Exception {
- deleteProject();
- myProject = null;
- super.tearDown();
- }
-
- protected void prepareResources() throws IOException {
- ResourceSet rs = new ResourceSetImpl();
- Resource emf = rs.createResource(URI.createURI(emf_model_uri));
- emf.load(null);
- Resource tool = rs.createResource(URI.createURI(tool_model_uri));
- tool.load(null);
- Resource graph = rs.createResource(URI.createURI(graph_model_uri));
- graph.load(null);
- Resource map = rs.createResource(URI.createURI(map_model_uri));
- map.load(null);
- }
-
- protected GenEditorGenerator executeBaseTransformation() {
- try {
- prepareResources();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
-
- TransformToGenModelOperation operation = new TransformToGenModelOperation(new ResourceSetImpl());
- loadMappingModel(URI.createURI(map_model_uri), operation);
- operation.getGenModelDetector().detect();
-
- try {
- operation.loadGenModel(URI.createURI(gen_model_uri), null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- operation.setGenURI(createURI(FILE_EXT_GMFGEN));
-
- IStatus status = operation.executeTransformation(null);
- assertTrue(status.getMessage(), status.isOK());
-
- GenEditorGenerator genEditor = (GenEditorGenerator) operation.getResourceSet().getResource(
- operation.getGenURI(), true).getContents().get(0);
-
- assertNotNull(genEditor);
- genEditor.eResource().setURI(genEditor.eResource().getURI().trimFileExtension().appendFileExtension("java.gmfgen"));
- try {
- genEditor.eResource().save(null);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return genEditor;
- }
-
- protected GenEditorGenerator executeQvtTransformation() {
- return executeQvtTransformation(false, true);
- }
-
- protected GenEditorGenerator executeQvtTransformation(boolean rcp, boolean useCodeGen) {
- try {
- prepareResources();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
-
- TransformToGenModelOperation operation = new TransformToGenModelOperation(new ResourceSetImpl());
- loadMappingModel(URI.createURI(map_model_uri), operation);
- operation.getGenModelDetector().detect();
-
- try {
- operation.loadGenModel(URI.createURI(gen_model_uri), null);
- } catch (CoreException e1) {
- e1.printStackTrace();
- }
-
- String pathName = getProject().getName() +
- IPath.SEPARATOR + FOLDER_MODELS +
- IPath.SEPARATOR + modelName + ".gmfgen"; //$NON-NLS-1$
-
- URI uri = URI.createPlatformResourceURI(pathName, true);
-
- operation.setGenURI(uri);
- operation.getOptions().setUseMapMode(true);
- operation.getOptions().setUseRuntimeFigures(false);
- operation.getOptions().setGenerateRCP(rcp);
- operation.getOptions().setInTransformationCodeGen(useCodeGen);
-
- try {
- operation.getOptions().setTransformation(new URL(
- URI.createURI("platform:/plugin/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto").toString()));
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
-
- IStatus status = operation.executeTransformation(null);
- assertTrue(status.getMessage(), status.isOK());
-
- GenEditorGenerator genEditor = (GenEditorGenerator) operation.getResourceSet().getResource(
- operation.getGenURI(), true).getContents().get(0);
-
- assertNotNull(genEditor);
- genEditor.eResource().setURI(genEditor.eResource().getURI().trimFileExtension().appendFileExtension("qvt.gmfgen"));
- try {
- genEditor.eResource().save(null);
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- return genEditor;
- }
-
- protected void deleteProject() throws CoreException {
- if (getProject() != null) {
- if (getProject().isOpen()) {
- getProject().close(new NullProgressMonitor());
- }
- if (getProject().exists()) {
- getProject().delete(true, new NullProgressMonitor());
- }
- }
- }
-
- protected IProject getProject() {
- return myProject;
- }
-
- protected IProject createProject() {
- String projectName = "TransformToGenModelOperationTest_" + String.valueOf(System.currentTimeMillis()); //$NON-NLS-1$
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- assertFalse("Project with this name already present in the workspace: " + projectName, project.exists());
- try {
- project.create(new NullProgressMonitor());
- project.open(new NullProgressMonitor());
- } catch (CoreException e) {
- fail(e.getMessage());
- }
- assertTrue("Project was not created: " + projectName, project.exists());
- return project;
- }
-
- protected void loadMappingModel(URI mapURI, TransformToGenModelOperation myOperation) {
- Mapping mapping = null;
- try {
- mapping = myOperation.loadMappingModel(mapURI, null);
- assertNotNull("Mapping should be resolved", mapping);
- Diagnostic validationResult = myOperation.getMapmodelValidationResult();
- assertNotNull("MappingModel validation result should be set", validationResult);
- assertFalse("MappingModel validation result should differ from CANCEL value", IStatus.CANCEL == validationResult.getSeverity());
- assertFalse("MappingModel validation result should differ from ERROR value", IStatus.ERROR == validationResult.getSeverity());
- assertNotNull("GenModelDetector should be initialized", myOperation.getGenModelDetector());
- assertNull("GenModel should be reset", myOperation.getGenModel());
- } catch (CoreException e) {
- fail(e.getStatus().getMessage());
- }
- }
-
- protected URI createDefaultGenModel(URI mapURI, TransformToGenModelOperation myOperation) {
- URI genmodelURI = null;
- try {
- GenModelDetector gmd = myOperation.getGenModelDetector();
- assertNotNull("GenModelDetector should be initialized", gmd);
- genmodelURI = gmd.createDefault(getProject().getName(), URIUtil.getFile(mapURI));
- assertNotNull("GenModel URI should be created", genmodelURI);
-
- IFile file = URIUtil.getFile(mapURI);
- assertNotNull("GenModel file should be created", file);
- assertTrue("GenModel file should exists", file.exists());
- } catch (CoreException e) {
- fail("Failed to create default GenModel: " + e.getMessage());
- }
- return genmodelURI;
- }
-
- protected URI prepareResources(String baseURI) throws IOException {
- ResourceSet rs = new ResourceSetImpl();
- Resource emf = rs.createResource(URI.createURI(baseURI+".ecore"));
- emf.load(null);
- Resource tool = rs.createResource(URI.createURI(baseURI+".gmftool"));
- tool.load(null);
- Resource graph = rs.createResource(URI.createURI(baseURI+".gmfgraph"));
- graph.load(null);
- Resource map = rs.createResource(URI.createURI(baseURI+".gmfmap"));
- map.load(null);
-
- return URI.createURI(baseURI+".gmfmap");
- }
-
-// protected URI prepareResources() {
-// ResourceSet rs = new ResourceSetImpl();
-// prepareResource(rs, FILE_EXT_ECORE, getSetup().getDomainModel().getModel());
-// prepareResource(rs, FILE_EXT_GMFGRAPH, getSetup().getGraphDefModel().getCanvasDef());
-// prepareResource(rs, FILE_EXT_GMFTOOL, getSetup().getToolDefModel().getRegistry());
-// URI mapURI = prepareResource(rs, FILE_EXT_GMFMAP, getSetup().getMapModel().getMapping());
-// return mapURI;
-// }
-
-// private URI prepareResource(ResourceSet rs, String extension, EObject root) {
-// URI uri = createURI(extension);
-// Resource resource = rs.createResource(uri, ContentHandler.UNSPECIFIED_CONTENT_TYPE);
-// resource.getContents().add(root);
-// try {
-// resource.save(Collections.EMPTY_MAP);
-// } catch (IOException e) {
-// fail("Failed to save " + uri.toFileString() + " :" + e.getMessage());
-// }
-// return uri;
-// }
-
- protected URI createURI(String extension) {
- String pathName = getProject().getName() +
- IPath.SEPARATOR + FOLDER_MODELS +
- IPath.SEPARATOR + FILE_BASE + "." + extension; //$NON-NLS-1$
- URI uri = URI.createPlatformResourceURI(pathName, true);
- return uri;
- }
-
- protected GenChildNode getChildNodeByVisualID(int visualID, EList<GenChildNode> child) {
- for (GenChildNode node: child) {
- if (visualID == node.getVisualID()) {
- return node;
- }
- }
- return null;
- }
-
- protected void checkObjectAttributes(EObject expected, EObject actual) {
- if (expected == null) {
- assertNull(actual);
- return;
- }
-
- assertNotNull(actual);
-
- for (EAttribute attr: expected.eClass().getEAllAttributes()) {
- if (expected.eIsSet(attr)) {
-
- assertTrue("attribute "+expected.eClass().getName()+"."+attr.getName()+" should be set", actual.eIsSet(attr));
-
- if (attr.isMany()) {
- List<?> exp = (List<?>) expected.eGet(attr);
- List<?> act = (List<?>) actual.eGet(attr);
- assertEquals(exp.size(), act.size());
- for (int i=0; i<exp.size(); i++) {
- assertTrue(act.contains(exp.get(i)));
- }
- } else {
- assertEquals(expected.eClass().getName()+" attribute: "+attr.getName(), expected.eGet(attr), actual.eGet(attr));
- }
-
- } else {
- //assertFalse("attribute "+attr.getName()+" should be set to "+expected.eGet(attr), actual.eIsSet(attr));
- }
- }
- }
-
- protected void checkContainedObjects(EObject expected, EObject actual) {
- if (expected == null) {
- assertNull(actual);
- return;
- }
-
- assertNotNull(actual);
-
- for (EReference ref: expected.eClass().getEAllReferences()) {
- if (ref.isMany()) {
- @SuppressWarnings("unchecked")
- EList<EObject> expectedObjects = (EList<EObject>) expected.eGet(ref);
- @SuppressWarnings("unchecked")
- EList<EObject> actualObjects = (EList<EObject>) actual.eGet(ref);
-
- assertEquals(expected.eClass().getName()+" number of elements in: " + ref.getName(), expectedObjects.size(), actualObjects.size());
-
- for (int i=0;i<expectedObjects.size();i++) {
- if (ref.isContainment()) {
- checkObjectAttributes(expectedObjects.get(i), actualObjects.get(i));
- checkContainedObjects(expectedObjects.get(i), actualObjects.get(i));
- }
- }
- } else {
- EObject exp = (EObject) expected.eGet(ref);
- EObject act = (EObject) actual.eGet(ref);
-
- if (ref.isContainment()) {
- checkObjectAttributes(exp, act);
- checkContainedObjects(exp, act);
- }
- }
- }
- }
-
- protected GenExpressionProviderBase findGenExpressionProviderBase(GenExpressionProviderBase exp, EList<GenExpressionProviderBase> actuals) {
- for (GenExpressionProviderBase actual: actuals) {
- if (checkValueExpressions(exp.getExpressions(), actual.getExpressions()))
- return actual;
- }
- return null;
- }
-
- protected ValueExpression findValueExpression(ValueExpression expected, EList<ValueExpression> actuals) {
- for (ValueExpression actual: actuals) {
- if (actual.getBody().equals(expected.getBody()) && actual.getBodyString().equals(expected.getBodyString())) {
- return actual;
- }
- }
- return null;
- }
-
- protected boolean checkValueExpressions(EList<ValueExpression> expected, EList<ValueExpression> actual) {
- if (expected.size() == actual.size()) {
- boolean find = true;
- for (int i=0;i<expected.size();i++) {
- ValueExpression exp = expected.get(i);
- ValueExpression found = findValueExpression(exp, actual);
- find = find && found != null;
- }
- return find;
- }
- return false;
- }
-
- protected GenNavigatorChildReference findSameChildReference(GenNavigatorChildReference expected, EList<GenNavigatorChildReference> actuals, EList<GenNavigatorChildReference> found) {
- for (GenNavigatorChildReference actual: actuals) {
-
- if (expected.getChild().getVisualID() == actual.getChild().getVisualID()) {
-
- if (expected.getParent() == null) {
- assertNull(actual.getParent());
- if (!found.contains(actual))
- return actual;
- } else {
- assertNotNull(actual.getParent());
- if (actual.getParent().getVisualID() == expected.getParent().getVisualID()) {
- if (!found.contains(actual))
- return actual;
- }
- }
- }
- }
- return null;
- }
-
- protected GenAuditContext findActualCtx(GenAuditContext expected, EList<GenAuditContext> actuals) {
- for (GenAuditContext actual: actuals) {
- if (actual.getId().equals(expected.getId())) {
- return actual;
- }
- }
- return null;
- }
-
- protected GenParserImplementation findParserImpl(GenParserImplementation expectImpl, EList<GenParserImplementation> actuals) {
- for (GenParserImplementation actual: actuals) {
- if (actual.eClass().equals(expectImpl.eClass())) {
- boolean res = true;
- for (LabelModelFacet facet: expectImpl.getUses()) {
- res = res && findLabelModelFacet(facet, actual.getUses());
- }
- if (res)
- return actual;
- }
- }
- return null;
- }
-
- private boolean findLabelModelFacet(LabelModelFacet facet, EList<LabelModelFacet> uses) {
- GenCommonBase expected = (GenCommonBase)facet.eContainer();
-
- if (uses.isEmpty()) return false;
- for (LabelModelFacet f: uses) {
- if (f.eContainer() instanceof GenCommonBase) {
- if ( ((GenCommonBase)f.eContainer()).getVisualID() == expected.getVisualID() )
- return true;
- }
- }
- return false;
- }
-}