How to create a predefined composited node? [message #1848650] |
Sun, 12 December 2021 13:29 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Tim Duncan![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=td_mvp%40126.com) Messages: 21 Registered: November 2021 |
Junior Member |
|
|
Hello,
Can I create a predefined composited node in a diagram?
For example, I want to create a container that represents operators, such as "and", "not". I think these containers should contain some bordered nodes so that users can connect edges to them instead of directly connecting to the container. But I should not let users create these bordered nodes themselves. They should be predefined and can be used directly. For example, the "not" operator has only one input, and the "and" operator have two inputs (It would be better to determine the number of inputs by user specified values). I wonder how to do this?
Another question, how can I allow users to create a node or container that represent a reference element(no new instance is created) in a diagram ?
With Regards.
[Updated on: Mon, 13 December 2021 02:56] Report message to a moderator
|
|
|
Re: How to create a predefined composited node? [message #1848714 is a reply to message #1848650] |
Tue, 14 December 2021 19:45 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Tim,
I think you can have two different approaches on this:
* The first one, as you have the concepts of input and output in your metamodel and I guess that they are model elements contained by your operands and you have mappings that represents these inputs and outputs. Then you simply need to create the required inputs/output when an operand is created. You can have your operand creation tool to do that, but you could also do it directly in your ItemProvider (in java in your .edit plugin) so even if you create an operand from a different model editor, you will always create the inputs/output when you create an operand. Either way, I would recommand to also create a Delete tool on these input and output mappings to prevent their deletion by a user, but instead unset the reference to these input/output.
* The second approach would be to forget displaying input and outputs as ports (bordered nodes) on the diagram. In your Edge creation tool, you can have "Connection start precondition" and "Connection Complete precondition" that will display a forbidden sign if you can't connect the operand about to be selected (that would prevent having errors if in your metamodel an operand has a input reference [0..2] and you tried to connect a third one). In the execution of the tool, you can consider to have the first click on an operand to connect to the output, and the second click (to another operand) to connect to an input, and have all your tools with the same "flow".
The second approach gives more work on the "flow" and preconditions, but that allows the user to click anywhere on the operand (which in the first approach can be mitigated by the extra-mapping option of creation tools).
I am not sure how to reply on your last question. When a user create this node (that is a reference), how do you have the source and target? Can you detail the scenario?
Best regards,
Steve
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: How to create a predefined composited node? [message #1848749 is a reply to message #1848737] |
Wed, 15 December 2021 23:03 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
|
Hi Tim,
Indeed, with the second approach you will need to make your references direction easily seen/understood. On Edge mapping style, you have many decorators you can choose to help visualise this direction.
For an "if-else" operator, I guess I would have only one input but the condition displayed on the node. Then you can have 2 outputs for true or false (written on the reference label and/or with the edges having different colors). I am not really an expert in designs, maybe you can have some inspiration with the Sirius Gallery [1] representing flows or PERT charts in general.
Best regards,
Steve
[1] https://www.eclipse.org/sirius/gallery.html
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 0.04009 seconds