Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-10-21 18:58:29 +0000
committerEd Willink2016-10-22 07:46:25 +0000
commit39df077fc6a82bd052c6a0767a534833d2d78977 (patch)
treea84ef2c165b397350ee60db086fb39529252a033
parent25e3fb0886c149126eb97f3a901a45f86575dc61 (diff)
downloadorg.eclipse.qvtd-39df077fc6a82bd052c6a0767a534833d2d78977.tar.gz
org.eclipse.qvtd-39df077fc6a82bd052c6a0767a534833d2d78977.tar.xz
org.eclipse.qvtd-39df077fc6a82bd052c6a0767a534833d2d78977.zip
[506328] Accommodate AS URIs for derived CS resources
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtbase/src/org/eclipse/qvtd/xtext/qvtbase/utilities/QVTbaseCSResource.java35
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/utilities/QVTcoreCSResource.java10
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java10
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/utilities/QVTrelationCSResource.java10
4 files changed, 41 insertions, 24 deletions
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtbase/src/org/eclipse/qvtd/xtext/qvtbase/utilities/QVTbaseCSResource.java b/plugins/org.eclipse.qvtd.xtext.qvtbase/src/org/eclipse/qvtd/xtext/qvtbase/utilities/QVTbaseCSResource.java
new file mode 100644
index 000000000..dc50eabd9
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.xtext.qvtbase/src/org/eclipse/qvtd/xtext/qvtbase/utilities/QVTbaseCSResource.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2016 Willink Transformations 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:
+ * E.D.Willink - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.qvtd.xtext.qvtbase.utilities;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
+import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource;
+
+public abstract class QVTbaseCSResource extends EssentialOCLCSResource
+{
+ @Override
+ public @NonNull URI getASURI(@NonNull URI csURI) {
+ assert !PivotUtilInternal.isASURI(csURI);
+ return PivotUtilInternal.appendASExtensionSuffix(csURI);
+ }
+
+ @Override
+ public void setURI(URI uri) {
+ assert uri != null;
+ if (PivotUtilInternal.isASURI(uri)) {
+ uri = PivotUtilInternal.trimASExtensionSuffix(uri);
+ setDerived(true);
+ }
+ super.setURI(uri);
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/utilities/QVTcoreCSResource.java b/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/utilities/QVTcoreCSResource.java
index e58ce097b..fb869c8eb 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/utilities/QVTcoreCSResource.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/utilities/QVTcoreCSResource.java
@@ -12,7 +12,6 @@ package org.eclipse.qvtd.xtext.qvtcore.utilities;
import java.util.Map;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -26,7 +25,6 @@ import org.eclipse.ocl.pivot.resource.BasicProjectManager;
import org.eclipse.ocl.xtext.base.as2cs.AS2CS;
import org.eclipse.ocl.xtext.base.cs2as.CS2AS;
import org.eclipse.ocl.xtext.base.utilities.BaseCSResource;
-import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
@@ -35,10 +33,11 @@ import org.eclipse.qvtd.pivot.qvtcore.QVTcorePackage;
import org.eclipse.qvtd.pivot.qvtcore.RealizedVariable;
import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcoreASResourceFactory;
+import org.eclipse.qvtd.xtext.qvtbase.utilities.QVTbaseCSResource;
import org.eclipse.qvtd.xtext.qvtcore.as2cs.QVTcoreAS2CS;
import org.eclipse.qvtd.xtext.qvtcore.cs2as.QVTcoreCS2AS;
-public class QVTcoreCSResource extends EssentialOCLCSResource
+public class QVTcoreCSResource extends QVTbaseCSResource
{
@Override
public @NonNull CS2AS createCS2AS(@NonNull EnvironmentFactoryInternal environmentFactory, @NonNull ASResource asResource) {
@@ -62,11 +61,6 @@ public class QVTcoreCSResource extends EssentialOCLCSResource
}
@Override
- public @NonNull URI getASURI(@NonNull URI csURI) {
- return URI.createURI(csURI.toString() + "as");
- }
-
- @Override
public @NonNull CS2AS getCS2AS() {
EnvironmentFactoryInternal environmentFactory = PivotUtilInternal.findEnvironmentFactory(this);
if (environmentFactory == null) {
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java
index e2cb5e0e1..26ef6d397 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java
@@ -12,7 +12,6 @@ package org.eclipse.qvtd.xtext.qvtimperative.utilities;
import java.util.Map;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -26,7 +25,6 @@ import org.eclipse.ocl.pivot.resource.BasicProjectManager;
import org.eclipse.ocl.xtext.base.as2cs.AS2CS;
import org.eclipse.ocl.xtext.base.cs2as.CS2AS;
import org.eclipse.ocl.xtext.base.utilities.BaseCSResource;
-import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
@@ -37,10 +35,11 @@ import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeASResourceFactory;
+import org.eclipse.qvtd.xtext.qvtbase.utilities.QVTbaseCSResource;
import org.eclipse.qvtd.xtext.qvtimperative.as2cs.QVTimperativeAS2CS;
import org.eclipse.qvtd.xtext.qvtimperative.cs2as.QVTimperativeCS2AS;
-public class QVTimperativeCSResource extends EssentialOCLCSResource
+public class QVTimperativeCSResource extends QVTbaseCSResource
{
@Override
public @NonNull AS2CS createAS2CS(@NonNull Map<? extends BaseCSResource, ? extends ASResource> cs2asResourceMap,
@@ -73,11 +72,6 @@ public class QVTimperativeCSResource extends EssentialOCLCSResource
}
@Override
- public @NonNull URI getASURI(@NonNull URI csURI) {
- return URI.createURI(csURI.toString() + "as");
- }
-
- @Override
public @NonNull String getEditorName() {
return "QVT Imperative";
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/utilities/QVTrelationCSResource.java b/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/utilities/QVTrelationCSResource.java
index 11c4ba4e7..e5f5065c2 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/utilities/QVTrelationCSResource.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/utilities/QVTrelationCSResource.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.qvtd.xtext.qvtrelation.utilities;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -22,16 +21,16 @@ import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
import org.eclipse.ocl.pivot.resource.ASResource;
import org.eclipse.ocl.pivot.resource.BasicProjectManager;
import org.eclipse.ocl.xtext.base.cs2as.CS2AS;
-import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtrelation.QVTrelationPackage;
import org.eclipse.qvtd.pivot.qvtrelation.utilities.QVTrEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtrelation.utilities.QVTrelationASResourceFactory;
+import org.eclipse.qvtd.xtext.qvtbase.utilities.QVTbaseCSResource;
import org.eclipse.qvtd.xtext.qvtrelation.cs2as.QVTrelationCS2AS;
-public class QVTrelationCSResource extends EssentialOCLCSResource
+public class QVTrelationCSResource extends QVTbaseCSResource
{
@Override
public @NonNull CS2AS createCS2AS(@NonNull EnvironmentFactoryInternal environmentFactory, @NonNull ASResource asResource) {
@@ -49,11 +48,6 @@ public class QVTrelationCSResource extends EssentialOCLCSResource
}
@Override
- public @NonNull URI getASURI(@NonNull URI csURI) {
- return URI.createURI(csURI.toString() + "as");
- }
-
- @Override
public @NonNull CS2AS getCS2AS() {
EnvironmentFactoryInternal environmentFactory = PivotUtilInternal.findEnvironmentFactory(this);
if (environmentFactory == null) {

Back to the top