How to customize toolsmith property view for specific eannotations [message #1862877] |
Wed, 03 January 2024 08:39  |
Eclipse User |
|
|
|
Hello world (& happy new year! :)),
I'm still new to papyrus and EMF in general but currently struggling to get a custom property view configured. Maybe you can point me in a general direction
Goal: For a model consisting of classes (uml:Class) provide a custom property view in Papyrus (via toolsmiths) to list/add/remove custom class properties, that are encapsulated inside EAnnotation-elements.
Given: a UML2 model with custom EAnnotation for each defined class inside - unfortunately, I can't change the model to provide extensions via profiles instead of using eannotations
<xmi:XMI ...>
<uml:Model ...>
<packagedElement xmi:type="uml:Package" xmi:id="_0HUGyILcEe6K1ah3x0SgcA" name="mypackage">
<packagedElement xmi:type="uml:Class" xmi:id="_0HVcLILcEe6K1ah3x0SgcA" name="MyClass">
<eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_0HVcLYLcEe6K1ah3x0SgcA" source="custom properties">
<details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_0HVcLoLcEe6K1ah3x0SgcA" key="key1" value="value1"/>
<details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_0HVcL4LcEe6K1ah3x0SgcA" key="key2" value="value2"/>
</eAnnotations>
</packagedElement>
</packagedElement>
...
Now, my first approach was to have a look at the user guide on how to customize the view. As described, I copied the "UML metamodel" over and edited the view/SingleClass to contain an additional Composite and PropertiesLayout (type = Property Editor Type Multireference).
Now I'm stuck at extending and providing the data-context to actually access the EAnnotation-elements mentioned above. I had a look at the current SingleClass.xwt and it will come down to something like this:
<ppe:MultiReference input="{Binding}"
property="UML:EAnnotation:custom properties"
customLabel="custom properties"></ppe:MultiReference>
... but I don't get the connection between the definition of data-contexts and the actual reference to the model itself. According to the docs I would be able to create a custom modelfactory and implement things myself. But as far as I understood, this should be possible without coding as well ...
So my questions are somewhat like
- can I get this done with my current approach using customized property views at all?
- if so, is it possible without coding my own ModelElement Factory?
- if this goes down without advanced customization via coding, how do I connect my view to the model structure mentioned above (is there some xpath-expression, OCL or similar)?
Any help or reference to documentation is highly appreciated,
Thanks in advance & kind regs,
Max
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.12603 seconds