Use same ECORE class with different creation tools [message #236230] |
Wed, 15 July 2009 09:53  |
Eclipse User |
|
|
|
Originally posted by: ML1984.gmx.de
This is a multi-part message in MIME format.
--------------040401020908030905080801
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
I have a problem using the same ECORE class with different creation
tools. Let's assume there is a (diagram) class A, referencing class B
twice: via EReference b1 and b2. Let's further assume there is one node
in graphical model and two creation tools (B1 and B2) in tooling model.
In mapping model I created the following:
Top Node Reference
Containment Feature: A.b1
Element: B
Diagram Node: Node B
Tool: Creation Tool B1
Top Node Reference
Containment Feature: A.b2
Element: B
Diagram Node: Node B
Tool: Creation Tool B2
Code generation succeeds, but: If you use the B2 creation tool (in an
newly started eclipse application), an exception is thrown (see below)
and no B element is created.
------------------------------------------------
Caused by: org.eclipse.core.runtime.AssertionFailedException: null
argument:failed to create a view
at
org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
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: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:135)
at
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:403)
------------------------------------------------
Using debugger, I could find the origin of the above mentioned
AssertionFailedException. In class
org.eclipse.gmf.runtime.common.core.service.ExecutionStrateg y
there is a static final attribute 'FIRST' of type ExecutionStrategy,
implementing method
public List execute(Service service, IOperation operation)
This method returns Collections.EMPTY_LIST, causing its caller to return
null.
I don't know how to proceed further. Anyway, do you have any suggestions
how to make the example work? BTW, used models are attached to this message.
Cheers,
Mark
PS. I am using Eclipse Galileo pre packaged as Eclipse Modeling Tools.
--------------040401020908030905080801
Content-Type: text/xml;
name="My.gmfgraph"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.gmfgraph"
<?xml version="1.0" encoding="UTF-8"?>
<gmfgraph:Canvas xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition" name="my">
<figures
name="Default">
<descriptors
name="BFigure">
<actualFigure
xsi:type="gmfgraph:Rectangle"
name="BFigure"/>
</descriptors>
</figures>
<nodes
name="B"
figure="BFigure"/>
</gmfgraph:Canvas>
--------------040401020908030905080801
Content-Type: text/xml;
name="My.gmfmap"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.gmfmap"
<?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:gmfmap="http://www.eclipse.org/gmf/2008/mappings"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<nodes>
<containmentFeature
href="My.ecore#//A/b1"/>
<ownedChild>
<domainMetaElement
href="My.ecore#//B"/>
<tool
xsi:type="gmftool:CreationTool"
href="My.gmftool#//@palette/@tools.0/@tools.0"/>
<diagramNode
href="My.gmfgraph#B"/>
</ownedChild>
</nodes>
<nodes>
<containmentFeature
href="My.ecore#//A/b2"/>
<ownedChild>
<domainMetaElement
href="My.ecore#//B"/>
<tool
xsi:type="gmftool:CreationTool"
href="My.gmftool#//@palette/@tools.0/@tools.1"/>
<diagramNode
href="My.gmfgraph#B"/>
</ownedChild>
</nodes>
<diagram>
<diagramCanvas
href="My.gmfgraph#my"/>
<domainModel
href="My.ecore#/"/>
<domainMetaElement
href="My.ecore#//A"/>
<palette
href="My.gmftool#//@palette"/>
</diagram>
</gmfmap:Mapping>
--------------040401020908030905080801
Content-Type: text/xml;
name="My.gmftool"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.gmftool"
<?xml version="1.0" encoding="UTF-8"?>
<gmftool:ToolRegistry xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
<palette
title="myPalette">
<tools
xsi:type="gmftool:ToolGroup"
title="my">
<tools
xsi:type="gmftool:CreationTool"
title="B1"
description="Create new B1">
<smallIcon
xsi:type="gmftool:DefaultImage"/>
<largeIcon
xsi:type="gmftool:DefaultImage"/>
</tools>
<tools
xsi:type="gmftool:CreationTool"
title="B2"
description="Create new B2">
<smallIcon
xsi:type="gmftool:DefaultImage"/>
<largeIcon
xsi:type="gmftool:DefaultImage"/>
</tools>
</tools>
</palette>
</gmftool:ToolRegistry>
--------------040401020908030905080801
Content-Type: text/xml;
name="My.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.ecore"
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage 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" name="my"
nsURI="file://My.ecore" nsPrefix="my">
<eClassifiers xsi:type="ecore:EClass" name="A">
<eStructuralFeatures xsi:type="ecore:EReference" name="b1" eType="#//B" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="b2" eType="#//B" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="B"/>
</ecore:EPackage>
--------------040401020908030905080801
Content-Type: text/xml;
name="My.genmodel"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.genmodel"
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/de.hpi.sam.mark.test/src"
modelPluginID="de.hpi.sam.mark.test" modelName="My" importerID="org.eclipse.emf.importer.ecore"
complianceLevel="6.0" copyrightFields="false">
<foreignModel>My.ecore</foreignModel>
<genPackages prefix="My" disposableProviderFactory="true" ecorePackage="My.ecore#/">
<genClasses ecoreClass="My.ecore#//A">
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference My.ecore#//A/b1"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference My.ecore#//A/c"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference My.ecore#//A/b2"/>
</genClasses>
<genClasses ecoreClass="My.ecore#//B"/>
<genClasses ecoreClass="My.ecore#//C"/>
</genPackages>
</genmodel:GenModel>
--------------040401020908030905080801
Content-Type: text/xml;
name="My.gmfgen"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="My.gmfgen"
<?xml version="1.0" encoding="UTF-8"?>
<gmfgen:GenEditorGenerator xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gmfgen="http://www.eclipse.org/gmf/2009/GenModel">
<diagram
visualID="1000"
editPartClassName="AEditPart"
itemSemanticEditPolicyClassName="AItemSemanticEditPolicy"
canonicalEditPolicyClassName="ACanonicalEditPolicy"
iconProviderPriority="Low"
validationProviderPriority="Low">
<diagramRunTimeClass
href=" ../../../plugin/org.eclipse.gmf.runtime.notation/model/notat ion.genmodel#//notation/Diagram "/>
<elementType
xsi:type="gmfgen:MetamodelType"
editHelperClassName="AEditHelper"/>
<viewmap
xsi:type="gmfgen:FigureViewmap"
figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/ >
<domainDiagramElement
href="My.genmodel#//my/A"/>
<topLevelNodes
visualID="2001"
editPartClassName="BEditPart"
itemSemanticEditPolicyClassName="BItemSemanticEditPolicy"
canonicalEditPolicyClassName="BCanonicalEditPolicy"
graphicalNodeEditPolicyClassName="BGraphicalNodeEditPolicy"
createCommandClassName="BCreateCommand">
<diagramRunTimeClass
href=" ../../../plugin/org.eclipse.gmf.runtime.notation/model/notat ion.genmodel#//notation/Node "/>
<elementType
xsi:type="gmfgen:MetamodelType"
editHelperClassName="BEditHelper"/>
<viewmap
xsi:type="gmfgen:FigureViewmap"
figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure "/>
<modelFacet>
<metaClass
href="My.genmodel#//my/B"/>
<containmentMetaFeature
href="My.genmodel#//my/A/b1"/>
<childMetaFeature
href="My.genmodel#//my/A/b1"/>
</modelFacet>
</topLevelNodes>
<topLevelNodes
visualID="2002"
editPartClassName="B2EditPart"
itemSemanticEditPolicyClassName="B2ItemSemanticEditPolicy"
canonicalEditPolicyClassName="B2CanonicalEditPolicy"
graphicalNodeEditPolicyClassName="B2GraphicalNodeEditPolicy "
createCommandClassName="B2CreateCommand">
<diagramRunTimeClass
href=" ../../../plugin/org.eclipse.gmf.runtime.notation/model/notat ion.genmodel#//notation/Node "/>
<elementType
xsi:type="gmfgen:SpecializationType"
metamodelType="//@diagram/@topLevelNodes.0/@elementType"/>
<viewmap
xsi:type="gmfgen:FigureViewmap"
figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure "/>
<modelFacet>
<metaClass
href="My.genmodel#//my/B"/>
<containmentMetaFeature
href="My.genmodel#//my/A/b2"/>
<childMetaFeature
href="My.genmodel#//my/A/b2"/>
</modelFacet>
</topLevelNodes>
<palette>
<groups
title="my">
<entries
xsi:type="gmfgen:ToolEntry"
title="B1"
description="Create new B1"
genNodes="//@diagram/@topLevelNodes.0"/>
<entries
xsi:type="gmfgen:ToolEntry"
title="B2"
description="Create new B2"
genNodes="//@diagram/@topLevelNodes.1"/>
</groups>
</palette>
<preferencePages
xsi:type="gmfgen:GenStandardPreferencePage"
iD="de.hpi.sam.mark.test.diagram.general"
name="My Diagram">
<children
xsi:type="gmfgen:GenStandardPreferencePage"
iD="de.hpi.sam.mark.test.diagram.appearance"
name="Appearance"
kind="Appearance"/>
<children
xsi:type="gmfgen:GenStandardPreferencePage"
iD="de.hpi.sam.mark.test.diagram.connections"
name="Connections"
kind="Connections"/>
<children
xsi:type="gmfgen:GenStandardPreferencePage"
iD="de.hpi.sam.mark.test.diagram.printing"
name="Printing"
kind="Printing"/>
<children
xsi:type="gmfgen:GenStandardPreferencePage"
iD="de.hpi.sam.mark.test.diagram.rulersAndGrid"
name="Rulers And Grid"
kind="RulersAndGrid"/>
</preferencePages>
</diagram>
<plugin>
<requiredPlugins>org.eclipse.draw2d</requiredPlugins>
</plugin>
<editor/>
<navigator>
<childReferences
child="//@diagram"/>
<childReferences
parent="//@diagram"
child="//@diagram/@topLevelNodes.0"/>
<childReferences
parent="//@diagram"
child="//@diagram/@topLevelNodes.1"/>
</navigator>
<diagramUpdater/>
<propertySheet>
<tabs
xsi:type="gmfgen:GenStandardPropertyTab"
iD="appearance"/>
<tabs
xsi:type="gmfgen:GenStandardPropertyTab"
iD="diagram"/>
<tabs
xsi:type="gmfgen:GenCustomPropertyTab"
iD="domain"
label="Core">
<filter
xsi:type="gmfgen:TypeTabFilter">
<types>org.eclipse.gmf.runtime.notation.View</types>
<types>org.eclipse.gef.EditPart</types>
<generatedTypes>abstractNavigatorItem</generatedTypes>
</filter>
</tabs>
</propertySheet>
<domainGenModel
href="My.genmodel#/"/>
<contextMenus
context="//@diagram">
<items
xsi:type="gmfgen:LoadResourceAction"/>
</contextMenus>
</gmfgen:GenEditorGenerator>
--------------040401020908030905080801--
|
|
|
Re: Use same ECORE class with different creation tools [message #236253 is a reply to message #236230] |
Wed, 15 July 2009 19:19   |
Eclipse User |
|
|
|
Hi Mark,
I think that you need to set constraint on the different node, on
containment feature for instance.
Aurelien Pupier
Mark L. wrote:
> Hi,
> I have a problem using the same ECORE class with different creation
> tools. Let's assume there is a (diagram) class A, referencing class B
> twice: via EReference b1 and b2. Let's further assume there is one node
> in graphical model and two creation tools (B1 and B2) in tooling model.
> In mapping model I created the following:
> Top Node Reference
> Containment Feature: A.b1
> Element: B
> Diagram Node: Node B
> Tool: Creation Tool B1
> Top Node Reference
> Containment Feature: A.b2
> Element: B
> Diagram Node: Node B
> Tool: Creation Tool B2
> Code generation succeeds, but: If you use the B2 creation tool (in an
> newly started eclipse application), an exception is thrown (see below)
> and no B element is created.
> ------------------------------------------------
> Caused by: org.eclipse.core.runtime.AssertionFailedException: null
> argument:failed to create a view
> at
> org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
> 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: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:135)
> at
>
org.eclipse.gmf.runtime.common.core.command.CompositeCommand .doExecuteWithResult(CompositeCommand.java:403)
> ------------------------------------------------
> Using debugger, I could find the origin of the above mentioned
> AssertionFailedException. In class
> org.eclipse.gmf.runtime.common.core.service.ExecutionStrateg y
> there is a static final attribute 'FIRST' of type ExecutionStrategy,
> implementing method
> public List execute(Service service, IOperation operation)
> This method returns Collections.EMPTY_LIST, causing its caller to return
> null.
> I don't know how to proceed further. Anyway, do you have any suggestions
> how to make the example work? BTW, used models are attached to this message.
> Cheers,
> Mark
> PS. I am using Eclipse Galileo pre packaged as Eclipse Modeling Tools.
|
|
|
|
|
Re: Use same ECORE class with different creation tools [message #468486 is a reply to message #468479] |
Wed, 05 August 2009 12:11  |
Eclipse User |
|
|
|
Hi Mark
Thanks for response.
This link is exactly what I need.
I also need to alter meta model because my ECORE element doesn't have
appropriate attribute.
Also, I am not familiar with OCL syntax,
so I will try to create a Constraint with the Java syntax.
Again, thank you very much.
Sinisa
|
|
|
Powered by
FUDForum. Page generated in 0.05697 seconds