Home » Eclipse Projects » Sirius » Difficulty with handling node creation / deletion in corner cases
Difficulty with handling node creation / deletion in corner cases [message #1700877] |
Tue, 07 July 2015 19:49 |
Ryan Schimpel Messages: 7 Registered: May 2015 |
Junior Member |
|
|
Hi there,
I've been having some difficulty trying to implement a particular case using Sirius and I was wondering if you might have some thoughts as how to be go about it.
Essentially, I'm working with a tree structure in Sirius with the goal being able to easily add / remove nodes as well as change the parent of all the nodes and thereby the structure of the tree. While I've been fairly successful in general in doing so, there are certain cases which cause me trouble.
As the several problem cases are quite related, an answer to one of them would provide the template for implementing all of them. As such, I will only go into depth about one such case. Please look at the diagram below:
Essentially, I am trying to add a new root to the tree, pushing everything else down a level; initially, it may appear to be simple but there are several complications. Firstly, unlike a more traditional tree, both the leaf nodes and internal nodes have their own type hierarchy so you're not just dealing with one type for each. Thirdly and probably most seriously, there is no real place where I can create the new node instance; since the container object CONTAINS the root node and hence the rest of the tree (since parent nodes contain their children), attempting to put it in the container object will make me lose the rest of the tree. In fact, containment greatly complicates things in my case. Note that the EMF models for this system are FIXED and changing them is not a viable option.
The real problem here is the lack of actual variables in Sirius that store state; these variables are essentially placeholders (macros) for expressions which are recomputed everytime they are accessed.
Is their any way to do what I'm suggesting without having to resort to an external action? If I need to use one, that's not the end of the world; however, if I had to create an action for each of the numerous types I need to support, that would be extremely unpleasant and a maintenance nightmare. Is there any utility function that I can use to generate instances, say using the name of the metamodel and class (i.e. "hierarchy.ValueNode")? This would mean that I would only need to make and maintain one such action (since the behavior should be the same among all nodes.)
Thanks for your help in advance and I look forward to hearing back from you.
-
Attachment: Diagram.jpg
(Size: 102.55KB, Downloaded 376 times)
|
|
|
Re: Difficulty with handling node creation / deletion in corner cases [message #1701249 is a reply to message #1700877] |
Fri, 10 July 2015 08:59 |
|
Le 07/07/2015 21:49, Ryan Schimpel a écrit :
> Hi there,
> I've been having some difficulty trying to implement a particular case using Sirius and I was wondering if you might have some thoughts as how to be go about it.
>
> Essentially, I'm working with a tree structure in Sirius with the goal being able to easily add / remove nodes as well as change the parent of all the nodes and thereby the structure of the tree. While I've been fairly successful in general in doing so, there are certain cases which cause me trouble.
>
> As the several problem cases are quite related, an answer to one of them would provide the template for implementing all of them. As such, I will only go into depth about one such case. Please look at the diagram below:
>
>
>
> Essentially, I am trying to add a new root to the tree, pushing everything else down a level; initially, it may appear to be simple but there are several complications. Firstly, unlike a more traditional tree, both the leaf nodes and internal nodes have their own type hierarchy so you're not just dealing with one type for each. Thirdly and probably most seriously, there is no real place where I can create the new node instance; since the container object CONTAINS the root node and hence the rest of the tree (since parent nodes contain their children), attempting to put it in the container object will make me lose the rest of the tree. In fact, containment greatly complicates things in my case. Note that the EMF models for this system are FIXED and changing them is not a viable option.
>
> The real problem here is the lack of actual variables in Sirius that store state; these variables are essentially placeholders (macros) for expressions which are recomputed everytime they are accessed.
>
> Is their any way to do what I'm suggesting without having to resort to an external action? If I need to use one, that's not the end of the world; however, if I had to create an action for each of the numerous types I need to support, that would be extremely unpleasant and a maintenance nightmare. Is there any utility function that I can use to generate instances, say using the name of the metamodel and class (i.e. "hierarchy.ValueNode")? This would mean that I would only need to make and maintain one such action (since the behavior should be the same among all nodes.)
>
> Thanks for your help in advance and I look forward to hearing back from you.
>
Hi,
I think you can create a sub variables in the extisting container
variable of the node creation tool to store the old root instance during
the creation of the new one.
I create a sample project to show this solution (based on an ecore
model). Steps to reproduce:
* Import the project newRootProject
* Open the representation named "diagram"
* Select the tool "New root" and click on "ContainerObject" : a new root
named RootB is inserted between ContainerObject and RootA.
Regards,
--
Laurent Redor - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
| |
Goto Forum:
Current Time: Thu Sep 26 04:13:48 GMT 2024
Powered by FUDForum. Page generated in 0.05078 seconds
|