Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Different property view for Association:memberEnd
Different property view for Association:memberEnd [message #1465345] Sat, 08 November 2014 08:51 Go to next message
Emilio Dolce is currently offline Emilio DolceFriend
Messages: 10
Registered: November 2014
Junior Member
Surfing thru the papyrus project flexibility I have no more limit to ask!

Is there a way to bind a different ViewEditor for each member end of an association?
Actually I have the same view for each side like this:

<ppe:ViewEditor numColumns="2" view="MiceGenProfile:MemberEnd"
input="{Binding}" property="UML:Association:memberEnd"/>

I wish to obtain something like this:
<ppe:ViewEditor numColumns="1" view="MiceGenProfile:MemberEndParent"
input="{Binding}" property="UML:Association:memberEnd[0]"/>
<ppe:ViewEditor numColumns="1" view="MiceGenProfile:MemberEndChild"
input="{Binding}" property="UML:Association:memberEnd[1]"/>

Many thanks again.
Re: Different property view for Association:memberEnd [message #1470602 is a reply to message #1465345] Wed, 12 November 2014 13:23 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 926
Registered: February 2011
Senior Member
Hi Emilio,

There is no specific support for manipulating indices in the properties view (Especially because UML Associations can have more than 2 ends). However, the properties view framework can be used to emulate "derived" properties for associations (e.g. memberEnd1 and memberEnd2), which can then be used as any other real property in the properties view editor. It can be a little bit tricky to setup, because you cannot directly modify the Papyrus source code; so there are a few indirections to add:

- Create a new DataContextRoot in the Properties view configuration (e.g. ExtendedUML)
- Create a new DataContextElement (Association)
- Create 2 properties (memberEnd1 and memberEnd2)

Then you need to associate your own ModelElementFactory + ModelElement implementation, to tell the properties view how to (semantically) handle these new properties. To do that, see the help in Papyrus (F1 > Contents > Papyrus Guide > User Guide > Properties view customization), and see the chapters Environment model/Model Element/Model Element Factory

That's a lot of steps to properly configure it (Environments and ModelElements could really be simplified...), but once it's done properly, the properties can be manipulated as if they were actual Metamodel properties, and you have a fine granularity to implement their semantics in the ModelElement (Getter/Setter, Editable/Read-only, Content/Label providers for references, etc.). And most of the time, you only need one ModelElement/ModelElementFactory for any number of derived properties


Camille Letavernier
Previous Topic:Open diagram programmatically
Next Topic:Property view value change listener to trigger custom actions
Goto Forum:

Current Time: Fri Jul 10 10:29:21 GMT 2020

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

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

Back to the top