Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Node creation error
Node creation error [message #1786206] Thu, 26 April 2018 21:44 Go to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
Friends,

I have a problem of Node Creation in Section Tool. I can't create a new Node (called new MU) from Palette Tool into Representation diagram.

index.php/fa/32717/0/

My metamodel:

index.php/fa/32718/0/

Tks.
  • Attachment: 1.png
    (Size: 141.96KB, Downloaded 338 times)
  • Attachment: 2.jpg
    (Size: 382.69KB, Downloaded 217 times)
Re: Node creation error [message #1786224 is a reply to message #1786206] Fri, 27 April 2018 07:37 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 201
Registered: August 2010
Senior Member
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 #1786234 is a reply to message #1786224] Fri, 27 April 2018 13:02 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
Florian, tks for you help.

I'm a new user of Sirius. This is my first experience, so I'm not so sure about the objects I have to use. The main object is Specification.

I add the nodes Rule, ContextDefinition and RestrictionDefinition, but the nodes MU and Speed, no.

What informations do you need to analyse this problem?

Re: Node creation error [message #1786235 is a reply to message #1786234] Fri, 27 April 2018 13:10 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
I don't know also how to use the Sirius Interpreter.

Can you give an example of expression?
Re: Node creation error [message #1786244 is a reply to message #1786235] Fri, 27 April 2018 14:16 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 201
Registered: August 2010
Senior Member
You can follow some tutorials (https://www.eclipse.org/sirius/getstarted.html) that may help you to create basic tools.
So you say the Diagram is based of the "Specification" type? If your tool is applied on a "Context Definition" there is no need to change the context, it is the good one.
But if you apply the tool on the diagram blank, the context is the "Specification". You have to change the context to the appropriate Context Definition (In your metamodel, MU are owned by Context Definition following the context containment feature).
In that case, let the user choose the Context Definition in which the MU will be added.
see https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#dialog for instance with a good example of this usage in ecoretools: https://www.eclipse.org/ecoretools/doc/index.html (the "Add" tool on the Class Diagram open a dialog to choose which element to add).

Regards,

Florian
Re: Node creation error [message #1786245 is a reply to message #1786244] Fri, 27 April 2018 14:39 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
Ok, I changed the context to specification. After this, all the errors and warnings are solved.

But I didn't understand this part you told:

" You have to change the context to the appropriate Context Definition (In your metamodel, MU are owned by Context Definition following the context containment feature).
In that case, let the user choose the Context Definition in which the MU will be added."

You are right: it is necessary the user to define first the ContextDefinition. After this, the user will add MU objects for this ContextDefinition.

How can I do this in the diagram?

Tks for the patience.
Re: Node creation error [message #1786247 is a reply to message #1786245] Fri, 27 April 2018 15:21 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 201
Registered: August 2010
Senior Member
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 #1786315 is a reply to message #1786247] Mon, 30 April 2018 17:26 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
The easiest solution is to make your tool applicable on a ContextDefinition node.

What exactly do you mean, Florian? Look how I'm setting up the Node Creation of MU. Can you see something wrong?

index.php/fa/32730/0/

Regards.
  • Attachment: 3.png
    (Size: 140.98KB, Downloaded 174 times)
Re: Node creation error [message #1786316 is a reply to message #1786315] Mon, 30 April 2018 17:32 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
In the console, it's generated the message below:


!ENTRY org.eclipse.sirius 4 0 2018-04-30 14:29:55.670
!MESSAGE Error while modifying model
!STACK 0
org.eclipse.sirius.ecore.extender.business.api.accessor.exception.FeatureNotFoundException: context on sirius.mobcons.impl.SpecificationImpl@2227fa03
at org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor.eIsMany(ModelAccessor.java:319)
at org.eclipse.sirius.business.internal.helper.task.operations.CreateInstanceTask.execute(CreateInstanceTask.java:87)
at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.executeTask(ExecuteToolOperationTask.java:127)
at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.executeTask(ExecuteToolOperationTask.java:138)
at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.execute(ExecuteToolOperationTask.java:111)
at org.eclipse.sirius.business.api.helper.task.TaskExecutor.execute(TaskExecutor.java:64)
at org.eclipse.sirius.tools.api.command.SiriusCommand.doExecute(SiriusCommand.java:80)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.sirius.diagram.ui.tools.api.command.GMFCommandWrapper.doExecuteWithResult(GMFCommandWrapper.java:102)
at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:403)
at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:134)
at org.eclipse.sirius.diagram.ui.tools.internal.commands.WrappingCommandIgnoringAffectedFiles.execute(WrappingCommandIgnoringAffectedFiles.java:124)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramCommandStack.execute(DDiagramCommandStack.java:71)
at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramCommandStack.execute(DDiagramCommandStack.java:52)
at org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack.execute(DiagramCommandStack.java:156)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTool.java:425)
at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(AbstractTool.java:438)
at org.eclipse.gef.tools.CreationTool.performCreation(CreationTool.java:269)
at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTool.java:189)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java:1200)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:301)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouseReleased(DomainEventDispatcher.java:380)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(LightweightSystem.java:548)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:221)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5348)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4602)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4183)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Re: Node creation error [message #1786366 is a reply to message #1786316] Wed, 02 May 2018 07:22 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 201
Registered: August 2010
Senior Member
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 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
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 #1786406 is a reply to message #1786404] Wed, 02 May 2018 19:38 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
In time, my tool is applied on mobcons::Specification, as defined in Domain Class (Specification Diagram).

Re: Node creation error [message #1786438 is a reply to message #1786406] Thu, 03 May 2018 09:25 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 130
Registered: July 2009
Senior Member
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 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
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 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 130
Registered: July 2009
Senior Member
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 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 201
Registered: August 2010
Senior Member
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 #1786459 is a reply to message #1786451] Thu, 03 May 2018 16:39 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
Friends,

I tried all you suggest:

- I used the change context expression aql: containerView.target (Browse Expression field)
- I added the ContextDefinitionNode in the Extra Mappings field
- In the Create Instance operation, I defined as Reference Name: context and Type Name: mobcons::MU

The tool still don't work.

:)
Re: Node creation error [message #1786460 is a reply to message #1786459] Thu, 03 May 2018 16:43 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
This error occurs on the console:


!ENTRY org.eclipse.sirius 4 0 2018-05-03 13:41:56.065
!MESSAGE Error while modifying model
!STACK 0
org.eclipse.sirius.ecore.extender.business.api.accessor.exception.FeatureNotFoundException: context on sirius.mobcons.impl.SpecificationImpl@5d18255a
Re: Node creation error [message #1786484 is a reply to message #1786460] Fri, 04 May 2018 09:02 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 130
Registered: July 2009
Senior Member
Adalberto,

Could you give us your Metamodel project and the Odesign project?
it'll be easier for us.

Thanks.

Regards,
Re: Node creation error [message #1786497 is a reply to message #1786484] Fri, 04 May 2018 12:41 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
Of course.

I was thinking about this.

How can I send it to you?
Re: Node creation error [message #1786499 is a reply to message #1786497] Fri, 04 May 2018 13:19 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 130
Registered: July 2009
Senior Member
You can add an attachment when you click on reply.
Re: Node creation error [message #1786500 is a reply to message #1786499] Fri, 04 May 2018 13:29 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
No Message Body
Re: Node creation error [message #1786502 is a reply to message #1786499] Fri, 04 May 2018 13:39 Go to previous messageGo to next message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
I send two files:

1. mobcons_model: is the ecore project that I run as Eclipse Applicatrion (main project).

2. mobcons_diagram: is my tool

Thanks and I hope you can find the mistakes I made.

Regards

[Updated on: Fri, 04 May 2018 14:27]

Report message to a moderator

Re: Node creation error [message #1786504 is a reply to message #1786502] Fri, 04 May 2018 14:13 Go to previous messageGo to next message
Julien Dupont is currently offline Julien DupontFriend
Messages: 130
Registered: July 2009
Senior Member
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,
Re: Node creation error [message #1786505 is a reply to message #1786504] Fri, 04 May 2018 14:19 Go to previous message
Adalberto Jr is currently offline Adalberto JrFriend
Messages: 36
Registered: December 2017
Member
Ok, Julien.

I understood. I was not operating the diagram correctly.

Thanks a lot.

Now I can advance in studies. This tool is amazing.

Regards
Previous Topic:Odesign + Emfcompare
Next Topic:Preferred node size vs preferred node container size
Goto Forum:
  


Current Time: Tue Nov 20 12:20:31 GMT 2018

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

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

Back to the top