Source:
<code>private void collectContextualVariableDefinitions(Map<String, VariableType> vars, EObject top, EObject bottom) { Map<String, Collection<VariableType>> definitions = Maps.newHashMap(); EObject context = bottom; while (context != null && context != top.eContainer()) { appendAllLocalVariableDefinitions(definitions, context); if (context != bottom) { if (context instanceof ChangeContext) { ChangeContext f = (ChangeContext) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.CHANGE_CONTEXT__BROWSE_EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getBrowseExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); } if (context instanceof For) { For f = (For) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, <START> ToolPackage.Literals.CHANGE_CONTEXT__BROWSE_EXPRESSION); <END> ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); addDefinition(definitions, f.getIteratorName(), returnTypes); } } if (context instanceof CreateInstance) { CreateInstance f = (CreateInstance) context; changeSelfType(definitions, VariableType.fromString(f.getTypeName())); } if (context != top) { EObject sibling = precedingSibling(context); while (sibling != null) { appendAllLocalVariableDefinitions(definitions, sibling); sibling = precedingSibling(sibling); } } context = context.eContainer(); } for (String var : definitions.keySet()) { vars.put(var, ((List<VariableType>) definitions.get(var)).get(0)); } }</code><technical_language>org.eclipse.sirius.viewpoint.description.tool.ToolPackage.FOR__EXPRESSION equals CONTAINER_MODEL_OPERATION_FEATURE_COUNT + 0; FOR specific literlas here</technical_language>

Target:
private void collectContextualVariableDefinitions(Map<String, VariableType> vars, EObject top, EObject bottom) { Map<String, Collection<VariableType>> definitions = Maps.newHashMap(); EObject context = bottom; while (context != null && context != top.eContainer()) { appendAllLocalVariableDefinitions(definitions, context); if (context != bottom) { if (context instanceof ChangeContext) { ChangeContext f = (ChangeContext) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.CHANGE_CONTEXT__BROWSE_EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getBrowseExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); } if (context instanceof For) { For f = (For) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.FOR__EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); addDefinition(definitions, f.getIteratorName(), returnTypes); } } if (context instanceof CreateInstance) { CreateInstance f = (CreateInstance) context; changeSelfType(definitions, VariableType.fromString(f.getTypeName())); } if (context != top) { EObject sibling = precedingSibling(context); while (sibling != null) { appendAllLocalVariableDefinitions(definitions, sibling); sibling = precedingSibling(sibling); } } context = context.eContainer(); } for (String var : definitions.keySet()) { vars.put(var, ((List<VariableType>) definitions.get(var)).get(0)); } }