|
Re: Node creation error [message #1786224 is a reply to message #1786206] |
Fri, 27 April 2018 07:37 |
|
Hi,
Hard to say what is wrong with this partial view of your DSL. Are you sure about the context where the tool is applied ? The change context "var:container" is supposed to return a "Rule" object.
I see validation warning and error in your odesign.
The error log view may also contain error when you apply the tool.
You can test your expressions and the context by using the Sirius Interpreter view (Window > show view > Interpreter and select the Sirius Interpreter)
Regards,
Florian
|
|
|
|
|
|
|
Re: Node creation error [message #1786247 is a reply to message #1786245] |
Fri, 27 April 2018 15:21 |
|
From what I understand from your first post, you try to apply the MU creation tool on the diagram. But the MU instance cannot be created since it needs to be under the context of ContextDefinition (according to your mm, the feature "context" that owns MU is from a ContextDefinition object).
The easiest solution is to make your tool applicable on a ContextDefinition node.
Regards,
Florian
|
|
|
|
|
Re: Node creation error [message #1786366 is a reply to message #1786316] |
Wed, 02 May 2018 07:22 |
|
I guess you want to create a new MU when clicking on a "ContextDefinition" ?
In that case you can remove the change context, the "self" is the ContextDefinition on which the tool has been applied on.
|
|
|
Re: Node creation error [message #1786404 is a reply to message #1786366] |
Wed, 02 May 2018 17:51 |
Adalberto Jr Messages: 36 Registered: December 2017 |
Member |
|
|
Florian,
in fact, I'd like to know how a Sirius Diagram works in this situations. Look: In my Ecore model, when I want to add an MU, I click with right button on ContextDefinition and select "New Child", then I choose MU. The model automatically creates a link between then.
I was thinking about this: how can I create an MU and the Diagram automatically associate it to a ContextDefinition than I've been created before? I have to click in the ContextDefinition node before to add an MU?
I removed the "change context", but the MU wasn't created yet.
Sorry, it looks so easy but, as my very fisrt experience, I'm a little bit lost.
Regards.
|
|
|
|
Re: Node creation error [message #1786438 is a reply to message #1786406] |
Thu, 03 May 2018 09:25 |
|
Hello Adalberto,
You should use the "Change Context" operation to position on the good contex. You want click on ContextDefinitionNode mapping, so this node corresponding to the varibale container define in NodeCreation. The variable container corresponding to element clicked by user.
You must do a Change Context operation, Browse Expression: var:container
In the Change Context operation you must do a Create Instance operation.
You must set the reference name that corresponding to the Metamodel relation that define the contextDefinition containing a MU. For the field Reference Name you can use the completion 'Ctrl+space'
Do this corresponds to do right click on ContextDefinition, and select "New Child", MU
Regards,
|
|
|
Re: Node creation error [message #1786444 is a reply to message #1786438] |
Thu, 03 May 2018 10:52 |
Adalberto Jr Messages: 36 Registered: December 2017 |
Member |
|
|
Julien, I did this before.
First, in the Change Context operation, when I use the var:container, I can observe that is setted to mobcons::Specification
After this, in the Create Instance operation, when I use 'Ctrl+space', the objects available in Reference Name are contextdefinition, restrictiondefinition and rule. I choose contextdefinition, then, the only one object available in Type Name is mobcons::ContextDefinition. But I want to create a MU node, not a ContextDefinition one.
When I validate the node creation, a error occurs: Invalid feature 'contextdefinition' for the following types mobcons::ContextDefinition
I made a test now. Using the Sirius interpreter, the var:container is always setted to Specification object, even when I click in any object. But the var:self shows me the object clicked by the user.
|
|
|
Re: Node creation error [message #1786446 is a reply to message #1786444] |
Thu, 03 May 2018 12:45 |
|
Yes, you're right,
I made a mistake, you must use the containerView variable and not the container variable. The containerView variable corresponding to the selected graphic element, while the variable container corresponding to the semantic element, in your case the MUNode container is your diagram, which must be set to Specification.
To work, you must use the change context expression aql: containerView.target
The .target retrieves the semantic element attached to the graphic element.
Sorry for my mistake.
Regards,
|
|
|
Re: Node creation error [message #1786451 is a reply to message #1786446] |
Thu, 03 May 2018 13:41 |
|
Your node creation tool should work properly when applying it on a ContextDefinition if:
* You add the ContextDefinition mapping in the Extra Mappings of the MU node creation tool (Advanced tab > Extra Mappings). Since your MU mapping is defined directly on the diagram, by default, the node creation tool is only allowed on the diagram.
* Under the begin, you define a Create Instance with "context" as reference name (according to your metamodel, a MU is contained in a contextDefinition via the "context" feature) and "MU" as type name.
Regards,
Florian
|
|
|
|
|
|
|
|
|
|
Re: Node creation error [message #1786504 is a reply to message #1786502] |
Fri, 04 May 2018 14:13 |
|
Your example works fine.
If you apply new MU on Context Definition it's work well.
If you click on the diagram you have error and it's normal! Your Diagram is defined on Specification and you try to create a MU on a Specification and it's forbidden. To avoid this, you can add in the MU Node creation a precondition as aql:self.oclIsKindOf(mobcons::ContextDefinition)
This precondition allows to forbidden to apply the New MU on the diagram.
I invite you to make tutorials: https://wiki.eclipse.org/Sirius/Tutorials
I invite you too, to fill the semantic candidates expression in the mapping definition, because if you put nothing, it's an eAllContents() that applied.
Regards,
|
|
|
|
Powered by
FUDForum. Page generated in 0.12631 seconds