Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Re: Combining Ecore Models
Re: Combining Ecore Models [message #147016] Fri, 17 August 2007 08:52 Go to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Gary,

You're question seems to be purely a GMF one so I've added the GMF
newgroup to the "to" list of the reply since it's best to ask GMF
question on that specific newsgroup.


Gary Leask wrote:
> 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.
>
>
Re: Combining Ecore Models [message #147052 is a reply to message #147016] Mon, 20 August 2007 04:20 Go to previous message
Eclipse UserFriend
Hello Gary,

If you can enumerate all the possible "xsdAny" elements on model definition
time then I suggest you to modify your model and introduce abstract super-class
for such elements - "AbstractXsdAny" + containment link from diagram element
to this abstract class. All the elements of the second model will be inherited
from this one. As a result valid containment reference will be represented
in the model for each child element.

Another option is ignoring validation errors, generating the code and then
modifying it.

-----------------
Alex Shatalin
Previous Topic:Create Connection in a command
Next Topic:Popup Model Assistant
Goto Forum:
  


Current Time: Thu May 08 04:02:48 EDT 2025

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

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

Back to the top