Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » A shortcut behaving as a node extension
A shortcut behaving as a node extension [message #151870] Thu, 20 September 2007 12:51 Go to next message
Eclipse UserFriend
Originally posted by: fabrice.willay.thomson.net

Dear all,

I need a specific behavior at the GMF level but I don't know how to get it:

Say you create two graphs G1 and G2 with a GMF Editor built from the same
model.
In G1, you have a node N1 with some children.
In G2 you have a node N2 that you would like to be a reference to N1. So
far, it is exactly as the GMF Shortcut functionality. However, adding a
child to N2, I would like N1 to remain unchanged but the modification
being held by N2 only.
So that N2 = (N1 + modifications).

To summarize, I would like a shortcut that behaves as a node overload
instead as a pointer to the node.

Can you please advise me on how to get this?

Thank you,

Fabrice
Re: A shortcut behaving as a node extension [message #151917 is a reply to message #151870] Fri, 21 September 2007 05:55 Go to previous messageGo to next message
Eclipse UserFriend
Hi Fabrice,

When a child is added to N2, the underlying element for the child is
added to the shared underlying parent element. Furthermore, a notational
node is added to N2. The corresponding notational node will be added to
N1 by canonical update if the diagram for the N1 is synchronized. Note
that even if the diagram is synchronized, you should be able to switch
it off by adding a canonical style to N1 and forcing it not to be
canonical using CanonicalStyle_Canonical feature.

Best regards,
Boris


Wailly wrote:
> Dear all,
>
> I need a specific behavior at the GMF level but I don't know how to get it:
>
> Say you create two graphs G1 and G2 with a GMF Editor built from the
> same model.
> In G1, you have a node N1 with some children.
> In G2 you have a node N2 that you would like to be a reference to N1. So
> far, it is exactly as the GMF Shortcut functionality. However, adding a
> child to N2, I would like N1 to remain unchanged but the modification
> being held by N2 only.
> So that N2 = (N1 + modifications).
>
> To summarize, I would like a shortcut that behaves as a node overload
> instead as a pointer to the node.
>
> Can you please advise me on how to get this?
>
> Thank you,
>
> Fabrice
>
>
>
Re: A shortcut behaving as a node extension [message #152131 is a reply to message #151917] Tue, 25 September 2007 07:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fabrice.willay.thomson.net

Hi Boris,

Thank you for your answer.

If I understand well your proposition, the idea would be to disable the
canonical update at the referenced Node level. Effectively, it seems that
this would help for one part of my needs (= not reporting the
modifications to the semantic model of N1).

However, in addition, I would like the modifications brought to N2 being
retained into the semantic model of N2 (not only at the notational level
as it seems to be the case today with shortcuts).

Trying to be clear, I would like
- the semantic and the notational models of N1 remaining unchanged (your
proposition)
- the semantic model of N2 showing a reference to N1 and containing the
modifications brought on N2
- the notation model of N2 representing the addition of the semantic
models of N1 and N2

Is this featured in GMF?
Or should I implement this by myself? What is the best way then?

Best Regards,

Fabrice
Re: A shortcut behaving as a node extension [message #152135 is a reply to message #152131] Tue, 25 September 2007 09:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Fabrice,


> Trying to be clear, I would like - the semantic and the notational
> models of N1 remaining unchanged (your proposition)
> - the semantic model of N2 showing a reference to N1 and containing the
> modifications brought on N2
> - the notation model of N2 representing the addition of the semantic
> models of N1 and N2
>

We may be talking about different things here, but I cannot understand
how N2 may be "a reference to N1" (from which I deduce that their
semantic models are *the same*), and at the same time modifications to
the semantic model of N2 is different than that of N1. You can't have
them same and different at the same time...

Best regards,
Boris
Re: A shortcut behaving as a node extension [message #152151 is a reply to message #152135] Tue, 25 September 2007 11:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fabrice.willay.thomson.net

Hi Boris,

In fact, my purpose is to consider N1 and N2 as 2 classes, with N2
inheriting from N1. That is why they are identical when created, but
become different when you start modifying N2.
But maybe it is not compatible with what exists today in GMF...

For a better understanding, here is an instantiated example of my needs:


Model instance of N1 (classic)
====================
<node name="N1">
<node name="N1.1"/>
<node name="Nx" attribute="111"/>
</node>

Model instance of N2 (the trick)
====================
<node name="N2" isInstanceOf="N1">
<node name="N2.1"/>
<node name="Nx" attribute="222"/>
</node>


Notation instance of N1 (classic)
=======================
+ N1
|--N1.1
|--Nx (attribute 111)

Notation instance of N2
=======================
+ N2
|--N1.1
|--N2.1
|--Nx (attribute 222)


Any modification with GMF editor on N1 is reported to N1's model and N1's
notation and also to N2's notation (no need to report it to N2's model as
the reference from N2 to N1 does it implicitly).
Any modification with GMF editor on N2 is reported to N2's model and N2's
notation.

It is pure inheritance between instances at the model level so there is no
need to duplicate information from N1 into N2.
The notation level resolves this inheritance by creating an instance which
is the addition of N1 and N2.

I hope you understand the need, and just would like to know if such a
mechanism is available on GMF.
If not, what would be your advice to implement that?

Thanks a lot,

Fabrice
Re: A shortcut behaving as a node extension [message #152163 is a reply to message #152151] Tue, 25 September 2007 12:19 Go to previous messageGo to next message
Eclipse UserFriend
Hi Fabrice,

The most straightforward way is to define two different node mappings,
one for a node without references to another node (the "base" node) and
the other for a node which has such a reference (use
MappingEntry#domainSpecialization and likely
MappingEntry#domainInitializer to create several entries that reference
the same underlying domain metaclass).
The tricky part is to define N2's compartment to reference N1's
children. Unfortunately, this can't be done in a declarative way using
gmfmap or gmfgen at the moment (AFAIK, there are plans to address this
issue in the upcoming release). However, this may be done by manual
fine-tuning of the generated code (or templates).
I believe, the places for modification are as follows:
1. XYZCreateCommand and XYZCompartmentItemSemanticEditPolicy -- to
create child nodes in correct place;
2. XYZDiagramUpdater -- to return correct semantic children by
navigating additional reference;
3. XYZCompartmentCanonicalEditPolicy -- to trigger update in response to
changes of values in more features.


Best regards,
Boris



Wailly wrote:
> Hi Boris,
>
> In fact, my purpose is to consider N1 and N2 as 2 classes, with N2
> inheriting from N1. That is why they are identical when created, but
> become different when you start modifying N2. But maybe it is not
> compatible with what exists today in GMF...
>
> For a better understanding, here is an instantiated example of my needs:
>
> Model instance of N1 (classic)
> ====================
> <node name="N1">
> <node name="N1.1"/>
> <node name="Nx" attribute="111"/>
> </node>
>
> Model instance of N2 (the trick)
> ====================
> <node name="N2" isInstanceOf="N1">
> <node name="N2.1"/>
> <node name="Nx" attribute="222"/>
> </node>
>
>
> Notation instance of N1 (classic)
> =======================
> + N1
> |--N1.1
> |--Nx (attribute 111)
>
> Notation instance of N2
> =======================
> + N2
> |--N1.1
> |--N2.1
> |--Nx (attribute 222)
>
>
> Any modification with GMF editor on N1 is reported to N1's model and
> N1's notation and also to N2's notation (no need to report it to N2's
> model as the reference from N2 to N1 does it implicitly).
> Any modification with GMF editor on N2 is reported to N2's model and
> N2's notation.
>
> It is pure inheritance between instances at the model level so there is
> no need to duplicate information from N1 into N2.
> The notation level resolves this inheritance by creating an instance
> which is the addition of N1 and N2.
>
> I hope you understand the need, and just would like to know if such a
> mechanism is available on GMF.
> If not, what would be your advice to implement that?
>
> Thanks a lot,
>
> Fabrice
>
>
Re: A shortcut behaving as a node extension [message #155863 is a reply to message #152163] Tue, 16 October 2007 12:33 Go to previous message
Eclipse UserFriend
Originally posted by: jjvf.gmv.es

Hi,

I am trying to accomplish something similar to your post.

My issue now is that I would want also the diagram notation of the
"origin" model object and its children (N1), be reflected in the shortcut
object (N2).

Have you managed the notation as well as the model? Can you give me a
short explanation on this topic? Is that possible?

The idea could be to have the rendering notation included within the
model. This new model could be read to load the rendering of the shortcut
object. But I have not managed yet to use the notation ecore model in my
own model using a custom style or something like that. And I don't think
it is a good idea to create a new rendering schema different than the
notation ecore that GMF provides.

Have you tried something to achieve this?

Thank you in advance.

JORGE
Previous Topic:emf editor with (some) gmf capabilities
Next Topic:custom initialization of attributes based on user-preferences
Goto Forum:
  


Current Time: Wed Sep 17 17:52:07 EDT 2025

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

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

Back to the top