|
Re: Working with a container to group model elements by dragging [message #1744519 is a reply to message #1742943] |
Tue, 27 September 2016 16:10 |
Alex B. Messages: 20 Registered: June 2016 |
Junior Member |
|
|
Hi all,
at frist sorry for pushing but maybe someone got an idea by now...
I managed to create containers which are accordingly to the screenshot attached on this posting.
C0 is some kind of a root container. It is created with the diagram.
I added C1 and C2, both outside of C0. If I drop C1 onto C0, the drop seems to work since C1 is now part of C0, but still the "old" C1 exists outside C0. Why is that?
When I place further elements into C1 (which is inside C0) they are also shown in the other C1 container. So they seem to be some kind of mirroring each other. Does any one have a clue what I did wrong?
What I want to achieve is a infite container relationsship (for example as proposed in the blogpost by Melanie: http://melb.enix.org/sirius/reimport/) with the only difference, that on every level a container can contain further containers (Group - see my diagram I attached on the initial post) or other elements (subclasses of VerySpecialElement - see my diagram I attached on the initial post).
Maybe someone got an idea how to achieve that...
Thx and best regards
Alex
[Updated on: Tue, 27 September 2016 16:13] Report message to a moderator
|
|
|
Re: Working with a container to group model elements by dragging [message #1744556 is a reply to message #1744519] |
Wed, 28 September 2016 09:09 |
|
Hello Alex,
I think we missed your first post, sorry about that.
For the infinite containment, you need to reuse the same container mapping in the Import tab (also see the "Reuse mappings" part in the blogpost by Melanie). Then to be able to drag and drop a container from one parent to another, you will need to add a "Container Drop" tool (available among the "New Element Edition" in the contextual menus) otherwise you will only be able to move around a container without being able to change its parent. In this tool, you first add a "change context" operation and set it as "var:element". Then add a "move" operation and set it as "var:newSemanticContainer". This will move the drag container into the targeted container.
About your metamodel, are you sure that you need the metaclass group? If ModelElement had a containment reference on itself, you could create a ModelElement and later add ModelElement in it without having to create a group. Then SpecialElement and VerySpecialElement would not be needed anymore.
Regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Working with a container to group model elements by dragging [message #1744570 is a reply to message #1744556] |
Wed, 28 September 2016 12:33 |
Alex B. Messages: 20 Registered: June 2016 |
Junior Member |
|
|
Hi Steve,
thanks for you answer.
Steve Monnier wrote on Wed, 28 September 2016 09:09
For the infinite containment, you need to reuse the same container mapping in the Import tab (also see the "Reuse mappings" part in the blogpost by Melanie). Then to be able to drag and drop a container from one parent to another, you will need to add a "Container Drop" tool (available among the "New Element Edition" in the contextual menus) otherwise you will only be able to move around a container without being able to change its parent. In this tool, you first add a "change context" operation and set it as "var:element". Then add a "move" operation and set it as "var:newSemanticContainer". This will move the drag container into the targeted container.
That is basically what I did before. I changed it in exact the way you proposed, but unfortunately I still have these two views which are mirroring each other. So maybe the problem is not the container drop itself. How is a container drop handled internally by Sirius? - I can imagine that a new container is created while the old one is deleted?
I am asking because I got the case, when a new instance of Group is created, I do the following things:
- change context to feature:eContainer
-- create Instance Group with reference name: modelelements
--- change context var:newlyCreatedGroup
---- move with new container expression: var:container and feature name: groupElements
I feel I need to do it that way, because I need the reference name to be set in my root class Model. Maybe my problem has anything to do with that?
Quote:About your metamodel, are you sure that you need the metaclass group? If ModelElement had a containment reference on itself, you could create a ModelElement and later add ModelElement in it without having to create a group. Then SpecialElement and VerySpecialElement would not be needed anymore.
Thanks for the hint. I already thought about that, but unfortunately this excerpt is not representing my whole model. The rest of it requires to have a Group metaclass...
Maybe you got some ideas on that... I got this feeling that a working solution is not far anymore.
Thanks!
Best
Alex
|
|
|
Re: Working with a container to group model elements by dragging [message #1744585 is a reply to message #1744570] |
Wed, 28 September 2016 15:24 |
|
Oh right! I replied too quickly.
You may have duplicates elements depending on how you created your mappings because the containment tree in your semantic model is different from how you want to display it. Here is how I visualize your mappings (if I understood correctly your metamodel and wanted diagram):
- You should have a first mapping (mapping A) with a domain based "VerySpecialElement" that have no group referencing them (VerySpecialElement in no group);
- Then, you should have a container mapping (mapping B) with a domain based "Group" that have also no group referencing them (first level group);
- Inside the previous container mapping, you should have a mapping (mapping C) with a domain based "VerySpecialElement" where the semantic expression would be "feature:groupElements" in order to display only the elements of this group:
- In the same container mapping, you should have a container mapping (mapping D) with a domain based "Group" where the semantic expression would be "feature:groupElements" in order to display the groups contained by this group. Also, this container mapping should reuse itself to display groups of second level and more. It should also reuse (mapping C) to display contained "VerySpecialElements" recursively (or you add a last mapping similar to mapping C in it).
In your drop tool you should not move the element. You should change context to var:newSemanticContainer and then (instead of the move) add a "Set" operation in order to set the groupElements reference adding the dropped element.
Regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: Working with a container to group model elements by dragging [message #1744607 is a reply to message #1744585] |
Wed, 28 September 2016 20:09 |
Alex B. Messages: 20 Registered: June 2016 |
Junior Member |
|
|
Hi Steve,
thank you for your answer. Hmm... I tried it the way you described, but it did not work unfortunately. :/ Still both views to one single instance are shown, even if I exactly followed your description.
May I ask you for a odesign file (including three tools: one for creating groups, the second for dropping elements onto a group and another for creating one subclass of VerySpecialElement as a node, e.g. ClassA) ? - That would be great! I attached the ecore project the way I modeled the metamodel.
One more thing: Can I really use the abstraction VerySpecialElement instead of the concrete classes ClassA and ClassB? I would have rather used the concrete types here.
Thank you for your help so far. I hope we will get this thing fixed soon, since I still got the feeling that we are nearly there.
Best
Alex
[Updated on: Wed, 28 September 2016 20:13] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03794 seconds