Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326537 - ModelUtils.load ignores multi-rooted Ecore resources
Summary: ModelUtils.load ignores multi-rooted Ecore resources
Status: CLOSED WONTFIX
Alias: None
Product: Acceleo
Classification: Modeling
Component: Core (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-29 09:43 EDT by Ed Willink CLA
Modified: 2010-09-29 10:05 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2010-09-29 09:43:14 EDT
The last few lines of ModelUtils.load select the first content of a multi-rooted Ecore resource.

Multi-rooted Ecore resources are valid, and MOFM2T inherently works on a forest since there may be multiple top level template matches. Why should these be constrained to come from the first root?

Surely the return from ModelUtils.load should either be a singleton Resource or a Collection of EObject roots?
Comment 1 Laurent Goubet CLA 2010-09-29 10:05:45 EDT
Ed,

The ModelUtils utility class was designed as such, and though we know full well that more than a single root can exist in a model (as mentionned in the javadoc of each of our ModelUtils#load() methods : <p>This will return the first root of the loaded model, other roots can be accessed via the resource's content.</p>), we return the first root for ease of use.

Most resources will only contain a single root we need to access (Acceleo's mtl files can only contain a single module, UML files often contain a single Model (though they do contain stereortype applications and the such...), etc). We make this assumption so as not to always iterate on every root, which can be extremely costly with UML.

However, if there _are_ actual locations in the code where we should go back up to the resource to check for other roots, then these are bugs. Please raise separate entries for them.