diff --git a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.extensions.sirius/src/org/eclipse/gemoc/executionframework/extensions/sirius/modelloader/DefaultModelLoader.java b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.extensions.sirius/src/org/eclipse/gemoc/executionframework/extensions/sirius/modelloader/DefaultModelLoader.java index ef7f25ce6..11e32762b 100644 --- a/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.extensions.sirius/src/org/eclipse/gemoc/executionframework/extensions/sirius/modelloader/DefaultModelLoader.java +++ b/framework/execution_framework/plugins/org.eclipse.gemoc.executionframework.extensions.sirius/src/org/eclipse/gemoc/executionframework/extensions/sirius/modelloader/DefaultModelLoader.java @@ -165,14 +165,28 @@ private static Resource loadModel(IExecutionContext context, boolean wi try { // Killing + restarting Sirius session for animation killPreviousSiriusSession(context.getRunConfiguration().getAnimatorURI()); - openNewSiriusSession(context, context.getRunConfiguration().getAnimatorURI(), resourceSet, modelURI, + Session session = openNewSiriusSession(context, context.getRunConfiguration().getAnimatorURI(), resourceSet, modelURI, subMonitor,nsURIMapping); - // At this point Sirius has loaded the model, we just need to // find it - for (Resource r : resourceSet.getResources()) { - if (r.getURI().equals(modelURI)) { - return r; + if(session.getTransactionalEditingDomain().getResourceSet() != resourceSet) { + // the session has created a different resourceSet than the one we provided + //we need to use the resource from it instead of the one from our resourceSet + // TODO check if this is still compatible with melange + // TODO maybe some simplification is possible ! + if(useMelange) { + Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Sirius Session returned a new ResourceSet and you are using a melange query, this scenario has not been validated yet", new Exception())); + } + for (Resource r : session.getTransactionalEditingDomain().getResourceSet().getResources()) { + if (r.getURI().equals(modelURI)) { + return r; + } + } + } else { + for (Resource r : resourceSet.getResources()) { + if (r.getURI().equals(modelURI)) { + return r; + } } } } catch (CoreException e) {