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

The following are Jave code examples for showing how to use getAllProperContents() 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.
+ Save this method
Example 1
Project: n4js   File: GlobalObjectScope.java   View Source Code Vote up 6 votes
@Override
protected void buildMap(Resource resource, Map<QualifiedName, IEObjectDescription> elements) {
	IDefaultResourceDescriptionStrategy strategy = ((XtextResource) resource).getResourceServiceProvider()
			.get(IDefaultResourceDescriptionStrategy.class);
	TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(resource, false);
	IAcceptor<IEObjectDescription> acceptor = new IAcceptor<IEObjectDescription>() {
		@Override
		public void accept(IEObjectDescription description) {
			elements.put(description.getQualifiedName(), description);
		}
	};
	while (allProperContents.hasNext()) {
		EObject content = allProperContents.next();
		if (!strategy.createEObjectDescriptions(content, acceptor)) {
			allProperContents.prune();
		}
	}
}
 
Example 2
Project: rest-modeling-framework   File: RamlModelBuilder.java   View Source Code Vote up 5 votes
private void merge(final ApiExtension apiExtension, final Api api) {
    final TreeIterator<EObject> allProperContents = EcoreUtil.getAllProperContents(api, false);
    final Map<String, EObject> idToEObject = new HashMap<>();
    while (allProperContents.hasNext()) {
        final EObject eObject = allProperContents.next();
        final String uriFragment = uriFragmentBuilder.getURIFragment(eObject);
        idToEObject.put(uriFragment, eObject);
    }
    merge(apiExtension, api, idToEObject);
}