Skip to main content



      Home
Home » Modeling » Papyrus » How to customize toolsmith property view for specific eannotations
How to customize toolsmith property view for specific eannotations [message #1862877] Wed, 03 January 2024 08:39 Go to next message
Eclipse UserFriend
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
Re: How to customize toolsmith property view for specific eannotations [message #1862890 is a reply to message #1862877] Thu, 04 January 2024 09:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi Maximilian,

also a Happy New Year from me!

Concerning your question: the property view does not support EAnnotations out of the box. I think you can pass by a ModelElementFactory in your case, but I'm not really sure. In any case, you need to provide this factory in an additional plugin that defines suitable extension points and code. An example of such a factory can be found in the plugin [1] as part of the customization Papyrus for Robotics. In the robotics case, the StereotypeModelElementFactory gets overloaded. As already said, I'm not sure, if you can use it also in your case but it might be worth a try.

HTH

Ansgar

[1] org.eclipse.papyrus.robotics.properties
Re: How to customize toolsmith property view for specific eannotations [message #1862899 is a reply to message #1862890] Fri, 05 January 2024 02:43 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ansgar,

thanks for the hint! I'll have a look at the source and report back with my findings.

Cheers,
Max
Re: How to customize toolsmith property view for specific eannotations [message #1863399 is a reply to message #1862899] Wed, 31 January 2024 05:53 Go to previous message
Eclipse UserFriend
Short rapport: In the meantime I handed the project over to a colleague, including a skeleton of the solution via ModelElementFactory.
Not sure, whether he will actually walk this path further or rather refactor the original model to use stereotype-extensions to achieve a solution in a more standardized way.

Anyhow, thanks again!
Previous Topic:Question about importing from spreadsheets
Next Topic:[SW Designer and Robotics] Move to gitlab
Goto Forum:
  


Current Time: Fri Jul 18 04:31:02 EDT 2025

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

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

Back to the top