Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » 3-level containment, without visualizing second level
3-level containment, without visualizing second level [message #203559] Wed, 27 August 2008 16:51 Go to next message
Iliyana Ivanova is currently offline Iliyana IvanovaFriend
Messages: 2
Registered: July 2009
Junior Member
Hi All,

I'm trying to create a gmfmap model for this case: I want to have three
levels of containment, but without visualizing the middle level... and
there is always only 1 instance of the middle level, belonging to the top
level instance... so I guess the top and middle levels are kinda equal for
gmf...

My simplified class diagram looks like this:
Class X1 contains exactly one Class X2.
Class X2 contains 0..n Class X3_1 and 0..n Class X3_2.
[I'm trying to keep it simple, so if you're wondering why I need the
separation between X1 and X2- I need it because of other details, not
shown here]

I want to have Class X1 as top domain element (i.e. represented by the
whole canvas), which always contains exactly one instance of Class X2 (not
visible, i.e. also represented by the whole canvas, and created together
with the creation of Class X1 instance), and I want to visualize the
instances of classes X3_1 and X3_2 on the diagram (i.e. nodes on the
diagram).

The visualization that I need is the same as when setting class X2 as top
domain element and creating Top Node Reference's for classes X3_1 and
X3_2... but then I'm losing X1, and I definately need it.

Has someone faced the same issue before, and what is the solution?

Kind regards,
Iliyana Ivanova
Re: 3-level containment, without visualizing second level [message #203569 is a reply to message #203559] Wed, 27 August 2008 17:25 Go to previous messageGo to next message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hello Iliyana,

You could setup a dynamic EReference in Class X1 retuning X2's X3_[1|2]
childs. But this would change the metamodel a bit and you have to implement
the returning function in the model code by hand.

Greetings,

Enrico

Iliyana Ivanova wrote:

> Hi All,
>
> I'm trying to create a gmfmap model for this case: I want to have three
> levels of containment, but without visualizing the middle level... and
> there is always only 1 instance of the middle level, belonging to the top
> level instance... so I guess the top and middle levels are kinda equal for
> gmf...
>
> My simplified class diagram looks like this:
> Class X1 contains exactly one Class X2.
> Class X2 contains 0..n Class X3_1 and 0..n Class X3_2.
> [I'm trying to keep it simple, so if you're wondering why I need the
> separation between X1 and X2- I need it because of other details, not
> shown here]
>
> I want to have Class X1 as top domain element (i.e. represented by the
> whole canvas), which always contains exactly one instance of Class X2 (not
> visible, i.e. also represented by the whole canvas, and created together
> with the creation of Class X1 instance), and I want to visualize the
> instances of classes X3_1 and X3_2 on the diagram (i.e. nodes on the
> diagram).
>
> The visualization that I need is the same as when setting class X2 as top
> domain element and creating Top Node Reference's for classes X3_1 and
> X3_2... but then I'm losing X1, and I definately need it.
>
> Has someone faced the same issue before, and what is the solution?
>
> Kind regards,
> Iliyana Ivanova
Re: 3-level containment, without visualizing second level [message #203675 is a reply to message #203559] Thu, 28 August 2008 13:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Stefan.Kuhn.[REMOVE]gentleware.com

hi,

another option would be to override getModelChildren

-stefan

Iliyana Ivanova schrieb:
> Hi All,
>
> I'm trying to create a gmfmap model for this case: I want to have three
> levels of containment, but without visualizing the middle level... and
> there is always only 1 instance of the middle level, belonging to the
> top level instance... so I guess the top and middle levels are kinda
> equal for gmf...
>
> My simplified class diagram looks like this:
> Class X1 contains exactly one Class X2.
> Class X2 contains 0..n Class X3_1 and 0..n Class X3_2.
> [I'm trying to keep it simple, so if you're wondering why I need the
> separation between X1 and X2- I need it because of other details, not
> shown here]
>
> I want to have Class X1 as top domain element (i.e. represented by the
> whole canvas), which always contains exactly one instance of Class X2
> (not visible, i.e. also represented by the whole canvas, and created
> together with the creation of Class X1 instance), and I want to
> visualize the instances of classes X3_1 and X3_2 on the diagram (i.e.
> nodes on the diagram).
>
> The visualization that I need is the same as when setting class X2 as
> top domain element and creating Top Node Reference's for classes X3_1
> and X3_2... but then I'm losing X1, and I definately need it.
>
> Has someone faced the same issue before, and what is the solution?
>
> Kind regards,
> Iliyana Ivanova
>
>
>


--
Stefan Kuhn, Gentleware AG
http://www.gentleware.com
Re: 3-level containment, without visualizing second level [message #203726 is a reply to message #203569] Thu, 28 August 2008 17:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: xxx.xxx.xxx

Hello Enrico,

thanks for the suggestion.. I know only vaguely what dynamic EMF is, and
as far as I understand, you suggest the creation of a reference from X1 to
X3_1.. I try now to specify the containmentFeature of TopNodeReference for
X3_1 in gmfmap properly- the only possibility is the containment X1<>--X2,
as X1-->X3_1 is just a reference. I have tried also using childrenFeature,
but I think this would only work in case X3_1 extends X2, and in my case
X2<>--X3_1.

Kind regards,
Iliyana Ivanova


Enrico Schnepel wrote:

> Hello Iliyana,

> You could setup a dynamic EReference in Class X1 retuning X2's X3_[1|2]
> childs. But this would change the metamodel a bit and you have to implement
> the returning function in the model code by hand.

> Greetings,

> Enrico

> Iliyana Ivanova wrote:

>> Hi All,
>>
>> I'm trying to create a gmfmap model for this case: I want to have three
>> levels of containment, but without visualizing the middle level... and
>> there is always only 1 instance of the middle level, belonging to the top
>> level instance... so I guess the top and middle levels are kinda equal for
>> gmf...
>>
>> My simplified class diagram looks like this:
>> Class X1 contains exactly one Class X2.
>> Class X2 contains 0..n Class X3_1 and 0..n Class X3_2.
>> [I'm trying to keep it simple, so if you're wondering why I need the
>> separation between X1 and X2- I need it because of other details, not
>> shown here]
>>
>> I want to have Class X1 as top domain element (i.e. represented by the
>> whole canvas), which always contains exactly one instance of Class X2 (not
>> visible, i.e. also represented by the whole canvas, and created together
>> with the creation of Class X1 instance), and I want to visualize the
>> instances of classes X3_1 and X3_2 on the diagram (i.e. nodes on the
>> diagram).
>>
>> The visualization that I need is the same as when setting class X2 as top
>> domain element and creating Top Node Reference's for classes X3_1 and
>> X3_2... but then I'm losing X1, and I definately need it.
>>
>> Has someone faced the same issue before, and what is the solution?
>>
>> Kind regards,
>> Iliyana Ivanova
Re: 3-level containment, without visualizing second level [message #203730 is a reply to message #203675] Thu, 28 August 2008 17:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: xxx.xxx.xxx

Hello Stefan,

you mean to override getModelChildren() of the generated Diagram EditPart?
I can do this, if I somehow manage to generate the editor code at all...
The problem I'm facing at the moment is much before the code generation,
while defining the gmfmap model.. I can not properly specify the
containments, explained in the previous post, so the gmfmap model does
not validate at all.

Kind regards,
Iliyana Ivanova



Stefan Kuhn wrote:

> hi,

> another option would be to override getModelChildren

> -stefan

> Iliyana Ivanova schrieb:
>> Hi All,
>>
>> I'm trying to create a gmfmap model for this case: I want to have three
>> levels of containment, but without visualizing the middle level... and
>> there is always only 1 instance of the middle level, belonging to the
>> top level instance... so I guess the top and middle levels are kinda
>> equal for gmf...
>>
>> My simplified class diagram looks like this:
>> Class X1 contains exactly one Class X2.
>> Class X2 contains 0..n Class X3_1 and 0..n Class X3_2.
>> [I'm trying to keep it simple, so if you're wondering why I need the
>> separation between X1 and X2- I need it because of other details, not
>> shown here]
>>
>> I want to have Class X1 as top domain element (i.e. represented by the
>> whole canvas), which always contains exactly one instance of Class X2
>> (not visible, i.e. also represented by the whole canvas, and created
>> together with the creation of Class X1 instance), and I want to
>> visualize the instances of classes X3_1 and X3_2 on the diagram (i.e.
>> nodes on the diagram).
>>
>> The visualization that I need is the same as when setting class X2 as
>> top domain element and creating Top Node Reference's for classes X3_1
>> and X3_2... but then I'm losing X1, and I definately need it.
>>
>> Has someone faced the same issue before, and what is the solution?
>>
>> Kind regards,
>> Iliyana Ivanova
>>
>>
>>
Re: 3-level containment, without visualizing second level [message #203751 is a reply to message #203726] Thu, 28 August 2008 18:01 Go to previous message
Enrico Schnepel is currently offline Enrico SchnepelFriend
Messages: 121
Registered: July 2009
Senior Member
Hello Iliyana

Comments below...

> thanks for the suggestion.. I know only vaguely what dynamic EMF is, ...
Just to clarify the terms... I mean a dynamic (derived) reference and not
the dynamic (reflective) EMF. The latter is used to access models without
having the editor-plugins generated from the metamodel.

> ... and as far as I understand, you suggest the creation of a reference
> from X1 to X3_1.. I try now to specify the containmentFeature of
> TopNodeReference for X3_1 in gmfmap properly- the only possibility is the
> containment X1<>--X2, as X1-->X3_1 is just a reference. I have tried also
> using childrenFeature, but I think this would only work in case X3_1
> extends X2, and in my case X2<>--X3_1.
when using the children feature I think GMF would struggle as there isn't a
containment reference defined. What if you mark the derived reference as
containment?

from
http://help.eclipse.org/help33/topic/org.eclipse.emf.doc/ref erences/javadoc/org/eclipse/emf/ecore/EStructuralFeature.htm l#isDerived()
>>>
A derived feature typically computes its value from those of other features.
It will typically be transient and will often be volatile and not
changeable. The default copier won't copy it.
<<<

I think your reference should be changeable. Your implementation for the
getter/setter method should be aware that the EMF notifications should be
fired as it is done for the original reference.

Greetings

Enrico

>
> Kind regards,
> Iliyana Ivanova
>
>
> Enrico Schnepel wrote:
>
>> Hello Iliyana,
>
>> You could setup a dynamic EReference in Class X1 retuning X2's X3_[1|2]
>> childs. But this would change the metamodel a bit and you have to
>> implement the returning function in the model code by hand.
>
>> Greetings,
>
>> Enrico
>
>> Iliyana Ivanova wrote:
>
>>> Hi All,
>>>
>>> I'm trying to create a gmfmap model for this case: I want to have three
>>> levels of containment, but without visualizing the middle level... and
>>> there is always only 1 instance of the middle level, belonging to the
>>> top level instance... so I guess the top and middle levels are kinda
>>> equal for gmf...
>>>
>>> My simplified class diagram looks like this:
>>> Class X1 contains exactly one Class X2.
>>> Class X2 contains 0..n Class X3_1 and 0..n Class X3_2.
>>> [I'm trying to keep it simple, so if you're wondering why I need the
>>> separation between X1 and X2- I need it because of other details, not
>>> shown here]
>>>
>>> I want to have Class X1 as top domain element (i.e. represented by the
>>> whole canvas), which always contains exactly one instance of Class X2
>>> (not visible, i.e. also represented by the whole canvas, and created
>>> together with the creation of Class X1 instance), and I want to
>>> visualize the instances of classes X3_1 and X3_2 on the diagram (i.e.
>>> nodes on the diagram).
>>>
>>> The visualization that I need is the same as when setting class X2 as
>>> top domain element and creating Top Node Reference's for classes X3_1
>>> and X3_2... but then I'm losing X1, and I definately need it.
>>>
>>> Has someone faced the same issue before, and what is the solution?
>>>
>>> Kind regards,
>>> Iliyana Ivanova
Previous Topic:Bug 172003
Next Topic:ocl link constraint
Goto Forum:
  


Current Time: Fri Apr 26 12:22:13 GMT 2024

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

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

Back to the top