Problem creating link from derived class [message #217253] |
Wed, 04 February 2009 10:09  |
Eclipse User |
|
|
|
Hi,
I want to create a link between nodes.
The ecore model is like this:
the nodes: Class A
a link: Class B
another link Class BA -> Class B
I can create a link with class B but not with class BA. When I draw the connection with class BA
than I get the following exception:
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:399)
at org.eclipse.gef.tools.AbstractTool.executeCurrentCommand(Abs tractTool.java:411)
at
org.eclipse.gmf.runtime.diagram.ui.tools.ConnectionCreationT ool.handleCreateConnection(ConnectionCreationTool.java:341)
at
org.eclipse.gmf.runtime.diagram.ui.tools.ConnectionCreationT ool.handleButtonUp(ConnectionCreationTool.java:181)
at org.eclipse.gef.tools.AbstractTool.mouseUp(AbstractTool.java :1064)
at org.eclipse.gef.EditDomain.mouseUp(EditDomain.java:263)
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:207)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:386)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:failed to create a view
at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:86)
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:247)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(Abstr actEMFOperation.java:169)
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:135)
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:135)
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:135)
at
org.eclipse.core.commands.operations.DefaultOperationHistory .execute(DefaultOperationHistory.java:511)
.... 37 more
I debug a bit and found that for Class BA is no ViewProvider registered but it is for class B. I
have no idea where I could register this ViewProvider.
Does any one know how to solve the problem?
Thanks, Martin
|
|
|
|
|
|
|
|
|
Re: Problem creating link from derived class [message #217374 is a reply to message #217367] |
Thu, 05 February 2009 08:25  |
Eclipse User |
|
|
|
Hi Christian,
actually Isolator shall be a connection and not a node. I try what u proposed but than I got a node
instead of a connection.
Please find below my complete .gmfmap file. Do you have any other suggestion?
<?xml version="1.0" encoding="UTF-8"?>
<gmfmap:Mapping xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<nodes>
<containmentFeature
href="psc.ecore#//Network/nodes"/>
<ownedChild>
<domainMetaElement
href="psc.ecore#//Node"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping"
readOnly="true"
viewPattern="{0}"
editorPattern=""
editPattern="">
<diagramLabel
href="psc.gmfgraph#NodeIDLable"/>
<features
href="psc.ecore#//Node/nodeID"/>
</labelMappings>
<tool
xsi:type="gmftool:CreationTool"
href="psc.gmftool#//@palette/@tools.0/@tools.0"/>
<diagramNode
href="psc.gmfgraph#Node"/>
</ownedChild>
</nodes>
<links>
<domainMetaElement
href="psc.ecore#//Conductor"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping"
editorPattern=""
editPattern="">
<diagramLabel
href="psc.gmfgraph#ConductorNameLable"/>
<features
href="psc.ecore#//Conductor/name"/>
</labelMappings>
<containmentFeature
href="psc.ecore#//Network/conductors"/>
<tool
xsi:type="gmftool:CreationTool"
href="psc.gmftool#//@palette/@tools.0/@tools.2"/>
<diagramLink
href="psc.gmfgraph#Conductor"/>
<sourceMetaFeature
xsi:type="ecore:EReference"
href="psc.ecore#//Conductor/nodeFrom"/>
<linkMetaFeature
xsi:type="ecore:EReference"
href="psc.ecore#//Conductor/nodeTo"/>
</links>
<links>
<domainMetaElement
href="psc.ecore#//Connector"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping"
viewPattern="{0}+{1}j"
editorPattern="{0}+{1}"
editPattern="{0}+{1}">
<diagramLabel
href="psc.gmfgraph#Connector_X_OhmLable"/>
<features
href="psc.ecore#//Connector/r_Ohm"/>
<features
href="psc.ecore#//Connector/x_Ohm"/>
</labelMappings>
<containmentFeature
href="psc.ecore#//Network/connectors"/>
<tool
xsi:type="gmftool:CreationTool"
href="psc.gmftool#//@palette/@tools.0/@tools.3"/>
<diagramLink
href="psc.gmfgraph#Connection"/>
<sourceMetaFeature
xsi:type="ecore:EReference"
href="psc.ecore#//Connector/nodeFrom"/>
<linkMetaFeature
xsi:type="ecore:EReference"
href="psc.ecore#//Connector/nodeTo"/>
</links>
<links>
<domainMetaElement
href="psc.ecore#//Isolator"/>
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping"
editorPattern=""
editPattern="">
<diagramLabel
href="psc.gmfgraph#IsolatorNameLable"/>
<features
href="psc.ecore#//Conductor/name"/>
</labelMappings>
<containmentFeature
href="psc.ecore#//Network/conductors"/>
<tool
xsi:type="gmftool:CreationTool"
href="psc.gmftool#//@palette/@tools.0/@tools.4"/>
<diagramLink
href="psc.gmfgraph#Isolator"/>
<sourceMetaFeature
xsi:type="ecore:EReference"
href="psc.ecore#//Conductor/nodeFrom"/>
<linkMetaFeature
xsi:type="ecore:EReference"
href="psc.ecore#//Conductor/nodeTo"/>
</links>
<diagram>
<diagramCanvas
href="psc.gmfgraph#psc"/>
<domainModel
href="psc.ecore#/"/>
<domainMetaElement
href="psc.ecore#//Network"/>
<palette
href="psc.gmftool#//@palette"/>
</diagram>
</gmfmap:Mapping>
Christian Muth wrote, On 05.02.2009 13:35:
> Hi Martin,
>
>
> your problem might be that you do not have a node mapping (top node
> reference) for Isolator, but only for Conductors.
> Though Isolator is a specialized Conductor, you have to give it its own
> node mapping (second top node reference for Network->conductors, node
> mapping inside with domain meta element Isolator and diagram node Node)
> for being able to use it with links.
>
>
> Cheers
>
> Christian
>
|
|
|
Powered by
FUDForum. Page generated in 0.10432 seconds