Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Multiple palette tool elements for one domain model node
Multiple palette tool elements for one domain model node [message #180327] Wed, 02 April 2008 05:43 Go to next message
Eclipse UserFriend
Hi,
I have an element A that can contain several elements B. I would like to
distinguish B elements : B0 and B1. B0 and B1 are domain model B
elements but they will be intialize differently. So, in my palette tool,
I would like to have 2 different items : B0 and B1.

My .gmftool contains :
...
B0 item
B1 item

My .gmfmap contains :
...
NODE A
Compartment BElements
Child Reference
NODE B ---> B0 item tool
Child Reference
NODE B ---> B1 item tool


When I launch my diagram, the palette tool effectively contains 2
different items. One item correctly creates a B element, but the other
throws an error when I want to create the element on my compartment :
org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred

I suppose that I have to modify my .gmfgen file... but I don't know
where and what ....

I have an other question : I would like to display a different
properties view content according the type of my Element B : how can I
do that ? (which are functions to change ? Where...)


Thanks for your help!

Best regards,

Philippe



Here is my error detail :


org.eclipse.core.commands.ExecutionException: While executing the
operation, an exception occurred
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:519)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:205)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:168)
at
org.eclipse.gmf.runtime.diagram.ui.parts.DiagramCommandStack .execute(DiagramCommandStack.java:155)
at org.eclipse.gef.tools.AbstractTool.executeCommand(AbstractTo ol.java:388)
at
org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(Abs tractTool.java:400)
at
org.eclipse.gmf.runtime.diagram.ui.tools.CreationTool.perfor mCreation(CreationTool.java:133)
at org.eclipse.gef.tools.CreationTool.handleButtonUp(CreationTo ol.java:178)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1053)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:259)
at
org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Released(DomainEventDispatcher.java:374)
at
org.eclipse.draw2d.LightweightSystem$EventHandler.mouseUp(Li ghtweightSystem.java:538)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:206)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:169)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
at org.eclipse.equinox.launcher.Main.main(Main.java:1148)
Caused by: org.eclipse.jface.util.Assert$AssertionFailedException: null
argument;failed to create a view
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:153)
at
org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.do ExecuteWithResult(CreateCommand.java:99)
at
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTr ansactionalCommand.doExecute(AbstractTransactionalCommand.ja va:246)
at
org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:137)
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.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.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)
... 37 more
Re: Multiple palette tool elements for one domain model node [message #180388 is a reply to message #180327] Wed, 02 April 2008 07:11 Go to previous messageGo to next message
Eclipse UserFriend
Hello Philippe,

> I have an element A that can contain several elements B. I would like
> to distinguish B elements : B0 and B1. B0 and B1 are domain model B
> elements but they will be intialize differently. So, in my palette
Just one addition: to correctly model this situation in GMf you should create

not only two ChildReference/NodeMappings for B0 and B1 - you have to add
corresponding initializer/OCL constraint for each of these Mappings.

Proper OCL constraints absence can be the reason for an exception.

-----------------
Alex Shatalin
Re: Multiple palette tool elements for one domain model node [message #180395 is a reply to message #180388] Wed, 02 April 2008 07:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi Alex,

Alex Shatalin a écrit :
> Hello Philippe,
>
>> I have an element A that can contain several elements B. I would like
>> to distinguish B elements : B0 and B1. B0 and B1 are domain model B
>> elements but they will be intialize differently. So, in my palette
> Just one addition: to correctly model this situation in GMf you should
> create
> not only two ChildReference/NodeMappings for B0 and B1 - you have to add
> corresponding initializer/OCL constraint for each of these Mappings.

Each element has is own OCL constraint.
It seems that generated create command code or Edit Part are mixed.
Once my error is thrown, if I create an element with the other correct
item palette tool, 2 elements are created. Maybe there is an issu in the
command stack behavior ?


>
> Proper OCL constraints absence can be the reason for an exception.
>
> -----------------
> Alex Shatalin
>
>
Re: Multiple palette tool elements for one domain model node [message #180520 is a reply to message #180388] Wed, 02 April 2008 11:39 Go to previous message
Eclipse UserFriend
Arf, you are right Alex.
Tutorial 2 says : "In fact, whenever you create multiple mappings to a
single domain element, you will need to add constraints such that each
can be uniquely identified.".

Thank you very much !


Alex Shatalin a écrit :
> Hello Philippe,
>
>> I have an element A that can contain several elements B. I would like
>> to distinguish B elements : B0 and B1. B0 and B1 are domain model B
>> elements but they will be intialize differently. So, in my palette
> Just one addition: to correctly model this situation in GMf you should
> create
> not only two ChildReference/NodeMappings for B0 and B1 - you have to add
> corresponding initializer/OCL constraint for each of these Mappings.
>
> Proper OCL constraints absence can be the reason for an exception.
>
> -----------------
> Alex Shatalin
>
>
Previous Topic:Persisting selection marquee in the diagram
Next Topic:Dragging out and in a compartment changes containment feature
Goto Forum:
  


Current Time: Sat Jun 07 16:22:58 EDT 2025

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

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

Back to the top