Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2019-06-03 08:27:07 +0000
committerEd Willink2019-06-03 19:50:43 +0000
commitbe61cf2f4c9e3b0e37a7abb6bcda36a257f2416c (patch)
treef45ff6c5b2250e83df90d6c8221333770b73e41f
parentb20175cd63160f1121970fbcfea058e78ab38def (diff)
downloadorg.eclipse.qvtd-be61cf2f4c9e3b0e37a7abb6bcda36a257f2416c.tar.gz
org.eclipse.qvtd-be61cf2f4c9e3b0e37a7abb6bcda36a257f2416c.tar.xz
org.eclipse.qvtd-be61cf2f4c9e3b0e37a7abb6bcda36a257f2416c.zip
[547723] Support Extent creation/saving
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java
index 262bb053c..b23ff6bb4 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java
@@ -58,6 +58,10 @@ import org.eclipse.qvtd.runtime.evaluation.ModeFactory;
import org.eclipse.qvtd.runtime.evaluation.ObjectManager;
import org.eclipse.qvtd.runtime.evaluation.TransformationExecutor;
import org.eclipse.qvtd.runtime.evaluation.Transformer;
+import org.eclipse.qvtd.runtime.qvtruntimelibrary.Extent;
+import org.eclipse.qvtd.runtime.qvtruntimelibrary.QVTruntimeLibraryFactory;
+
+import com.google.common.collect.Iterables;
/**
* The abstract implementation of an auto-generated transformation provides the shared infrastructure for maintaining
@@ -331,6 +335,13 @@ public abstract class AbstractTransformerInternal /*extends AbstractModelManager
}
}
}
+ ClassId extentClassId = IdManager.getNsURIPackageId("http://www.eclipse.org/qvt/2019/QVTruntimeLibrary", null, null).getClassId("Extent", 0);
+ Integer extentClassIndex = transformer.classId2classIndex.get(extentClassId);
+ if (extentClassIndex != null) {
+ Extent extent = QVTruntimeLibraryFactory.eINSTANCE.createExtent();
+ Iterables.addAll(extent.getElements(), eRootObjects);
+ accumulateEObject1(extent, extent.eClass());
+ }
}
// protected @NonNull Connection createConnection(@NonNull Interval rootInterval, @NonNull ClassId classId, @NonNull String connectionName, boolean isStrict, boolean isIncremental) {
@@ -787,11 +798,24 @@ public abstract class AbstractTransformerInternal /*extends AbstractModelManager
*/
@Override
public @NonNull Collection<@NonNull EObject> getRootEObjects(@NonNull String modelName) {
+ boolean hasExtent = false;
Model model = getTypedModelInstance(modelName);
List<@NonNull EObject> rootEObjects = new ArrayList<>();
for (@NonNull Object rootObject : model.getRootObjects()) {
- if (rootObject instanceof EObject) {
- rootEObjects.add((EObject)rootObject);
+ if (rootObject instanceof Extent) {
+ hasExtent = true;
+ for (Object object : ((Extent)rootObject).getElements()) {
+ if (object != null) {
+ rootEObjects.add((EObject)object);
+ }
+ }
+ }
+ }
+ if (!hasExtent) {
+ for (@NonNull Object rootObject : model.getRootObjects()) {
+ if (rootObject instanceof EObject) {
+ rootEObjects.add((EObject)rootObject);
+ }
}
}
return rootEObjects;

Back to the top