Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » [EMF: Answered] How can I create references instead of copies of existing model objects?
[EMF: Answered] How can I create references instead of copies of existing model objects? [message #638344] Wed, 10 November 2010 22:12
Glenview Jeff is currently offline Glenview JeffFriend
Messages: 79
Registered: September 2010
0 down vote favorite

I'm new to MDSD/EMF but am making great progress thanks to Eclipse's support.

I created a toy model as answered yesterday as awynne suggested, and I'm very close. I'm only using EMF and its generated tree editor.

Here's a summary of my EMF meta-model:

- EClass: Widget
- name

- EClass: WidgetReference
- aWidgetReference : Widget [0..1] Containment = false

- EClass: WidgetContainer
- myWidgets : Widget [0..*] Containment = true

- EClass: ReferenceContainer
- myReferences : WidgetReference [0..*] Containment = true

- EClass: TopLevelClass
- myWidgetContainer : [1] WidgetContainer Containment = true
- myReferenceContainer : [1] ReferenceContainer Containment = true

What's happening now is that in the generated tree editor for the model, I create everything starting from the TopLevelClass. I can successfully create multiple widgets in the WidgetContainer, and I can create a single WidgetReference in the ReferenceContainer and associate it with a specific Widget.

In case anyone runs into this, there is a bug in the generated EMF editor code:

When I try to add more than one WidgetReference to the ReferenceContainer, the tree editor only shows the first WidgetReference under the ReferenceContainer. If I click on the WidgetReferences item in the tree, it does show multiple WidgetReferences in the properties view. It just won't let me see them in the tree, and therefore won't let me select them to change their reference to associate it to an actual widget.

The workaround to this is to create as many references as you need, save and close the model, and then re-open it. Upon re-opening it, all of the references will be shown.

Thanks for any help/guidance.


[Updated on: Fri, 12 November 2010 21:21]

Report message to a moderator

Previous Topic:[BPMN2] EventDefinitionsRef
Next Topic:[Xpand] Incremental generation does not work as expected
Goto Forum:

Current Time: Sat Jul 20 13:03:54 GMT 2024

Powered by FUDForum. Page generated in 0.03410 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top