| Extending an EditHelper [message #897519] |
Tue, 24 July 2012 07:54  |
Goood Guy Messages: 96 Registered: September 2011 |
Member |
|
|
Hi,
I am implementing a synchronization mechanism in Papyrus that keeps an UML model and an ECORE model consistent.
Now I want to hook in the Delete Command so that e.g. for every UML::Class the corresponding ECORE::EClass is deleted. I saw that there is this centralized ElementEditService that access the EditHelpers. So, I tried to override the existing EditHelpers and call my own DestroyElementPapyrusCommand that deletes the EClass.
I am using this plugin.xml
<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
<metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
<metamodelType id="org.eclipse.papyrus.ext.uml.Class" name="UML::Class"
eclass="Class"
edithelper="de.upb.swt.rsdl.editor.ext.edit.commands.ClassEditHelperOverride"
kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" >
<param name="semanticHint" value="UML::Class"/>
</metamodelType>
</metamodel>
</extension>
<extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
<binding
context="org.eclipse.papyrus.infra.services.edit.TypeContext">
<elementType
ref="org.eclipse.papyrus.ext.uml.Class">
</elementType>
</binding>
<clientContext
id="org.eclipse.papyrus.infra.services.edit.TypeContext">
</clientContext>
</extension>
But the ElementEditService is still using the old ClassEditHelper.
Do I have to also override the org.eclipse.papyrus.infra.core.service extension point?
|
|
|
|
| Re: Extending an EditHelper [message #897665 is a reply to message #897522] |
Tue, 24 July 2012 22:23   |
Goood Guy Messages: 96 Registered: September 2011 |
Member |
|
|
Thank you for your reply. I tried that, but only the constructor of my Advice class is called, when I want to "Delete Selected Element" from the context menu.
Now, I am using the following plugin.xml. Actually, when I use this XML, I cannot delete messages between lifelines anymore ("Delete Selected Element" is disabled). I discovered that, because there is already an existing MessageHelperAdvice I tried out. So maybe there is a problem when you use the same elementTypeBindings or ClientContexts multiple times?
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
<binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
<elementType ref="org.eclipse.papyrus.uml.Class" />
<advice ref="de.upb.swt.rsdl.editor.ext.edit.commands.ClassEditHelperAdvice" />
</binding>
</extension>
<extension
point="org.eclipse.papyrus.infra.core.service">
<service
classname="de.upb.swt.rsdl.editor.ext.sync.UML2EcoreMappingService"
description="Stores the mapping of classes"
id="de.upb.swt.rsdl.editor.ext.sync.UML2EcoreMappingService"
priority="1"
startKind="startup">
</service>
</extension>
[Updated on: Tue, 24 July 2012 22:24] Report message to a moderator
|
|
|
|
|
| Re: Extending an EditHelper [message #903468 is a reply to message #897970] |
Thu, 23 August 2012 14:11   |
Goood Guy Messages: 96 Registered: September 2011 |
Member |
|
|
I want to synchronize Associations between Classes as well. I tried to create an AssociactionEditHelperAdvice, but I cannot get it running.
In a first step, I put some breakpoints into the classes org.eclipse.papyrus.uml.service.types.helper.AssociationBaseEditHelper and org.eclipse.papyrus.uml.service.types.helper.advice.AssociationEditHelperAdvice, but none of their methods is called when I draw an Association between two Classes.
Maybe it is because of this?
<!-- ISpecializationType Association of UML::AssociationBase -->
<specializationType id="org.eclipse.papyrus.uml.Association" name="UML::Association"
edithelperadvice="org.eclipse.papyrus.uml.service.types.helper.advice.AssociationEditHelperAdvice"
kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" >
<param name="semanticHint" value="UML::Association"/>
<specializes id="org.eclipse.papyrus.uml.AssociationBase" />
<matcher class ="org.eclipse.papyrus.uml.service.types.matcher.AssociationMatcher" />
</specializationType>
What's wrong here? Or do I have to override org.eclipse.papyrus.uml.diagram.clazz.edit.policies.ClassItemSemanticEditPolicy.getCompleteCreateRelationshipCommand(CreateRelationshipRequest) instead?
[Updated on: Thu, 23 August 2012 14:12] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01750 seconds