[537609] Cleanup
diff --git a/plugins/org.eclipse.m2m.qvt.oml.runtime/src/org/eclipse/m2m/qvt/oml/runtime/util/QvtoTransformationHelper.java b/plugins/org.eclipse.m2m.qvt.oml.runtime/src/org/eclipse/m2m/qvt/oml/runtime/util/QvtoTransformationHelper.java
index 43bd812..0231299 100644
--- a/plugins/org.eclipse.m2m.qvt.oml.runtime/src/org/eclipse/m2m/qvt/oml/runtime/util/QvtoTransformationHelper.java
+++ b/plugins/org.eclipse.m2m.qvt.oml.runtime/src/org/eclipse/m2m/qvt/oml/runtime/util/QvtoTransformationHelper.java
@@ -1,13 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 Borland Software Corporation and others.
- * 
+ * Copyright (c) 2007, 2019 Borland Software Corporation and others.
+ *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v20.html
- * 
+ *
  * Contributors:
  *     Borland Software Corporation - initial API and implementation
+ *     Christopher Gerking - bug 537609
  *******************************************************************************/
 package org.eclipse.m2m.qvt.oml.runtime.util;
 
@@ -29,20 +30,18 @@
 import org.eclipse.m2m.internal.qvt.oml.ast.env.ModelExtentContents;
 import org.eclipse.m2m.internal.qvt.oml.ast.parser.QvtOperationalParserUtil;
 import org.eclipse.m2m.internal.qvt.oml.common.MdaException;
-import org.eclipse.m2m.internal.qvt.oml.common.launch.ShallowProcess;
 import org.eclipse.m2m.internal.qvt.oml.compiler.CompiledUnit;
 import org.eclipse.m2m.internal.qvt.oml.compiler.QvtCompilerOptions;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.ModelContent;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.URIUtils;
 import org.eclipse.m2m.internal.qvt.oml.runtime.QvtRuntimePlugin;
-import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchConfigurationDelegateBase;
 import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchUtil;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtCompilerFacade;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtInterpretedTransformation;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtModule;
-import org.eclipse.m2m.internal.qvt.oml.runtime.project.TransformationUtil;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtTransformation.TransformationParameter;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtTransformation.TransformationParameter.DirectionKind;
+import org.eclipse.m2m.internal.qvt.oml.runtime.project.TransformationUtil;
 import org.eclipse.m2m.internal.qvt.oml.runtime.util.Messages;
 import org.eclipse.m2m.internal.qvt.oml.trace.Trace;
 import org.eclipse.m2m.qvt.oml.TransformationExecutor;
@@ -50,10 +49,11 @@
 
 /**
  * @author sboyko
- * 
+ *
  * @noextend This class is not intended to be subclassed by clients.
- * @deprecated use {@link TransformationExecutor} class instead 
+ * @deprecated use {@link TransformationExecutor} class instead
  */
+@Deprecated
 public class QvtoTransformationHelper {
 
 	/**
@@ -69,97 +69,89 @@
 		 * Note: The result may include the original objects if not removed or moved to container.
 		 */
 		List<EObject> getAllRootElements();
-	}	
-	
+	}
+
 	public static interface TransfExecutionResult {
 
 		/**
-		 * 
+		 *
 		 * @return List of resources (model extents) created for each 'inout' / 'out' model parameter. Extent contains root objects only.
 		 * <br>Model parameter comes from 'transformation' definition: <br> <code>transformation T(inout model1 : ecore, out model2 : uml);</code>
 		 */
 		List<ModelExtent> getOutModelExtents();
-		
+
 		/**
-		 * 
+		 *
 		 * @return List of transformation output parameters created for each 'out' parameter of transformation's entry operation.
 		 * <br>Output parameter comes from transformation's main() operation: <br> <code>main(out outParam : ecore::EPackage@model1) { .. }</code>
 		 */
 		List<EObject> getOutParameters();
-		
+
 		/**
-		 * 
+		 *
 		 * @return Console output produced by transformation.
 		 */
 		String getConsoleOutput();
 	}
-	
+
 	/**
 	 * @param transfUri uri of the transformation script: <br>
 	 * files like <code>file:/</code> <br>
-	 * platform resources like <code>platform:/resource/</code> <br>  
+	 * platform resources like <code>platform:/resource/</code> <br>
 	 * platform plugins like <code>platform:/plugin/</code> <br>
 	 */
 	public QvtoTransformationHelper(URI transfUri) {
 		myTransfUri = transfUri;
 	}
-	
+
 	public QvtoTransformationHelper(IFile qvtoFile) {
 		this(URI.createPlatformResourceURI(qvtoFile.getFullPath().toString(), false));
 	}
