Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » containments an references
containments an references [message #108595] Fri, 02 March 2007 10:51 Go to next message
Eclipse UserFriend
Originally posted by: pramsohl.in.tum.de

Hello,

I've got a metamodel to visualize in GMF with two DiagramEditors.

In the first editor i can model "functions" on my canvas together with
other elements. This works fine. Every function is owned by the
metamodel element "car".

In the second editor the user can draw "components" (also children of
car). These components have to contain functions generated by the first
editor (only visually).
- When i specify the component-function relation as containment feature
all the component-functions disappear on the first editor because they
are no longer contained by the object car.
- When i specify the component-function relation as reference i can
generate a mapping with child reference=reference and containment
feature=car. Only with the deprecated "Create generator model" function
i can generate the diagram editor and bypass the warning of gmfmap.
The editor shows up the elements the first time. But deleting deletes
the whole functions and not only the references, and adding doesn't work
properly.

i think the two solutions are:
1) if i use a containment: i have to display not only the car-functions
but also the component-functions on editor1 (maybe with
getModelChildren()????)
2) with reference relation: I have to modify code ind editor2 to support
my behaviour and to refresh the components. I am also happy if i have to
modify the referenced Functions in the properties-view and the diagram
refreshes, but now it refreshes only by adding elements - not by
removing. But maybe this deprecated generation of gmfgen is no longer
avaylabe in the next releases.

How would you solve this Problem. And which of my two proposals is
easier to implement?
Sorry for the long explication.

