Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Displaying Model Elements of "foreign" models
Displaying Model Elements of "foreign" models [message #184423] Sun, 27 April 2008 11:36 Go to next message
Eclipse UserFriend
Originally posted by: rwoerz.i3.informatik.rwth-aachen.de

As far as I've learned a CANVAS MAPPING (in gmfmap) is mandatory for every
GMF diagram definition. Within a CANVAS MAPPING you have to set a meta
model element <<R>>, which is typically the root of a containment
hierarchy. Instances of those meta model elements, which are part of this
containment hierarchy (i.e., descendants of <<R>>), can be displayed and
edited in the respective “RDiagram”.

Suppose we have a meta model element <<AModel>> that has a meta
containment reference to a meta model element <<A>>. If you set DOMAIN
ELEMENT in a CANVAS MAPPING to <<AModel>>, then you can eventually display
and create model elements (instances) of type <<A>> in your “ADiagram”.
Further suppose we have a meta model element <<BModel>> with a meta
containment reference to a meta model element <<B>>. Furthermore, <<B>>
has a meta reference to <<A>>. Analogously, there is a CANVAS MAPPING with
DOMAIN ELEMENT set to <<BModel>>.

Now my question:

Is it possible to display ANodes within a BDiagram although A-elements are
not contained in the respective BModel-element?

This would be useful in order to visually reflect a reference of some
B-element to some A-element in the BDiagram. Just displaying existing
A-elements in BDiagrams would suffice for me, i.e., I do not want to
_create_ A-elements in BDiagrams.
Re: Displaying Model Elements of "foreign" models [message #184431 is a reply to message #184423] Sun, 27 April 2008 12:34 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello René W.,

> Is it possible to display ANodes within a BDiagram although A-elements
> are not contained in the respective BModel-element?
Yes. You have to allow ADiagram elements to be "shortcutted" from BDiagram
and regenerate both diagram editors. As a result you'll be able to add a
shortcut to the element from ADiagram onto BDiagram - this will be a normal
ANode, so you'll be able to draw a link to it.

-----------------
Alex Shatalin
Re: Displaying Model Elements of "foreign" models [message #184439 is a reply to message #184431] Sun, 27 April 2008 20:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rwoerz.i3.informatik.rwth-aachen.de

> Yes. You have to allow ADiagram elements to be "shortcutted" from
> BDiagram and regenerate both diagram editors. As a result you'll be able
> to add a shortcut to the element from ADiagram onto BDiagram - this will
> be a normal ANode, so you'll be able to draw a link to it.

Thanks for the hint. Now A-shortcuts can be displayed in B-Diagrams.
Now I'm stuck in creating connections from B-Nodes to A-shortcuts. The
diagram editor prohibits these links. Other types of connections from
B-Nodes to B-shortcuts work well.

Are there any restrictions concerning connections from or to shortcuts?
Re: Displaying Model Elements of "foreign" models [message #184492 is a reply to message #184439] Mon, 28 April 2008 09:27 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello René W.,

> Are there any restrictions concerning connections from or to
> shortcuts?
Well, this can be a problem - looks like you have to define link on a diagram
containing both A and B nodes.. ;-(
I suggest you to first modify generated code by hands and then we can think
about more generic solution for this situation. I think you have to:
- Define link mapping for B -> A link on diagram B
- modify generated A/BSemanticItemEditPolicies -> getStartCreateRelationshipCommand/getCompleteCreateRelations hipCommand
methods. To return B->ACreateCommand instance in appropriate place (it's
better to generate code for some link from B to B first and use it as an
example).

-----------------
Alex Shatalin
Re: Displaying Model Elements of "foreign" models [message #184603 is a reply to message #184492] Mon, 28 April 2008 19:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rwoerz.i3.informatik.rwth-aachen.de

> - Define link mapping for B -> A link on diagram B

I did so but the gmfgen-Generator seems to completely ignore this link
mapping. Consequently, there are no corresponding command classes for
creation and reorientation generated into bdiagram.edit.commands.
Re: Displaying Model Elements of "foreign" models [message #184666 is a reply to message #184603] Tue, 29 April 2008 10:47 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello René W.,

Do you have corresponding GenLink created in .gmfgen model file? AFAI can
see from the code GenLink should be always created for each LinkMapping (DiagramGenModelTransformer.process(LinkMapping
lme)) and corresponding CreationCommand class generated (Generator.customRun()
-> myDiagram.getLinks() processing).

So, I suggest you to debug corresponding GMF code, but first check if corresponding
GenLink instance was created by .gmfmap -> .gmfgen transformation.

-----------------
Alex Shatalin
Previous Topic:SVG problem
Next Topic:How to reorder compartments?
Goto Forum:
  


Current Time: Thu Sep 19 16:52:32 GMT 2024

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

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

Back to the top