Dynamically combining Ecore Models [message #146747] |
Thu, 16 August 2007 15:22 |
Gary Leask Messages: 28 Registered: July 2009 |
Junior Member |
|
|
I have 2 ecore models that I need to combine dynamically in a graphical
editor produced by EMF-GMF-GEF
The first ecore model is used to build the graphic element for the diagram.
It provides the palette item and the visual icon on the canvas. I don't
want ot use the compartments and have to drag all the interior elements on
to the canvas. Below is a simple example, the real implementation can add
multiple interior elements.
The first ecore model for this consists of a
<stateElement> -- ecore Eclass
<processElement> - an EReference to and ecore Eclass
<xsdAny> -- an EFeatureMapEntry
The second Ecore Model is used to popualte the xsdAny Element.
It is not known what type of element this will be until it is added to the
canvas. The element may be from different namespaces
<stateElement> -- ecore Eclass
<processElement> - an EReference to and ecore Eclass
<ns1:collect> -- an EClass
<stateElement> -- ecore Eclass
<processElement> - an EReference to and ecore Eclass
<ns2:process> -- an EClass
I have tried to add the second ecore model to the .gmpmap as a child
reference but The containment feature is not owned by the Domain Meta
Model.
If I ignore the error the Diagram Updater is not generated correctly.
I have tried to add the second ecore model element at the part creation
time however the transaction is rolled back if I use the XXXImpl class
when it is created.
If I tried to add it when it is dropped on the canvas using the
XXXEditPart. I get a java.lang.IllegalStateException "Cannot modify
resource set without a write transaction". At this point The
diagramEditingDomain for the EditPart is null so I can't create a
SetCommand.
Where is the best place in the life cycle of the editor or the GMF
generation to create or define the content of my processElement.
I can send you code samples if this will help.
|
|
|
Powered by
FUDForum. Page generated in 0.08924 seconds