thank you
Thomas
Re: containments an references [message #108666 is a reply to message #108595] Sat, 03 March 2007 09:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Hi Thomas,

it is possible to define your component-function relation as
containment. For the first editor you can define this containment
reference as the target feature in the link mapping.

Unfortunately, generated code doesn't support this scenario out of the
box. There are serveral modifications to do.

xxxCanonicalEditPolicy is one class to edit.

It's method "getSemanticChildrenList()" iterates through all model
children. Which are your "components". You have to take care, that it
iterates through the component's functions as well.

In addition, "storeFeatureModelFacetLinks()" has to be modified in order
to consider the containment references to the nested function elements.

There are some other things to do. But I don't know exactly right now.

Best regards
Jan

Thomas schrieb:
> Hello,
>
> I've got a metamodel to visualize in GMF with two DiagramEditors.
>
> In the first editor i can model "functions" on my canvas together with
> other elements. This works fine. Every function is owned by the
> metamodel element "car".
>
> In the second editor the user can draw "components" (also children of
> car). These components have to contain functions generated by the first
> editor (only visually).
> - When i specify the component-function relation as containment feature
> all the component-functions disappear on the first editor because they
> are no longer contained by the object car.
> - When i specify the component-function relation as reference i can
> generate a mapping with child reference=reference and containment
> feature=car. Only with the deprecated "Create generator model" function
> i can generate the diagram editor and bypass the warning of gmfmap.
> The editor shows up the elements the first time. But deleting deletes
> the whole functions and not only the references, and adding doesn't work
> properly.
>
> i think the two solutions are:
> 1) if i use a containment: i have to display not only the car-functions
> but also the component-functions on editor1 (maybe with
> getModelChildren()????)
> 2) with reference relation: I have to modify code ind editor2 to support
> my behaviour and to refresh the components. I am also happy if i have to
> modify the referenced Functions in the properties-view and the diagram
> refreshes, but now it refreshes only by adding elements - not by
> removing. But maybe this deprecated generation of gmfgen is no longer
> avaylabe in the next releases.
>
> How would you solve this Problem. And which of my two proposals is
> easier to implement?
> Sorry for the long explication.
>
> thank you
> Thomas
Re: containments an references [message #108830 is a reply to message #108666] Mon, 05 March 2007 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: pramsohl.in.tum.de

Hello Jan,

Thank you for your answer - i will try your approach.
Let me see if i understnd it...
I've got two containment references in my ecore model.
The Functions are either contained by Car or by Components.
In the Function-Editor i modify getSemanticChildrenList() to retrieve
Component-Functions as well.
But why do i need this link mapping in my FunctionEditor with only a
target feature?

thanks,
Thomas





Jan Herriger wrote:
> Hi Thomas,
>
> it is possible to define your component-function relation as
> containment. For the first editor you can define this containment
> reference as the target feature in the link mapping.
>
> Unfortunately, generated code doesn't support this scenario out of the
> box. There are serveral modifications to do.
>
> xxxCanonicalEditPolicy is one class to edit.
>
> It's method "getSemanticChildrenList()" iterates through all model
> children. Which are your "components". You have to take care, that it
> iterates through the component's functions as well.
>
> In addition, "storeFeatureModelFacetLinks()" has to be modified in order
> to consider the containment references to the nested function elements.
>
> There are some other things to do. But I don't know exactly right now.
>
> Best regards
> Jan
>
Re: containments an references [message #109215 is a reply to message #108830] Tue, 06 March 2007 07:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jan.herriger.gmx.de

Hello Thomas,

the link mapping is for drawing connections between components and
functions. By adding a Function into the first editor, it will become a
child of "Car". Afterwards, you can draw a connection from a Component
to a Function. So it will become a child of that Component. EMF handles
this for you.

The editing of the canoncial policy ensures that views for these
connections and nodes are added, if the model was modified externaly.
For example by the second editor.

Thomas schrieb:
> Hello Jan,
>
> Thank you for your answer - i will try your approach.
> Let me see if i understnd it...
> I've got two containment references in my ecore model.
> The Functions are either contained by Car or by Components.
> In the Function-Editor i modify getSemanticChildrenList() to retrieve
> Component-Functions as well.
> But why do i need this link mapping in my FunctionEditor with only a
> target feature?
>
> thanks,
> Thomas
>
>
>
>
>
> Jan Herriger wrote:
>> Hi Thomas,
>>
>> it is possible to define your component-function relation as
>> containment. For the first editor you can define this containment
>> reference as the target feature in the link mapping.
>>
>> Unfortunately, generated code doesn't support this scenario out of the
>> box. There are serveral modifications to do.
>>
>> xxxCanonicalEditPolicy is one class to edit.
>>
>> It's method "getSemanticChildrenList()" iterates through all model
>> children. Which are your "components". You have to take care, that it
>> iterates through the component's functions as well.
>>
>> In addition, "storeFeatureModelFacetLinks()" has to be modified in
>> order to consider the containment references to the nested function
>> elements.
>>
>> There are some other things to do. But I don't know exactly right now.
>>
>> Best regards
>> Jan
>>
>
Re: containments an references [message #112619 is a reply to message #109215] Sat, 17 March 2007 09:28 Go to previous message
Eclipse UserFriend
Originally posted by: pramsohl.in.tum.de

Hi Jan,

Now i got it.
I modified the canonical policy and it works, thanks.
I don't have to model Compnents on this Diagram - only to display all
the functions of the model.
Is there some GMF or EMF Method to obtain all Elements of a specific
model class? Do i have to iterate through resourceset.allcontents or is
there a simpler way?

Thank you.
Thomas


Jan Herriger wrote:
> Hello Thomas,
>
> the link mapping is for drawing connections between components and
> functions. By adding a Function into the first editor, it will become a
> child of "Car". Afterwards, you can draw a connection from a Component
> to a Function. So it will become a child of that Component. EMF handles
> this for you.
>
> The editing of the canoncial policy ensures that views for these
> connections and nodes are added, if the model was modified externaly.
> For example by the second editor.
>
> Thomas schrieb:
>> Hello Jan,
>>
>> Thank you for your answer - i will try your approach.
>> Let me see if i understnd it...
>> I've got two containment references in my ecore model.
>> The Functions are either contained by Car or by Components.
>> In the Function-Editor i modify getSemanticChildrenList() to retrieve
>> Component-Functions as well.
>> But why do i need this link mapping in my FunctionEditor with only a
>> target feature?
>>
>> thanks,
>> Thomas
>>
>>
>>
>>
>>
>> Jan Herriger wrote:
>>> Hi Thomas,
>>>
>>> it is possible to define your component-function relation as
>>> containment. For the first editor you can define this containment
>>> reference as the target feature in the link mapping.
>>>
>>> Unfortunately, generated code doesn't support this scenario out of
>>> the box. There are serveral modifications to do.
>>>
>>> xxxCanonicalEditPolicy is one class to edit.
>>>
>>> It's method "getSemanticChildrenList()" iterates through all model
>>> children. Which are your "components". You have to take care, that it
>>> iterates through the component's functions as well.
>>>
>>> In addition, "storeFeatureModelFacetLinks()" has to be modified in
>>> order to consider the containment references to the nested function
>>> elements.
>>>
>>> There are some other things to do. But I don't know exactly right now.
>>>
>>> Best regards
>>> Jan
>>>
>>
Previous Topic:question about gmfmap link mapping
Next Topic:editing multiple model files on the same diagram
Goto Forum:
  


Current Time: Sat May 10 08:49:16 EDT 2025

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

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

Back to the top