Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » How to create a predefined composited node?
How to create a predefined composited node? [message #1848650] Sun, 12 December 2021 13:29 Go to next message
Tim Duncan is currently offline Tim DuncanFriend
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 messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
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 #1848737 is a reply to message #1848714] Wed, 15 December 2021 14:49 Go to previous messageGo to next message
Tim Duncan is currently offline Tim DuncanFriend
Messages: 21
Registered: November 2021
Junior Member
Hi, Steve,
I tried the two approaches and they both worked well. Thanks a lot!
I prefer the second approach because it looks simpler and makes my design changes smaller. But it seems to be more cumbersome than the first approach in distinguishing different inputs. For example, in case of "if-else" operator.
I tried to establish two references from an element to this operator in the metamodel, representing if and else respectively, and distinguished between if and else by the order of creating edges in the tool. It works, but it seems a bit cumbersome. Is there a smarter way to achieve this function?
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 messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
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
Re: How to create a predefined composited node? [message #1848805 is a reply to message #1848749] Fri, 17 December 2021 15:12 Go to previous message
Tim Duncan is currently offline Tim DuncanFriend
Messages: 21
Registered: November 2021
Junior Member
Thanks Steve!
I created several abstract classes in the metamodel, and used nested switch widget when defining edge creation in the .design, which finally seemed less messy.
Previous Topic:Sirius web start error
Next Topic:Sequence Diagram
Goto Forum:
  


Current Time: Thu Apr 25 17:43:51 GMT 2024

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

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

Back to the top