Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358082 - [M2x IDE Integration] Precedence of Xtend MetaModels gets lost in Xtend/Xpand runtime enhancements implemented in Sphinx
Summary: [M2x IDE Integration] Precedence of Xtend MetaModels gets lost in Xtend/Xpand...
Status: CLOSED FIXED
Alias: None
Product: Sphinx
Classification: Automotive
Component: Core (show other bugs)
Version: 0.7.0   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: 0.7.0   Edit
Assignee: Stephan Eberle CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-19 06:09 EDT by Stephan Eberle CLA
Modified: 2021-07-14 02:15 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Eberle CLA 2011-09-19 06:09:30 EDT
= Problem description  =
Before transforming models using Xtend, the required Xtend MetaModels need to be configured for this operation. This configuration is expected to be done via project properties/preferences provided by Xpand for that purpose (right-click on project with Xtend template(s) > Properties > Xtend/Xpand for details). The resulting information is twofold: 
a) '''which''' Xtend MetaModels that are to be used
b) '''the precedence''' of the Xtend MetaModels which becomes vital in cases where multiple of them are applicable to the same model object under transformation
In the Xpand project properties/preferences dialog, the precedence can be adjusted via the Up/Down buttons right to the "Activated metamodel contributors" list. At API level, the precedence is expressed by the position of the Xtend MetaModels in the list returned by org.eclipse.xtend.shared.ui.core.metamodel.MetamodelContributorRegistry#getActiveMetamodelContributors(IJavaProject).

When running Xtend-based model to model transformations using the Xtend/Xpand runtime enhancements provided by Sphinx (BasicM2MAction,  M2MConfigurationWizard and XtendJob), the Xtend MetaModels to be used are directly retrieved from the Xpand project properties/preferences. However, Sphinx stores them in a set rather than a list and hands them around as a collection. Consequently, the precedence information configured in the Xpand project properties/preferences gets lost and the order in which the Xtend MetaModels are invoked for finding the Xtend type for a given model object under transformation is quite arbitrary.

= Proposed resolution =
* Use an ArrayList rather than a HashSet for storing the Xtend MetaModels in BasicM2MAction#getMetaModels()
* Change all methods in BasicM2MAction,  M2MConfigurationWizard and XtendJob supporting multiple Xtend MetaModels to be passed as parameter so that the Xtend MetaModels are passed as list but not as collection
* Change BasicM2TAction, M2TConfigurationWizard, XpandJob and CheckJob correspondingly
Comment 1 Stephan Eberle CLA 2011-09-19 06:32:01 EDT
Fixed as proposed in description.
Comment 2 Stephan Eberle CLA 2011-09-22 13:44:21 EDT
For the same reasons as explained in the description of this bug, the MetamodelContributors passed to the ConvertToXtendXpandEnabledProjectJob must be hold in a list instead of a set.
Comment 3 Stephan Eberle CLA 2011-09-26 06:42:05 EDT
Fixed by incorporating modification proposed in comment #2. 

Additionally, revised implementation of ConvertToXtendXpandEnabledProjectJob (redesigned overriding points and getters/setters, improved of naming, fixed progress monitor issues) and renamed it to ConvertToXtendXpandEnabledPluginProjectJob.
Comment 4 Balazs Grill CLA 2021-07-14 02:15:42 EDT
Mass-closing Resolved tickets