-		
-	public TransfExecutionResult executeTransformation(final List<? extends EObject> inObjects, final Map<String, Object> inConfigProperties, ResourceSet metamodelResourceSet) throws CoreException {
-        try {
-            if (metamodelResourceSet == null) {
-                metamodelResourceSet = new ResourceSetImpl();
-            }
-            QvtModule qvtModule = TransformationUtil.getQvtModule(myTransfUri);
 
-            final List<ModelExtentContents> outExtents = new ArrayList<ModelExtentContents>();
-        	final List<EObject> outMainParams = new ArrayList<EObject>();
-        	final List<Trace> outTraces = new ArrayList<Trace>(1);
-        	final List<String> outConsole = new ArrayList<String>(1);
-            final QvtInterpretedTransformation transf = new QvtInterpretedTransformation(qvtModule);
-        	
-        	QvtCompilerOptions options = new QvtCompilerOptions();
-        	options.setGenerateCompletionData(false);
-        	//options.setMetamodelResourceSet(wrappedMetamodelResourceSet);
-        	transf.setQvtCompilerOptions(options);
-        	
-//            ShallowProcess.IRunnable r = new ShallowProcess.IRunnable() {
-//                public void run() throws Exception {
-                	List<ModelContent> inModels = new ArrayList<ModelContent>(inObjects.size());
-                	for (EObject inObj : inObjects) {
-                		inModels.add(new ModelContent(Collections.singletonList(inObj)));
-                	}
-            		QvtLaunchUtil.doLaunch(transf, inModels, inConfigProperties,
-            				outExtents, outMainParams, outTraces, outConsole);
-            		
-            		transf.cleanup();
-//                }
-//
-//            };
-            
-//            r = QvtLaunchConfigurationDelegateBase.getSafeRunnable(transf, r);
-//            r.run();
-            
-            final List<ModelExtent> extents = new ArrayList<ModelExtent>();
-            for (ModelExtentContents nextExtent : outExtents) {
-            	final ModelExtentContents internExtent = nextExtent;
-				
-            	ModelExtent modelExtent = new ModelExtent() {
-					public List<EObject> getAllRootElements() {					
+	public TransfExecutionResult executeTransformation(final List<? extends EObject> inObjects, final Map<String, Object> inConfigProperties, ResourceSet metamodelResourceSet) throws CoreException {
+		try {
+			if (metamodelResourceSet == null) {
+				metamodelResourceSet = new ResourceSetImpl();
+			}
+			QvtModule qvtModule = TransformationUtil.getQvtModule(myTransfUri);
+
+			final List<ModelExtentContents> outExtents = new ArrayList<ModelExtentContents>();
+			final List<EObject> outMainParams = new ArrayList<EObject>();
+			final List<Trace> outTraces = new ArrayList<Trace>(1);
+			final List<String> outConsole = new ArrayList<String>(1);
+			final QvtInterpretedTransformation transf = new QvtInterpretedTransformation(qvtModule);
+
+			QvtCompilerOptions options = new QvtCompilerOptions();
+			options.setGenerateCompletionData(false);
+			//options.setMetamodelResourceSet(wrappedMetamodelResourceSet);
+			transf.setQvtCompilerOptions(options);
+
+			List<ModelContent> inModels = new ArrayList<ModelContent>(inObjects.size());
+			for (EObject inObj : inObjects) {
+				inModels.add(new ModelContent(Collections.singletonList(inObj)));
+			}
+			QvtLaunchUtil.doLaunch(transf, inModels, inConfigProperties,
+					outExtents, outMainParams, outTraces, outConsole);
+
+			transf.cleanup();
+
+			final List<ModelExtent> extents = new ArrayList<ModelExtent>();
+			for (ModelExtentContents nextExtent : outExtents) {
+				final ModelExtentContents internExtent = nextExtent;
+
+				ModelExtent modelExtent = new ModelExtent() {
+					public List<EObject> getAllRootElements() {
 						return internExtent.getAllRootElements();
 					}
-					public List<EObject> getInitialElements() {						
+					public List<EObject> getInitialElements() {
 						return internExtent.getInitialElements();
 					}
 				};
-				
+
 				extents.add(modelExtent);
 			}
-            
-            return new TransfExecutionResult() {
+
+			return new TransfExecutionResult() {
 				public List<ModelExtent> getOutModelExtents() {
 					return extents;
 				}
@@ -167,62 +159,59 @@
 				public List<EObject> getOutParameters() {
 					return outMainParams;
 				}
-				
+
 				public String getConsoleOutput() {
 					return outConsole.isEmpty() ? "" : outConsole.get(0); //$NON-NLS-1$
 				}
-            };
-        } 
+			};
+		}
 		catch (MdaException e) {
 			throw new CoreException(e.getStatus() != null ? e.getStatus() : new Status(IStatus.ERROR, QvtRuntimePlugin.ID, e.getMessage()));
 		}
-//		catch (CoreException e) {
-//			throw e;
-//		}
 		catch (Exception e) {
 			throw new CoreException(new Status(IStatus.ERROR, QvtRuntimePlugin.ID, e.getMessage()));
 		}
 	}
-	
+
 	/**
-	 * 
+	 *
 	 * @return List(Transformation File URI)
 	 * <ul>
 	 * <li> File URI is workspace-relative created with URI.createPlatformResourceURI() call
 	 * <li> All returned file URIs necessarily belong to single workspace plugin
 	 * </ul>
-	 * @throws CoreException in case file URI cannot be converted to workspace-relative scheme 
+	 * @throws CoreException in case file URI cannot be converted to workspace-relative scheme
 	 */
 	public List<URI> getImportedTransformations() throws CoreException {
 		try {
 			List<URI> importUris = new ArrayList<URI>();
-			
+
 			QvtCompilerOptions compilerOptions = new QvtCompilerOptions();
 			compilerOptions.setGenerateCompletionData(true);
-			CompiledUnit compiledUnit = QvtCompilerFacade.getCompiledModule(myTransfUri, compilerOptions, null).getCompiledModule();		
-			
+			CompiledUnit compiledUnit = QvtCompilerFacade.getCompiledModule(myTransfUri, compilerOptions, null).getCompiledModule();
+
 			{
-				
+
 				IFile file = URIUtils.getFile(compiledUnit.getURI());
 				if (file == null) {
 					throw new MdaException(NLS.bind(Messages.ImportedTransformation_NoWsFileForLocation, compiledUnit.getURI().toPlatformString(true)));
 				}
 				importUris.add(compiledUnit.getURI());
 			}
-			
+
 			Set<CompiledUnit> imports = new LinkedHashSet<CompiledUnit>();
 			QvtOperationalParserUtil.collectAllImports(compiledUnit, imports);
-			
+
 			for (CompiledUnit importedUnit : imports) {
 				URI unitURI = importedUnit.getURI();
 				IFile ifile = URIUtils.getFile(unitURI);
 				if (ifile == null) {
 					continue;
 				}
-				
+
 				importUris.add(URI.createPlatformResourceURI(ifile.getFullPath().toString(), false));
 			}
-			
+
 			return importUris;
 		}
 		catch (MdaException e) {
@@ -233,7 +222,7 @@
 	public List<String> getInputModelExtensions() throws CoreException {
 		try {
 			QvtModule qvtModule = TransformationUtil.getQvtModule(myTransfUri);
-	
+
 			List<String> extensions = new ArrayList<String>();
 			for (TransformationParameter param : qvtModule.getParameters()) {
 				if (param.getDirectionKind() == DirectionKind.OUT) {
@@ -243,7 +232,7 @@
 					extensions.add(param.getMetamodels().get(0).getName());
 				}
 			}
-			
+
 			return extensions;
 		}
 		catch (MdaException e) {
diff --git a/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/AbstractApplyTransformationTask.java b/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/AbstractApplyTransformationTask.java
index 360fce2..fc1e6e6 100644
--- a/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/AbstractApplyTransformationTask.java
+++ b/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/AbstractApplyTransformationTask.java
@@ -1,13 +1,14 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2018 Borland Software Corporation and others.
- * 
+ * Copyright (c) 2007, 2019 Borland Software Corporation and others.
+ *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v20.html
- * 
+ *
  * Contributors:
  *     Borland Software Corporation - initial API and implementation
+ *     Christopher Gerking - bug 537609
  *******************************************************************************/
 package org.eclipse.m2m.internal.qvt.oml.runtime.ant;
 
@@ -22,13 +23,11 @@
 import org.apache.tools.ant.Task;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.emf.common.util.URI;
-import org.eclipse.m2m.internal.qvt.oml.common.launch.ShallowProcess;
 import org.eclipse.m2m.internal.qvt.oml.common.launch.TargetUriData;
 import org.eclipse.m2m.internal.qvt.oml.common.launch.TargetUriData.TargetType;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.EmfUtil;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.StatusUtil;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.WorkspaceUtils;
-import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchConfigurationDelegateBase;
 import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchUtil;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtTransformation;
 import org.eclipse.m2m.internal.qvt.oml.runtime.project.QvtTransformation.TransformationParameter;
@@ -39,8 +38,8 @@
 /**
  * @author abreslav
  *
- *  Common ancestor for all apply QVT transformation tasks 
- *  
+ *  Common ancestor for all apply QVT transformation tasks
+ *
  *  NOTE: all the paths are workspace-relative
  */
 public abstract class AbstractApplyTransformationTask extends Task {
@@ -48,354 +47,345 @@
 	private static final String TAG_TARGET_URI = "targeturi"; //$NON-NLS-1$
 
 
-    /**
-     *  A configuration property element - specifies a configuration property value 
-     *  for the transformation 
-     */
-    public static class ConfigurationProperty {
-        
-        public ConfigurationProperty() {
-        }
-        
-        public ConfigurationProperty(String name, String value) {
-            this.name = name;
-            this.value = value;
-        }
-        
-        public String getName() {
-            return name;
-        }
-        
-        public void setName(String name) {
-            this.name = name;
-        }
-        
-        public String getValue() {
-            return value;
-        }
-        
-        public void setValue(String value) {
-            this.value = value;
-        }
-        
-        private String name;
-        private String value;
-    }
-    
-    /**
-     *  A target URI element - specifies a target URI structure of the transformation's parameter 
-     */
-    public static class TargetUriDef {
-        
-        public TargetUriDef() {
-        }
-        
-        public TargetUriDef(String targeturi, String targettype, String feature, String clearcontents) {
-            this.targeturi = targeturi;
-            this.targettype = targettype;
-            this.feature = feature;
-            this.clearcontents = clearcontents;
-        }
-        
-        public String getTargetUri() {
-            return targeturi;
-        }
-        
-        public void setTargetUri(String targeturi) {
-            this.targeturi = targeturi;
-        }
-        
-        public String getTargetType() {
-            return targettype;
-        }
-        
-        public void setTargetType(String targettype) {
-            this.targettype = targettype;
-        }
-        
-        public String getFeature() {
-            return feature;
-        }
-        
-        public void setFeature(String feature) {
-            this.feature = feature;
-        }
-        
-        public String getClearContents() {
-            return clearcontents;
-        }
-        
-        public void setClearContents(String clearcontents) {
-            this.clearcontents = clearcontents;
-        }
-        
-        private String targeturi;
-        private String targettype;
-        private String feature;
-        private String clearcontents;
-    }
-    
-    /**
-     * Throws an exception if the given object is null
-     */
-    public void checkAttribute(Object attr, String attrName) throws BuildException {
-        if (attr == null) {
-            throw new BuildException(
-                    NLS.bind(
-                            org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
-                            attrName
-                    )
-            );
-        }
-    }
-    
-    /**
-     * Checks up parameters validity and calls doExecute()
-     */
-    @Override
+	/**
+	 *  A configuration property element - specifies a configuration property value
+	 *  for the transformation
+	 */
+	public static class ConfigurationProperty {
+
+		public ConfigurationProperty() {
+		}
+
+		public ConfigurationProperty(String name, String value) {
+			this.name = name;
+			this.value = value;
+		}
+
+		public String getName() {
+			return name;
+		}
+
+		public void setName(String name) {
+			this.name = name;
+		}
+
+		public String getValue() {
+			return value;
+		}
+
+		public void setValue(String value) {
+			this.value = value;
+		}
+
+		private String name;
+		private String value;
+	}
+
+	/**
+	 *  A target URI element - specifies a target URI structure of the transformation's parameter
+	 */
+	public static class TargetUriDef {
+
+		public TargetUriDef() {
+		}
+
+		public TargetUriDef(String targeturi, String targettype, String feature, String clearcontents) {
+			this.targeturi = targeturi;
+			this.targettype = targettype;
+			this.feature = feature;
+			this.clearcontents = clearcontents;
+		}
+
+		public String getTargetUri() {
+			return targeturi;
+		}
+
+		public void setTargetUri(String targeturi) {
+			this.targeturi = targeturi;
+		}
+
+		public String getTargetType() {
+			return targettype;
+		}
+
+		public void setTargetType(String targettype) {
+			this.targettype = targettype;
+		}
+
+		public String getFeature() {
+			return feature;
+		}
+
+		public void setFeature(String feature) {
+			this.feature = feature;
+		}
+
+		public String getClearContents() {
+			return clearcontents;
+		}
+
+		public void setClearContents(String clearcontents) {
+			this.clearcontents = clearcontents;
+		}
+
+		private String targeturi;
+		private String targettype;
+		private String feature;
+		private String clearcontents;
+	}
+
+	/**
+	 * Throws an exception if the given object is null
+	 */
+	public void checkAttribute(Object attr, String attrName) throws BuildException {
+		if (attr == null) {
+			throw new BuildException(
+					NLS.bind(
+							org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
+							attrName
+							)
+					);
+		}
+	}
+
+	/**
+	 * Checks up parameters validity and calls doExecute()
+	 */
+	@Override
 	public void execute() throws BuildException {
 
-        checkAttribute(myTransformation, TAG_TRANSFORMATION);
-        if (myTargetUris.isEmpty()) {
-            throw new BuildException(
-                    NLS.bind(
-                            org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
-                            TAG_TARGET_URI
-                    )
-            );
-        }
-        
-        final List<TargetUriData> targetUris = new ArrayList<TargetUriData>(myTargetUris.size());
-        for (TargetUriDef targetUriDef : myTargetUris) {
-        	if (targetUriDef.targeturi == null) {
-                throw new BuildException(
-                        NLS.bind(
-                                org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
-                                TAG_TARGET_URI
-                        )
-                );
-        	}
-        	TargetType type = targetUriDef.targettype != null ? TargetType.valueOf(targetUriDef.targettype) : TargetType.NEW_MODEL;
-        	String feature = targetUriDef.feature != null ? targetUriDef.feature : ""; //$NON-NLS-1$
-        	boolean isClear = targetUriDef.clearcontents != null ? Boolean.valueOf(targetUriDef.clearcontents).booleanValue() : false;
-        	targetUris.add(new TargetUriData(type, targetUriDef.targeturi, feature, isClear));
-        }
-        
-        final List<URI> inUris = new ArrayList<URI>();
-        final List<URI> outUris = new ArrayList<URI>();
-        final QvtTransformation transformation = getTransformationObject();
-        try {
-//            ShallowProcess.IRunnable r = new ShallowProcess.IRunnable() {
-//                public void run() throws Exception {
-                	try {	                		                	
-	            		Iterator<TargetUriData> itrTargetData = targetUris.iterator();
-	            		for (TransformationParameter transfParam : transformation.getParameters()) {
-	            			if (!itrTargetData.hasNext()) {
-	            	            throw new BuildException(NLS.bind(org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
-	            	            		transfParam.getName()));
-	            			}
-	            			TargetUriData nextUri = itrTargetData.next();
-	            			if (transfParam.getDirectionKind() == DirectionKind.IN || transfParam.getDirectionKind() == DirectionKind.INOUT) {
-	            		        URI inUri = resolveUri(nextUri.getUriString());
-	            		        inUris.add(inUri);
-	            			}
-	            			if (transfParam.getDirectionKind() == DirectionKind.OUT || transfParam.getDirectionKind() == DirectionKind.INOUT) {
-	            				outUris.add(nextUri.getUri());
-	            			}
-	            		}
-	            		
-	            		List<URI> modelParamUris = new ArrayList<URI>(targetUris.size());
-		                for(TargetUriData uriData : targetUris) {
-		                	modelParamUris.add(uriData.getUri());
-		                }
-	            				
-	            		QvtLaunchUtil.doLaunch(transformation, modelParamUris, EmfUtil.makeUri(getTraceFile()),
-	            				QvtLaunchUtil.createContext(getConfiguration()), isTraceUsed(), false);
-                	}
-                	finally {
-                		transformation.cleanup();
-                	}
-//                }
-//            };
-            
-//            r = QvtLaunchConfigurationDelegateBase.getSafeRunnable(transformation, r);
-            
-//            r.run();
-            
-            if (getProject() != null && getResultUriProperty() != null) {
-            	int index = 1;
-            	for (URI uri : outUris) {
-                    getProject().setProperty(getResultUriProperty() + index, uri == null ? "" : uri.toString()); //$NON-NLS-1$
-            	}
-            }
-        } 
-        catch (Exception e) {
-            e.printStackTrace();
-            throw new BuildException(StatusUtil.getExceptionMessages(e), e);
-        }
+		checkAttribute(myTransformation, TAG_TRANSFORMATION);
+		if (myTargetUris.isEmpty()) {
+			throw new BuildException(
+					NLS.bind(
+							org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
+							TAG_TARGET_URI
+							)
+					);
+		}
 
-        System.out.println(NLS.bind(
-                org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Transformation_has_been_applied,
-                new String[] {
-                        getTransformation(),
-                        inUris.toString(),
-                        outUris.toString()
-                    }
-                )
-        );   
-    }    
-    
-    /**
-     * @return a transformation to be executed
-     */
-    protected abstract QvtTransformation getTransformationObject();
+		final List<TargetUriData> targetUris = new ArrayList<TargetUriData>(myTargetUris.size());
+		for (TargetUriDef targetUriDef : myTargetUris) {
+			if (targetUriDef.targeturi == null) {
+				throw new BuildException(
+						NLS.bind(
+								org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
+								TAG_TARGET_URI
+								)
+						);
+			}
+			TargetType type = targetUriDef.targettype != null ? TargetType.valueOf(targetUriDef.targettype) : TargetType.NEW_MODEL;
+			String feature = targetUriDef.feature != null ? targetUriDef.feature : ""; //$NON-NLS-1$
+			boolean isClear = targetUriDef.clearcontents != null ? Boolean.valueOf(targetUriDef.clearcontents).booleanValue() : false;
+			targetUris.add(new TargetUriData(type, targetUriDef.targeturi, feature, isClear));
+		}
 
-    public boolean isTraceUsed() {
-        return getTraceFile() != null;
-    }
-    
-    public String getTransformation() {
-        return myTransformation;
-    }
-    
-    public void setTransformation(String transformation) {
-        this.myTransformation = transformation;
-    }
-    
-    public String getSourceUri() {
-        return mySourceUri;
-    }
-    
-    public void setSourceUri(String input) {
-        this.mySourceUri = input;
-    }
-    
-    public String getTargetUri() {
-        return myTargetUri;
-    }
-    
-    public void setTargetUri(String output) {
-        this.myTargetUri = output;
-    }
-    
-    public String getFeature() {
-    	return myFeature;
-    }
-    
-    public void setFeature(String feature) {
-    	myFeature = feature;
-    }
-    
-    public String getTargetType() {
-    	return myTargetType;
-    }
-    
-    public void setTargetType(String targetType) {
-    	myTargetType = targetType;
-    }
-    
-    public String getClearContents() {
-    	return myClearContents;
-    }
-    
-    public void setClearContents(String clearContents) {
-    	myClearContents = clearContents;
-    }
-    
-    public String getTraceFile() {
-        return myTraceFile;
-    }
-    
-    public void setTraceFile(String trace) {
-        this.myTraceFile = trace;
-    }
-    
-    public String getResultUriProperty() {
-        return myResultUriProperty;
-    }
-    
-    public void setResultUriProperty(String resultUriProperty) {
-        myResultUriProperty = resultUriProperty;
-    }
-    
-    public ConfigurationProperty createConfigurationProperty() {
-        ConfigurationProperty configurationProperty = new ConfigurationProperty();
-        myConfigurationProperties.add(configurationProperty);
-        return configurationProperty;
-    }
-    
-    public void addConfigurationProperty(ConfigurationProperty configurationProperty) {
-        if (!myConfigurationProperties.contains(configurationProperty)) {
-            myConfigurationProperties.add(configurationProperty);
-        }
-    }
-    
-    public void addConfiguredConfigurationProperty(ConfigurationProperty configurationProperty) {
-        addConfigurationProperty(configurationProperty);
-    }
-    
-    public TargetUriDef createTargetUriDef() {
-    	TargetUriDef targetUriDef = new TargetUriDef();
-        myTargetUris.add(targetUriDef);
-        return targetUriDef;
-    }
-    
-    public void addTargetUriDef(TargetUriDef targetUriDef) {
-        if (!myTargetUris.contains(targetUriDef)) {
-        	myTargetUris.add(targetUriDef);
-        }
-    }
-    
-    public void addConfiguredTargetUriDef(TargetUriDef targetUriDef) {
-        addTargetUriDef(targetUriDef);
-    }
-    
-    protected static IFile resolveFile(String path) throws BuildException {
-        IFile file = WorkspaceUtils.getWorkspaceFile(path);
-        if (file == null) {
-            throw new BuildException(
-                    NLS.bind(
-                            org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_File_not_found, 
-                            path
-                        )
-                    );
-        }
-        return file; 
-    }
-    
-    protected static URI resolveUri(String uriString) throws BuildException {
-        try {
-        	URI uri = URI.createURI(uriString);
-        	if(uri == null) {
-        		throw new BuildException(NLS.bind(org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_File_not_found, uriString));
-        	}
-        	return uri;
-        }
-        catch(Exception e) {
-        	throw new BuildException(e);
-        }
-    }
-    
-    protected Map<String, Object> getConfiguration() {
-        Map<String, Object> props = new HashMap<String, Object>();
-        for (ConfigurationProperty property : myConfigurationProperties) {
-            props.put(property.getName(), property.getValue());
-        }
-        return Collections.unmodifiableMap(props);
-    }
-        
-    private String myTransformation;
-    private String mySourceUri;
-    
-    private String myTargetType;
-    private String myTargetUri;
-    private String myFeature;
-    private String myClearContents;
-    
-    private String myTraceFile;
-    
-    private String myResultUriProperty;
-    
-    private final List<ConfigurationProperty> myConfigurationProperties = new ArrayList<ConfigurationProperty>();
-    private final List<TargetUriDef> myTargetUris = new ArrayList<TargetUriDef>();
+		final List<URI> inUris = new ArrayList<URI>();
+		final List<URI> outUris = new ArrayList<URI>();
+		final QvtTransformation transformation = getTransformationObject();
+		try {
+			Iterator<TargetUriData> itrTargetData = targetUris.iterator();
+			for (TransformationParameter transfParam : transformation.getParameters()) {
+				if (!itrTargetData.hasNext()) {
+					throw new BuildException(NLS.bind(org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Required_attribute_is_not_specified,
+							transfParam.getName()));
+				}
+				TargetUriData nextUri = itrTargetData.next();
+				if (transfParam.getDirectionKind() == DirectionKind.IN || transfParam.getDirectionKind() == DirectionKind.INOUT) {
+					URI inUri = resolveUri(nextUri.getUriString());
+					inUris.add(inUri);
+				}
+				if (transfParam.getDirectionKind() == DirectionKind.OUT || transfParam.getDirectionKind() == DirectionKind.INOUT) {
+					outUris.add(nextUri.getUri());
+				}
+			}
+
+			List<URI> modelParamUris = new ArrayList<URI>(targetUris.size());
+			for(TargetUriData uriData : targetUris) {
+				modelParamUris.add(uriData.getUri());
+			}
+
+			QvtLaunchUtil.doLaunch(transformation, modelParamUris, EmfUtil.makeUri(getTraceFile()),
+					QvtLaunchUtil.createContext(getConfiguration()), isTraceUsed(), false);
+
+
+			if (getProject() != null && getResultUriProperty() != null) {
+				int index = 1;
+				for (URI uri : outUris) {
+					getProject().setProperty(getResultUriProperty() + index, uri == null ? "" : uri.toString()); //$NON-NLS-1$
+				}
+			}
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			throw new BuildException(StatusUtil.getExceptionMessages(e), e);
+		}
+		finally {
+			transformation.cleanup();
+		}
+
+		System.out.println(NLS.bind(
+				org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_Transformation_has_been_applied,
+				new String[] {
+						getTransformation(),
+						inUris.toString(),
+						outUris.toString()
+				}
+				)
+				);
+	}
+
+	/**
+	 * @return a transformation to be executed
+	 */
+	protected abstract QvtTransformation getTransformationObject();
+
+	public boolean isTraceUsed() {
+		return getTraceFile() != null;
+	}
+
+	public String getTransformation() {
+		return myTransformation;
+	}
+
+	public void setTransformation(String transformation) {
+		this.myTransformation = transformation;
+	}
+
+	public String getSourceUri() {
+		return mySourceUri;
+	}
+
+	public void setSourceUri(String input) {
+		this.mySourceUri = input;
+	}
+
+	public String getTargetUri() {
+		return myTargetUri;
+	}
+
+	public void setTargetUri(String output) {
+		this.myTargetUri = output;
+	}
+
+	public String getFeature() {
+		return myFeature;
+	}
+
+	public void setFeature(String feature) {
+		myFeature = feature;
+	}
+
+	public String getTargetType() {
+		return myTargetType;
+	}
+
+	public void setTargetType(String targetType) {
+		myTargetType = targetType;
+	}
+
+	public String getClearContents() {
+		return myClearContents;
+	}
+
+	public void setClearContents(String clearContents) {
+		myClearContents = clearContents;
+	}
+
+	public String getTraceFile() {
+		return myTraceFile;
+	}
+
+	public void setTraceFile(String trace) {
+		this.myTraceFile = trace;
+	}
+
+	public String getResultUriProperty() {
+		return myResultUriProperty;
+	}
+
+	public void setResultUriProperty(String resultUriProperty) {
+		myResultUriProperty = resultUriProperty;
+	}
+
+	public ConfigurationProperty createConfigurationProperty() {
+		ConfigurationProperty configurationProperty = new ConfigurationProperty();
+		myConfigurationProperties.add(configurationProperty);
+		return configurationProperty;
+	}
+
+	public void addConfigurationProperty(ConfigurationProperty configurationProperty) {
+		if (!myConfigurationProperties.contains(configurationProperty)) {
+			myConfigurationProperties.add(configurationProperty);
+		}
+	}
+
+	public void addConfiguredConfigurationProperty(ConfigurationProperty configurationProperty) {
+		addConfigurationProperty(configurationProperty);
+	}
+
+	public TargetUriDef createTargetUriDef() {
+		TargetUriDef targetUriDef = new TargetUriDef();
+		myTargetUris.add(targetUriDef);
+		return targetUriDef;
+	}
+
+	public void addTargetUriDef(TargetUriDef targetUriDef) {
+		if (!myTargetUris.contains(targetUriDef)) {
+			myTargetUris.add(targetUriDef);
+		}
+	}
+
+	public void addConfiguredTargetUriDef(TargetUriDef targetUriDef) {
+		addTargetUriDef(targetUriDef);
+	}
+
+	protected static IFile resolveFile(String path) throws BuildException {
+		IFile file = WorkspaceUtils.getWorkspaceFile(path);
+		if (file == null) {
+			throw new BuildException(
+					NLS.bind(
+							org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_File_not_found,
+							path
+							)
+					);
+		}
+		return file;
+	}
+
+	protected static URI resolveUri(String uriString) throws BuildException {
+		try {
+			URI uri = URI.createURI(uriString);
+			if(uri == null) {
+				throw new BuildException(NLS.bind(org.eclipse.m2m.internal.qvt.oml.runtime.ant.Messages.AbstractApplyTransformationTask_File_not_found, uriString));
+			}
+			return uri;
+		}
+		catch(Exception e) {
+			throw new BuildException(e);
+		}
+	}
+
+	protected Map<String, Object> getConfiguration() {
+		Map<String, Object> props = new HashMap<String, Object>();
+		for (ConfigurationProperty property : myConfigurationProperties) {
+			props.put(property.getName(), property.getValue());
+		}
+		return Collections.unmodifiableMap(props);
+	}
+
+	private String myTransformation;
+	private String mySourceUri;
+
+	private String myTargetType;
+	private String myTargetUri;
+	private String myFeature;
+	private String myClearContents;
+
+	private String myTraceFile;
+
+	private String myResultUriProperty;
+
+	private final List<ConfigurationProperty> myConfigurationProperties = new ArrayList<ConfigurationProperty>();
+	private final List<TargetUriDef> myTargetUris = new ArrayList<TargetUriDef>();
 }
diff --git a/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/QvtoAntTransformationTask.java b/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/QvtoAntTransformationTask.java
index 6cac091..0e909bb 100644
--- a/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/QvtoAntTransformationTask.java
+++ b/plugins/org.eclipse.m2m.qvt.oml.runtime/src_ant/org/eclipse/m2m/internal/qvt/oml/runtime/ant/QvtoAntTransformationTask.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2009, 2018 Borland Software Corporation and others.
+ * Copyright (c) 2009, 2019 Borland Software Corporation and others.
  *
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v2.0
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *     Borland Software Corporation - initial API and implementation
+ *     Christopher Gerking - bug 537609
  *******************************************************************************/
 package org.eclipse.m2m.internal.qvt.oml.runtime.ant;
 
@@ -23,13 +24,11 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.m2m.internal.qvt.oml.common.MdaException;
-import org.eclipse.m2m.internal.qvt.oml.common.launch.ShallowProcess;
 import org.eclipse.m2m.internal.qvt.oml.common.launch.TargetUriData;
 import org.eclipse.m2m.internal.qvt.oml.common.launch.TargetUriData.TargetType;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.StatusUtil;
 import org.eclipse.m2m.internal.qvt.oml.emf.util.WorkspaceUtils;
 import org.eclipse.m2m.internal.qvt.oml.evaluator.QvtRuntimeException;
-import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchConfigurationDelegateBase;
 import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtLaunchUtil;
 import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtValidator;
 import org.eclipse.m2m.internal.qvt.oml.runtime.launch.QvtValidator.ValidationType;
@@ -319,42 +318,29 @@
 		final QvtTransformation transformation = getTransformationObject();
 
 		try {
-//			ShallowProcess.IRunnable r = new ShallowProcess.IRunnable() {
-//				public void run() throws Exception {
-					try {
-						URI traceUri = getTraceUri(QvtoAntTransformationTask.this);
-						boolean useTrace = myTrace == null ? false : myTrace.isGenerate();
-						boolean isIncrementalUpdate = myTrace == null ? false : myTrace.isIncrementalUpdate();
-						List<TargetUriData> allTargetData = new ArrayList<TargetUriData>();
+			URI traceUri = getTraceUri(QvtoAntTransformationTask.this);
+			boolean useTrace = myTrace == null ? false : myTrace.isGenerate();
+			boolean isIncrementalUpdate = myTrace == null ? false : myTrace.isIncrementalUpdate();
+			List<TargetUriData> allTargetData = new ArrayList<TargetUriData>();
 
-						for (ModelParameter p : myModelParameters) {
-							allTargetData.add(p.getTargetUriData(QvtoAntTransformationTask.this));
-						}
+			for (ModelParameter p : myModelParameters) {
+				allTargetData.add(p.getTargetUriData(QvtoAntTransformationTask.this));
+			}
 
-						IStatus status = QvtValidator.validateTransformation(transformation, allTargetData, traceUri == null ? null : traceUri.toString(), useTrace,
-								isIncrementalUpdate, ValidationType.FULL_VALIDATION);
-						if (status.getSeverity() > IStatus.WARNING) {
-							throw new MdaException(status);
-						}
+			IStatus status = QvtValidator.validateTransformation(transformation, allTargetData, traceUri == null ? null : traceUri.toString(), useTrace,
+					isIncrementalUpdate, ValidationType.FULL_VALIDATION);
+			if (status.getSeverity() > IStatus.WARNING) {
+				throw new MdaException(status);
+			}
 
-						List<URI> modelParamUris = new ArrayList<URI>(allTargetData.size());
-						for(TargetUriData uriData : allTargetData) {
-							modelParamUris.add(uriData.getUri());
-						}
+			List<URI> modelParamUris = new ArrayList<URI>(allTargetData.size());
+			for(TargetUriData uriData : allTargetData) {
+				modelParamUris.add(uriData.getUri());
+			}
 
-						ExecutionContext context = QvtLaunchUtil.createContext(getConfiguration(), createQVTLog());
+			ExecutionContext context = QvtLaunchUtil.createContext(getConfiguration(), createQVTLog());
 
-						QvtLaunchUtil.doLaunch(transformation, modelParamUris, traceUri, context, useTrace, isIncrementalUpdate);
-					}
-					finally {
-						transformation.cleanup();
-					}
-//				}
-//
-//			};
-
-//			r = QvtLaunchConfigurationDelegateBase.getSafeRunnable(transformation, r);
-//			r.run();
+			QvtLaunchUtil.doLaunch(transformation, modelParamUris, traceUri, context, useTrace, isIncrementalUpdate);
 		}
 		catch (Exception e) {
 			if(e instanceof RuntimeException && e instanceof QvtRuntimeException == false) {
@@ -363,6 +349,9 @@
 
 			throw new BuildException(StatusUtil.getExceptionMessages(e), e);
 		}
+		finally {
+			transformation.cleanup();
+		}
 
 		log(NLS.bind(Messages.TransformationExecuted, getModuleURI(this)));
 	}