aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-21 13:19:12 (EDT)
committermgolubev2012-05-21 13:19:12 (EDT)
commit87401a53e89e4a50c8c8ebcfc263dc342f6bf58c (patch)
treef10e78d7ee03cf6720fc5b025e19058d690d16d7
parentc2dbc2c43e57d0b80078a792f64f29a24a4aa3d9 (diff)
downloadorg.eclipse.gmf-tooling-87401a53e89e4a50c8c8ebcfc263dc342f6bf58c.zip
org.eclipse.gmf-tooling-87401a53e89e4a50c8c8ebcfc263dc342f6bf58c.tar.gz
org.eclipse.gmf-tooling-87401a53e89e4a50c8c8ebcfc263dc342f6bf58c.tar.bz2
Add getter/setter for transformation URL.
-rw-r--r--plugins/org.eclipse.gmf.bridge.ui/src/org/eclipse/gmf/internal/bridge/transform/TransformToGenModelOperation.java1
-rw-r--r--plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/QVTDiagramGenModelTransformer.java42
2 files changed, 34 insertions, 9 deletions
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 cd4d407..d5e5617 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
@@ -397,6 +397,7 @@ public class TransformToGenModelOperation {
context.setConfigProperty("useInTransformationCodeGen", getOptions().getUseInTransformationCodeGen());
final QVTDiagramGenModelTransformer transformer = new QVTDiagramGenModelTransformer(getResourceSet(), idDespenser.get());
+ transformer.setTransformationL(getOptions().getMainTransformation());
return new GenModelProducer() {
public GenEditorGenerator process(Mapping mapping, IProgressMonitor progress) throws CoreException {
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 f4d0d10..9a5ccd9 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
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.gmf.internal.bridge.genmodel;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.Diagnostic;
@@ -36,21 +39,31 @@ import org.eclipse.m2m.qvt.oml.ModelExtent;
@SuppressWarnings("restriction")
public class QVTDiagramGenModelTransformer {
+ private final static String myTransfPath = "platform:/plugin/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto";
+ private URI myTransfURI;
private Trace myTrace;
- private final URI transfURI = URI.createURI("platform:/plugin/org.eclipse.gmf.bridge/transforms/Map2Gen.qvto");
- private final ResourceSet resourceSet;
- private Registry registry;
+ private final ResourceSet myResourceSet;
+ private Registry myRegistry;
public QVTDiagramGenModelTransformer(ResourceSet resourceSet, VisualIdentifierDispenser idDespenser) {
- this.resourceSet = resourceSet;
+ myResourceSet = resourceSet;
VisualIdentifierDispenserFacade.Provider.setDispenser(idDespenser);
}
+ public static URL getDefaultTransformation() {
+ try {
+ return new URL(myTransfPath);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
public ExecutionDiagnostic transform(final Mapping m, final GenModel genModel, final ModelExtent output, final ExecutionContext context) {
- final Resource trace = m.eResource() == null ? resourceSet.createResource(URI.createURI("trace.qvtotrace")) : resourceSet.createResource(
+ final Resource trace = m.eResource() == null ? myResourceSet.createResource(URI.createURI("trace.qvtotrace")) : myResourceSet.createResource(
m.eResource().getURI().trimFileExtension().appendFileExtension("qvtotrace"));
- final InternalTransformationExecutor executor = new InternalTransformationExecutor(transfURI) {
+ final InternalTransformationExecutor executor = new InternalTransformationExecutor(getTransformation()) {
@Override
protected void handleExecutionTraces(Trace traces) {
super.handleExecutionTraces(traces);
@@ -72,7 +85,7 @@ public class QVTDiagramGenModelTransformer {
}
public void setRegistry(EPackage.Registry registry) {
- this.registry = registry;
+ this.myRegistry = registry;
}
public ExecutionDiagnostic transform(final Mapping m, final GenModel genModel, ModelExtent output, final ExecutionContext context, final URI... extensions) {
@@ -91,8 +104,8 @@ public class QVTDiagramGenModelTransformer {
output = getModelExtent(outputGenModel);
for (URI extension: extensions) {
- final InternalTransformationExecutor exec = registry == null ?
- new InternalTransformationExecutor(extension) : new InternalTransformationExecutor(extension, registry);
+ final InternalTransformationExecutor exec = myRegistry == null ?
+ new InternalTransformationExecutor(extension) : new InternalTransformationExecutor(extension, myRegistry);
exec.loadTransformation();
if (1 == exec.getTransformation().getModelParameter().size()) {
@@ -114,4 +127,15 @@ public class QVTDiagramGenModelTransformer {
mapObjects.add(rootObject);
return new BasicModelExtent(mapObjects);
}
+
+ public void setTransformationL(URL mainTransformation) {
+ myTransfURI = URI.createURI(mainTransformation.toString());
+ }
+
+ public URI getTransformation() {
+ if (myTransfURI == null) {
+ myTransfURI = URI.createURI(myTransfPath);
+ }
+ return myTransfURI;
+ }
}