Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-05-08 11:20:10 -0400
committerEd Willink2016-05-09 04:41:55 -0400
commit98264b84c5b55397fa410abcbb0be21e878f5f14 (patch)
treebd89017b915f8d818a6debf6dc3b9e41abb90113
parent8e9aa56a3073a1a29d62aeeec384ac8c9bbc5f45 (diff)
downloadorg.eclipse.qvtd-98264b84c5b55397fa410abcbb0be21e878f5f14.tar.gz
org.eclipse.qvtd-98264b84c5b55397fa410abcbb0be21e878f5f14.tar.xz
org.eclipse.qvtd-98264b84c5b55397fa410abcbb0be21e878f5f14.zip
[unrelated] Provide referenceable xmi:ids for context variables
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/utilities/QVTbaseAS2XMIidVisitor.java31
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/utilities/QVTcoreBaseAS2XMIidVisitor.java4
2 files changed, 32 insertions, 3 deletions
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/utilities/QVTbaseAS2XMIidVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/utilities/QVTbaseAS2XMIidVisitor.java
index 3ba728b06..1baf12599 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/utilities/QVTbaseAS2XMIidVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/utilities/QVTbaseAS2XMIidVisitor.java
@@ -10,15 +10,18 @@
*******************************************************************************/
package org.eclipse.qvtd.pivot.qvtbase.utilities;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Import;
+import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.utilities.AS2XMIid;
import org.eclipse.qvtd.pivot.qvtbase.BaseModel;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Pattern;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
+import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.util.AbstractQVTbaseAS2XMIidVisitor;
@@ -54,6 +57,11 @@ public class QVTbaseAS2XMIidVisitor extends AbstractQVTbaseAS2XMIidVisitor
}
@Override
+ public @Nullable Boolean visitImport(@NonNull Import object) {
+ return null;
+ }
+
+ @Override
public @Nullable Boolean visitPattern(@NonNull Pattern object) {
return false;
}
@@ -83,7 +91,26 @@ public class QVTbaseAS2XMIidVisitor extends AbstractQVTbaseAS2XMIidVisitor
}
@Override
- public @Nullable Boolean visitImport(@NonNull Import object) {
- return null;
+ public @Nullable Boolean visitVariable(@NonNull Variable object) {
+ EObject eContainer = object.eContainer();
+ if (eContainer instanceof Transformation) {
+ String name = object.getName();
+ if (name != null) {
+ s.append(VARIABLE_PREFIX);
+ appendParent(object);
+ appendName(name);
+ return true;
+ }
+ }
+ else if (eContainer instanceof TypedModel) {
+ String name = object.getName();
+ if (name != null) {
+ s.append(VARIABLE_PREFIX);
+ appendParent(object);
+ appendName(name);
+ return true;
+ }
+ }
+ return super.visitVariable(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/utilities/QVTcoreBaseAS2XMIidVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/utilities/QVTcoreBaseAS2XMIidVisitor.java
index 9189da76c..27c4e1dbd 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/utilities/QVTcoreBaseAS2XMIidVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtcorebase/src/org/eclipse/qvtd/pivot/qvtcorebase/utilities/QVTcoreBaseAS2XMIidVisitor.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.qvtd.pivot.qvtcorebase.utilities;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Variable;
@@ -84,7 +85,8 @@ public class QVTcoreBaseAS2XMIidVisitor extends AbstractQVTcoreBaseAS2XMIidVisit
@Override
public @Nullable Boolean visitVariable(@NonNull Variable object) {
- if (object.eContainer() instanceof CorePattern) {
+ EObject eContainer = object.eContainer();
+ if (eContainer instanceof CorePattern) {
Rule rule = QVTcoreBaseUtil.getContainingRule(object);
if((rule != null) && (rule.getName() != null)) {
String name = object.getName();

Back to the top