package tools.vitruv.framework.util.command;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.eclipse.emf.ecore.EObject;

import tools.vitruv.framework.util.datatypes.Pair;
import tools.vitruv.framework.util.datatypes.VURI;

public class TransformationResult {

    private final Set<VURI> vurisToDelete;
    private final List<Pair<EObject, VURI>> rootEObjectsToSave;

    public TransformationResult() {
        this.vurisToDelete = new HashSet<VURI>();
        this.rootEObjectsToSave = new ArrayList<Pair<EObject, VURI>>();
    }

    public Set<VURI> getVUIRsToDelete() {
        return this.vurisToDelete;
    }

    public void addVURIToDeleteIfNotNull(final VURI... vuriToDelete) {
        if (null != vuriToDelete) {
            for (VURI vuri : vuriToDelete) {
                if (null != vuri) {
                    this.vurisToDelete.addAll(Arrays.asList(vuri));
                }
            }
        }
    }

    public List<Pair<EObject, VURI>> getRootEObjectsToSave() {
        return this.rootEObjectsToSave;
    }

    public void addRootEObjectToSave(final EObject eObject, final VURI vuri) {
        this.rootEObjectsToSave.add(new Pair<EObject, VURI>(eObject, vuri));
    }
    
    public void integrateTransformationResult(TransformationResult transformationResult) {
    	this.vurisToDelete.addAll(transformationResult.vurisToDelete);
    	this.rootEObjectsToSave.addAll(transformationResult.rootEObjectsToSave);
    }
}

@@ -1415,24 +1415,89 @@
 nResult) %7B%0D%0A
+    %09if (transformationResult == null) %7B%0D%0A    %09%09return;%0D%0A    %09%7D%0D%0A
     %09this.vu

Add a null check in TransformationResult integration.