Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo SBH2016-05-20 13:52:02 -0400
committerAdolfo SBH2016-05-22 08:15:35 -0400
commitca151f3396daf08865cd002e4da80a38a2a6f06b (patch)
treee6e18763e082f2205568801d6d23bc51a18eec09
parentf711d239a10f82415e2ceba80a56f3c252ad6e7f (diff)
downloadorg.eclipse.qvtd-asanchez/494243b.tar.gz
org.eclipse.qvtd-asanchez/494243b.tar.xz
org.eclipse.qvtd-asanchez/494243b.zip
[ocl2qvtp] - Minor changes to create the cloned OCL oeprations in aasanchez/494243b
separate .oclas file
-rw-r--r--plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java
index fd8e03255..7c1c8ad11 100644
--- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java
+++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java
@@ -11,6 +11,7 @@ import static org.eclipse.qvtd.cs2as.compiler.internal.OCL2QVTpUtil.getOwningPac
import static org.eclipse.qvtd.cs2as.compiler.internal.OCL2QVTpUtil.getSuperClasses;
import static org.eclipse.qvtd.cs2as.compiler.internal.OCL2QVTpUtil.getUpdateMappingName;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -490,8 +491,26 @@ public class OCL2QVTp {
private ClonsMap cloneImportedOperationsAndEcoreImports(Model oldModel, Model newModel, List<URI> extendedASURIs) {
- ClonsMap clonsMap = new ClonsMap(newModel);
+ Model newOCL = PivotFactory.eINSTANCE.createModel();
+ URI newOCLURI = URI.createURI(newModel.getExternalURI()).appendFileExtension("oclas");
+ newOCL.setExternalURI(newOCLURI.toString());
+
+ ClonsMap clonsMap = new ClonsMap(newOCL);
doCloneImportedOperationsAndImports(oldModel, clonsMap, new HashSet<Model>(), extendedASURIs);
+ updateOpCallExpressions(newOCL, clonsMap);
+
+ Import newOCLimport = PivotFactory.eINSTANCE.createImport();
+ newOCLimport.setImportedNamespace(newOCL);
+ newModel.getOwnedImports().add(newOCLimport);
+
+ Resource resource = envFact.getMetamodelManager().getASResourceSet().createResource(newOCLURI);
+ resource.getContents().add(newOCL);
+ try {
+ resource.save(saveOptions);
+ } catch (IOException e) {
+ logger.severe("qvtp.qvtcas.ocl OCL file could not be saved");
+ }
+
return clonsMap;
}
@@ -556,7 +575,7 @@ public class OCL2QVTp {
private void updateOpCallExpression(OperationCallExp opCallExp, ClonsMap copyHelper) {
Operation oclOp = opCallExp.getReferredOperation();
if (isOclDocOp().test(oclOp) // We are only interested in ops belonging to a model corresponding to an Ocl Doc
- && !refersToContainingOperation().test(opCallExp)) { // and opCallExps that refer to operation that contains them
+ && !refersToContainingOperation().test(opCallExp)) { // and opCallExps that do not refer to operations that contains them
Operation newOp = copyHelper.getCachedOperation(oclOp);
opCallExp.setReferredOperation(newOp);
}

Back to the top