Skip to main content



      Home
Home » Eclipse Projects » Sirius » Create Instance in Tree Description
Create Instance in Tree Description [message #1792305] Sun, 15 July 2018 16:29 Go to next message
Eclipse UserFriend
Hi everyone.

I'm trying to use Sirius to make a Viewpoint with a Tree Description based on a metamodel I have created.

My metamodel has a main class "A" with Class "R" as children and these with "P" as children. In the .odesing I'm showing the current R and P instances in the viewpoint but can't find a way to create new instances of both classes on the Viewpoint. I have searched everywhere for examples of creating instances with Tree Descriptor but haven't found any. Can anyone help me with this?

I already created a Create tool on both parents and children and CreateInstance operation but it does not seem to do anything.

Thanks so much.

[Updated on: Sun, 15 July 2018 16:31] by Moderator

Re: Create Instance in Tree Description [message #1792357 is a reply to message #1792305] Mon, 16 July 2018 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
If create tools are not working, it is likely because they are not defined correctly.
The tool is using the same model operation as the ones in diagrams: https://wiki.eclipse.org/Sirius/Tutorials/StarterTutorial#Add_a_Node_Creation
Can you show us your tool definition?

Regards,

Re: Create Instance in Tree Description [message #1792389 is a reply to message #1792305] Mon, 16 July 2018 16:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi, thanks for the answer.

I have defined a Create Tool within a Tree Item (I also tried moving it up to be its sibling) with a Create Instance operation.

index.php/fa/33411/0/

My metamodel is as follows. Rule class has a reference to Pattern class. ReferenceArchitecture is the DomainClass in the TreeDescriptor.

index.php/fa/33410/0/

Create Tool has these properties

index.php/fa/33409/0/

And Create instance has these properties

index.php/fa/33408/0/

Hope this helps and thank you again.
Re: Create Instance in Tree Description [message #1792463 is a reply to message #1792389] Wed, 18 July 2018 06:06 Go to previous message
Eclipse UserFriend
Hi,

The Reference Name must point at the reference where the new instance will be added.
So in your example, this will be the "rules" reference of "ReferenceArchitecture".

But first you must set the context right. Your tool should be at the RuleModel level.
I guess RuleModel has as Domain Class "ReferenceArchitecture".

in this case, in your tool, first add a "change context" operation with var:element as expression. So your context is now the "ReferenceArchitecture" instance.
Then your "create instance" operation that uses "rules" as reference name.

This should work.

Also to define Type I recommend to use this syntax Rules::Rule

Regards,

[Updated on: Wed, 18 July 2018 06:08] by Moderator

Previous Topic:Set model element properties in custom widget
Next Topic:Any support for spinning wheel/ wait gif in Sirius?
Goto Forum:
  


Current Time: Wed Jul 23 15:44:05 EDT 2025

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

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

Back to the top