Source:
public EvaluationResult call() throws Exception { checkCancelled(); final String expression = context.getExpression(); if (context.getTargetEObjects().isEmpty()) { IStatus errorStatus = new Status(IStatus.ERROR, InterpreterViewPlugin.PLUGIN_ID, MessageFormat.format(Messages.SiriusEvaluationTask_status_noEvaluationTarget, expression)); return new EvaluationResult(errorStatus); } final EObject target = context.getTargetEObjects().get(0); EObject semanticTarget = target; if (target instanceof DSemanticDecorator) { semanticTarget = ((DSemanticDecorator) target).getTarget(); } Session curSession = SessionManager.INSTANCE.getSession(semanticTarget); final IInterpreter vpInterpreter; if (curSession != null) { vpInterpreter = curSession.getInterpreter(); } else { vpInterpreter = CompoundInterpreter.INSTANCE.getInterpreterForExpression(expression); } assert vpInterpreter != null; checkCancelled(); Collection<MetamodelDescriptor> mmDescriptors = Sets.newLinkedHashSet(); for (EObject targetEObject : context.getTargetEObjects()) { EPackage ePackage = targetEObject.eClass().getEPackage(); if (ePackage != null) { mmDescriptors.add(new EcoreMetamodelDescriptor(ePackage)); } } vpInterpreter.activateMetamodels(mmDescriptors); for (Variable var : context.getVariables()) { vpInterpreter.setVariable(var.getName(), var.getValue()); } EvaluationResult evaluationResult = null; try { if (vpInterpreter instanceof IInterpreterWithDiagnostic) { IEvaluationResult result = ((IInterpreterWithDiagnostic) vpInterpreter).evaluateExpression(target, expression); final IStatus status = createResultStatus(result); evaluationResult = new EvaluationResult(result.getValue(), status); } else { Object result = vpInterpreter.evaluate(target, expression); final IStatus status = createResultStatus(result); evaluationResult = new EvaluationResult(result, status); } } catch (EvaluationException e) { final IStatus status = new Status(IStatus.ERROR, InterpreterViewPlugin.PLUGIN_ID, e.getMessage(), e); evaluationResult = new EvaluationResult(status); } assert evaluationResult != null; return evaluationResult; }

Target:
public EvaluationResult call() throws Exception { checkCancelled(); final String expression = context.getExpression(); if (context.getTargetEObjects().isEmpty()) { IStatus errorStatus = new Status(IStatus.ERROR, InterpreterViewPlugin.PLUGIN_ID, MessageFormat.format(Messages.SiriusEvaluationTask_status_noEvaluationTarget, expression)); return new EvaluationResult(errorStatus); } final EObject target = context.getTargetEObjects().get(0); EObject semanticTarget = target; if (target instanceof DSemanticDecorator) { semanticTarget = ((DSemanticDecorator) target).getTarget(); } Session curSession = SessionManager.INSTANCE.getSession(semanticTarget); final IInterpreter vpInterpreter; if (curSession != null) { vpInterpreter = curSession.getInterpreter(); } else { vpInterpreter = CompoundInterpreter.INSTANCE.getInterpreterForExpression(expression); Collection<MetamodelDescriptor> mmDescriptors = Sets.newLinkedHashSet(); for (EObject targetEObject : context.getTargetEObjects()) { EPackage ePackage = targetEObject.eClass().getEPackage(); if (ePackage != null) { mmDescriptors.add(new EcoreMetamodelDescriptor(ePackage)); } } vpInterpreter.activateMetamodels(mmDescriptors); for (Variable var : context.getVariables()) { vpInterpreter.setVariable(var.getName(), var.getValue()); } } assert vpInterpreter != null; checkCancelled(); EvaluationResult evaluationResult = null; try { if (vpInterpreter instanceof IInterpreterWithDiagnostic) { IEvaluationResult result = ((IInterpreterWithDiagnostic) vpInterpreter).evaluateExpression(target, expression); final IStatus status = createResultStatus(result); evaluationResult = new EvaluationResult(result.getValue(), status); } else { Object result = vpInterpreter.evaluate(target, expression); final IStatus status = createResultStatus(result); evaluationResult = new EvaluationResult(result, status); } } catch (EvaluationException e) { final IStatus status = new Status(IStatus.ERROR, InterpreterViewPlugin.PLUGIN_ID, e.getMessage(), e); evaluationResult = new EvaluationResult(status); } assert evaluationResult != null; return evaluationResult; }