Java Code Examples for org.eclipse.emf.ecore.util.EcoreUtil.replace()

The following are Jave code examples for showing how to use replace() of the org.eclipse.emf.ecore.util.EcoreUtil class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: rest-modeling-framework   File: TypeDeclarationResolver.java   Source Code and License Vote up 6 votes
private EObject resolveType(final ParserRuleContext ruleContext, final EObject superType) {
    final EObject resolvedType;

    if (superType.eIsProxy()) {
        resolvedType = null;
    } else {
        resolvedType = create(superType.eClass(), ruleContext);
        EcoreUtil.replace(unresolved, resolvedType);

        final Token nameToken = ruleContext.getStart();
        final String name = nameToken.getText();
        final Scope typeScope = scope.with(resolvedType, TYPE_CONTAINER__TYPES);

        typeScope.with(IDENTIFIABLE_ELEMENT__NAME)
                .setValue(name, nameToken);

        typeScope.with(unresolved.eClass().getEStructuralFeature("type"))
                .setValue(superType, nameToken);
    }

    return resolvedType;
}