Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Papyrus/Mars Work Description/Improvments/Stereotype support
Contents
Enhancement of the support for the stereotypes in Papyrus
This page presents the improvments that will be pushed in the Mars version of Papyrus regarding the stereotypes support in the tool.
Introduction
The starting point of this study is due to concomitant issues around the stereotype display:
- The first whished improvement is to display the stereotypes when dragged and dropped from the model explorer.
- The second whish would be to use the Named Styles instead of EAnnotation in order to be aligned with the Papyrus point of view and be based on GMF layer.
- The third point is the user interface to display the Stereotype that doesn’t fulfil the user expectation in terms of intuitiveness.
State of art
Requirements ( Draft )
Req ID | Category | Description |
---|---|---|
STO_01 | Default display | The stereotypes are display by default (during the creation, when DnD, when applied). |
STO_02 | New Stereotype | The stereotypes displayed should be automatically updated when applied stereotypes list changes or property value changes. |
STO_03 | Qualified Name | Each Stereotype can be either displayed with a short name or with the Qualified Name. |
STO_04 | Qualified Name | The displayed qualified name depth can be defined for each stereotype. |
STO_05 | Location | Properties can be displayed in a compartment, in a comment and/or between braces. |
STO_06 | Location | The user should be able to choose the location of each stereotype's property (In compartment, in braces, as a comment). |
STO_07 | Hide | Each stereotype and property can be displayed or hidden independantly. |
STO_08 | CSS | Visibility, qualified name depth and location can be defined by CSS. |
STO_09 | CSS | A CSS file can be added for each Stereotype to manage its display. |
STO_10 | Qualified Name | The user must be able to chose the depth of the QN to be displayed |
STO_11 | Qualified Name | The user should be able to chose if the Qualified Name depth is calculated automatically. |
STO_12 | Qualified Name | The user should be able to chose if the Qualified Name is fully displayed or not at all. |
Solutions
Solution Implementation
Architecture
Technically, the DecorationNode will be extended to create StereotypeLabel element into notation file. As well as for the stereotype properties.
Notation Model Structure
Structure into Notation file would be:
DecorationNode[type=StereotypeLabel][stereotype ="SysML::Allocations::Allocated"] BasicCompartment[type=StereotypeCompartment][stereotype="SysML::Allocations::Allocated"] DecorationNode[type=StereotypeProperty][property ="allocatedFrom=0..*" ] DecorationNode[type=StereotypeProperty][property ="allocatedTo=0..*" ] BasicCompartment[type=StereotypeBrace][stereotype="SysML::Allocations::Allocated"] DecorationNode[type=StereotypeBraceProperty][property ="allocatedFrom=0..*" ] DecorationNode[type=StereotypeBraceProperty][property ="allocatedTo=0..*" ]
Structure for the stereotype name Label:
DecorationNode (type = StereotypeLabel) stereotype(String: "SysML::Allocations::Allocated") element(Stereotype: "SysML::Allocations::Allocated") depth (String: None, Full, Auto, -1,-2,-3,...)
Structure of the property (to be defined):
BasicCompartment (type = StereotypeCompartment) stereotype(String: "SysML::Allocations::Allocated") element(Stereotype: "SysML::Allocations::Allocated") DecorationNode (type = StereotypeProperty) element( UML Property : AllocatedFrom )
EditPolicies Hierarchy
Here is the Class diagram that could be the solution for the new architecture:
Legend:
- AS = AppliedStereotype
- green block = new
- red block = modified
- blue block = not changed
To be completed
Intermediate Objectives
To plan the several steps of this whole improvement, it will be splitted into sub-goals.
All the objectives will be first fulfill for the Named Elements (like the Classes, Packages, ...) Once the new structure in place for those elements, it will be done for the other types of elements.
- Objective 1: Display all the stereotypes thanks to DecorationNode with one Label by stereotype.
- Objective 2:
- 2a. Hide stereotypes thanks to CSS.
- 2b. Display Qualified Name of some stereotypes thanks to CSS.
- Objective 3: Display all the properties into the compartment thanks to the DecorationNode into the notation file.
- Objective 4:
- 4a. Hide the properties thanks to the CSS
- 4b. Display properties into braces thanks to the CSS
- 4c. Display properties into comment thanks to CSS.
- Objective 5: Create the graphical user interface into the Appearence Tab
- Objective 6: Propage objectives 1 to 5 to the other element throught their own edit policied.
- Objective 7: Plan a model transformation for a compatibility with old models using EAnnotation.
The following section details the progression of each Objective.
Objective 1
- Display all the stereotypes thanks to DecorationNode with one Label by stereotype. (Done)
To fulfill this objective, the following steps should be completed:
- Create and Delete StereotypeLabel through a Recording Command
- Create / Delete objects when stereotype is applied or deleted.
- Display the Label through the different EditPolicies
- For Node Label: AppliedStereotypeNodeLabelDisplayEditPolicy
- Delete all usage of EAnnotation for the Stereotypes (Optionnal at this stage)
- In Progress
Note: Done , means that the task is done but not already comitted. The entire Objective 1 will be committed at once when completed.
Objective 2
- 2a. Hide stereotypes thanks to CSS (Done)
- Manage the isVisible parameter into the display of the Stereotype Label
- Edit the CSS DOM Tree to match the NamedStyle Value
- 2b. Display Qualified Name of some stereotypes thanks to CSS (Done)
- Manage the QualifiedName depth into the display of the Stereotype Label
- Retrieve the "depth" value from the CSS
Objective 3
- Display all the properties into the compartment thanks to the DecorationNode into the notation file.(Done)
- To fulfill this objective, the following steps should be completed:
- Create and Delete StereotypeProperty through a Recording Command
- Create / Delete objects when stereotype is applied or deleted.
- Display the Properties through the different EditPolicies
- For Node Label: AppliedStereotypeNodeLabelDisplayEditPolicy
Objective 4
- 4a. Hide the properties thanks to the CSS (Done)
- Modify the CSS DOM tree to match the NamedStyle Selectors For "StereotypeProperty".
- Catch the CSS value to hide the corresponded Property.
- Modify the CSS DOM tree to match the NamedStyle Selectors For "StereotypeCompartment".
- Catch the CSS value to hide the corresponded Compartment.
- Encountered issues:
- StereotypeProperties Labels are not created when CSS doesn't show the compartment
- Solution: Notify "AppliedStereotypePropertyEditPolicy" when stereotype is applied. Using StereotypeElementListener instead of PapyrusStereotypeListener
- Error when refresh figure with an empty Property textFlow
- Solution: Add condition on Text value during TextFlow creation into the AppliedStereotypeMultilinePropertyEditPart
- StereotypeProperties Labels are not created when CSS doesn't show the compartment
- Encountered issues:
- 4b. Display properties into braces thanks to CSS.(Done)
- Add The Location NamedStyle into Notation File
- Catch the CSS Value for the Location
- Calculate the New Text to display with Braces
- 4c. Display properties into a comment thanks to CSS.(Done)
- Create the Comment Object.
- Create the link between Comment and EditPart
- Calculate the text to display into the Comment
- Manage CSS property to display or hide properties into Comment
- Edit the Comment text content with the new text value
- Update Content when Stereotypes Applied or unapplied
- Delete Comment when empty
- Encountered issues:
- CSS application have unstable behavior.
- When a compartment is empty, the only way to not show it is to use the CSS attribute visible:false;
- To be able to Hide Brace Properties independently of Compartment Properties, the Properties Structure should be dupplicated for Brace Properties
- To manage several Stereotype Application, the related Element of the node should be the Stereotype and not it's application
- Encountered issues:
Objective 5
- Create the Graphical Interface to display Labels and Properties to override the CSS.
- 5a. Create the graphical user interface into the Appearence Tab
- 5b. Add the selection tree with appropriate collumn
- 5c. Add combo box with QN choices
- 5d. Add Tree commands to Expand / Collapse
- 5e. Add Tree commands to Select All / Deselect All
- 5f. Add Management rules (to be defined )
Objective 6
- Propage objectives 1 to 5 to the other element throught their own edit policied.
- For External Node : AppliedStereotypeExternelNodeEditPolicy
- In Progress
- For External Node label: AppliedStereotypeExternelNodeLabelEditPolicy
- In Progress
- For Icon: AppliedStereotypeIconDisplayEditPolicy
- Not Started
- For Link Label: AppliedStereotypeLinkLabelDisplayEditPolicy
- Done
- For External Node : AppliedStereotypeExternelNodeEditPolicy
Objective 7
- Plan a model transformation for a compatibility with old models using EAnnotation.
Open Points and Lessons learned
Open Points
- How an EditPolicy can be called when the Refresh (F5) of the EditPart is executed? It is required to refresh visual after applying a CSS.
- It appears that the super Class GraphicalEditPolicy doesn't implement a refresh method, contrary to the internal class GraphicalEditPolicyEx
- But this class is internal to GMF, so how make the refresh working for the Papyrus editPolicies.
- What are the general Use Cases for this new feature?
Lessons learned
- How a CSS selector can match on Notation Element likes [type="StereotypeLabel"] where "StereotypeLabel" is the type of a DecorationNode.
- Clue : The class CSSDOMSemanticElementHelper defines rules to match the sementic Element of a notation view.
- How to define the way the CSS selector match elements?
- Clue: The method doGetAttribute in the class GMFUMLElementAdapter return the corresponding element.
Tasks and Bugs
Tasks
The bugzilla items tracking progress of this improvments are:
- Task 455311 : General task for the developpement activity
- Task 460255 : Sub task for Objective 1
- Task 460259 : Sub task for Objective 2a
- Task 460264 : Sub task for Objective 2b
- Task 460271 : Sub task for Objective 3
- Task 460273 : Sub task for Objective 4a
- Task 460274 : Sub task for Objective 4b
- Task 460356 : Sub task for Objective 4c
Bugs
- Bug 457024 : Head Task for regrouping all the other ones.
- Bug 461559 : Brace Notation structure in addition
- Bug 461561 : Stereotype Element instead of Application itself.
Commit and Reviews
- Change 1 : 41903
- Reviewed Internally: Done
- Merged with Sub-Branch: Done
- Reviewed Externally: None
- Merged with Master: None
- Change 2 : 42108
- Reviewed Internally: Done
- Merged with Sub-Branch: Done
- Reviewed Externally: None
- Merged with Master: None
- Change 3 : 43177
- Reviewed Internally: Done
- Merged with Sub-Branch: Done
- Reviewed Externally: None
- Merged with Master: None
- Change 4 : 43940
- Reviewed Internally: In Progress
- Merged with Sub-Branch: Not Done
- Reviewed Externally: None
- Merged with Master: None