Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » CSS reference element selector
CSS reference element selector [message #1834001] Thu, 29 October 2020 18:48 Go to next message
Christoph Lehr is currently offline Christoph LehrFriend
Messages: 24
Registered: June 2020
Junior Member
Hi all,

I'm trying to write a CSS selector for accessing a child member of a Reference. As I prior never worked with CSS I don't really know how the selectors work/work inside Papyrus.

I have a Stereotype called Reference applied to a Generalization. This stereotype has a member called referenceType which is of ReferenceType and based on the used ReferenceType I want to change the visuals of the Generalization, e.g. if "isSymmetric" is set to true, there shall be arrows on both sides.

I managed to access the members of Reference but not of the referenced ReferenceType.

Here https://wiki.eclipse.org/MDT/Papyrus/UserGuide/CSS#Selector_properties is written that I should be able to access the reference, but I don't really understand how.
Quote:
References to named elements (UML NamedElement or Ecore ENamedElement): [type=String]


I found the following forum post but I don't understand it https://www.eclipse.org/forums/index.php?t=msg&th=664574&goto=1278528&#msg_1278528

Optionally I want to display text which is stored inside a ReferenceType on the Generalization, is this somehow possible?

Thanks for your help.
BR Christoph

[Updated on: Thu, 29 October 2020 18:52]

Report message to a moderator

Re: CSS reference element selector [message #1834013 is a reply to message #1834001] Fri, 30 October 2020 08:05 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Christoph,

CSS don't support properties navigation as any programming language would. You can only check the value of one property at a time. In Papyrus, we added some support for references to NamedElements, but that's limited to one level.

For example, if you have a Property typed with a Class named String, you can write the following rules:

Property[isStatic=true]{ // Standard primitive types
...
}
Property[type=String]{ // References to NamedElements
...
}


However, you can't write rules that require navigating the references, such as:

Property[type.isAbstract=true] { // Any property typed with an abstract classifier
// Not a valid rule
}


There are a few cases where we implemented custom properties to workaround this issue, such as the "typeAppliedStereotypes" which can be used to test that a specific Stereotype is applied to a Type, from a TypedElement (e.g. Property); but this isn't really recommended:

Property[typeAppliedStereotypes=Block] { // A Property typed with a Classifier that is stereotyped with a Block.
// Valid rule, but requires custom implementation of the typeAppliedStereotypes property
}


Quote:
Optionally I want to display text which is stored inside a ReferenceType on the Generalization, is this somehow possible?


This is beyond the scope of CSS; you would have to extend the Diagram(s) for that.

HTH,
Camille


Camille Letavernier
Re: CSS reference element selector [message #1834015 is a reply to message #1834013] Fri, 30 October 2020 08:48 Go to previous message
Christoph Lehr is currently offline Christoph LehrFriend
Messages: 24
Registered: June 2020
Junior Member
Hi Camille,

thanks for you answer.
Then I will have to find some workaround on providing the data to the stereotype application.

Quote:

This is beyond the scope of CSS; you would have to extend the Diagram(s) for that.


Is there a way to display anything on a generalization except in comments?

As a workaround I try to only view certain stereotype members in the comment. Is it possible to write a CSS selector which only applies to Comments of Generalizaitons?

Thanks for your help

[Updated on: Fri, 30 October 2020 10:03]

Report message to a moderator

Previous Topic:Custom shape not shown
Next Topic:Custom builder in Papyrus-based RCP won't run
Goto Forum:
  


Current Time: Thu Apr 25 17:09:27 GMT 2024

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

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

Back to the top