A shortcut behaving as a node extension [message #151870] |
Thu, 20 September 2007 12:51  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #152163 is a reply to message #152151] |
Tue, 25 September 2007 12:19   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04401 seconds