# Papyrus-SiriusDiag Integration Introduction

This part of the documentation deals with features provided by the integration to Papyrus.

For a better experience, you should activate the Papyrus Perspective before reading this documentation.

# How to create a new Sirius Diagram in my UML model

Once a UML model is created, go into the Model Explorer, select a UML element from which to start the document, then Right-Click-> New Class Diagram.

The corresponding sirius diagram is opened inside Papyrus.

Or from the View Explorer, click on the create view, select the root element and finally the view to create.

# How to show/hide Sirius Diagram in the ModelExplorer

The created DSemanticDiagram are displayed in the ModelExplorer as children of the element . This customization is not loaded by default.

Open the Model Explorer view and use the customize model explorer to load the Sirius Diagram customization:

# How to use sirius diagram

## Sirius diagram

To have a global overview of sirius diagram. You can have a look at the sirius diagram documentation. See https://www.eclipse.org/sirius/doc/user/diagrams/Diagrams.html

While most part is similar to the former GMF diagram. There are some small differences between both.

Sirius Diagram provides a synchronization mechanism. The user can Synchronize/Unsynchronize each diagram using the contextual menu.

In addition, Sirius is able to display the status (Synchronized/Unsynchronized) of the diagram in its bottom right corner.

NB: At the startup, Papyrus activates these two Sirius preferences: - new diagram are unsynchronized - the diagram status is displayed for the new diagram

The Unsynchronized status:

The synchronized status:

### Layers

Layers can be defined to hide or show several mapping and/or several tools in the palette in a diagram. We also use this feature to show/hide applied stereotypes and qualified name in the labels of the elements displayed in the diagram.

# Common

## Palette tools

Palette tools is divided in two categories, one for the creation of element represented has nodes and the other for the creation of edge elements.

## Drag and drop from explorer

Drag and drop tools have been implemented to allow to create views for existing element that are not represented yet in the diagram.

## Drag and drop inside diagram

Drag and drop inside diagram is also available, but depending of the kind of element that is drag and drop, the behavior can be different.

When the Drag and Drop of a Node or BorderNode is authorized on a NodeContainer or Node, the target appears highlighted. Otherwise, if Drag and Drop is not authorized for a Node or BorderNode, the target NodeContainer or Node is not highlighted. For BorderNodes, the phantom of the moved graphical element always appears on Drag and Drop compatible zones (i.e. the border of a NodeContainer or Node), but this does not mean that Drag and Drop is possible if the target element is not highlighted.

On the left image, Drag and Drop is allowed. On the right, Drag and Drop is not allowed.

## Deletion (from diagram or model)

To delete element from diagram only, user selects first the element on diagram to remove and then he can click on "Delete from Diagram" button in the toolbar. This button is only available when diagram is unsynchronized. To delete element from model, user selects first the element to remove and then he can click on "Delete from Model" button in the toolbar. The element will be removed semantically and from diagram whatever activated synchronize mode.

Deletion of graphical element (only the view, not the semantic element) can be done using the shortcut (SHITF + DEL)

Deletion from the model can be done using a simple delete with DEL key.

## Show / Hide

Using the shortcut CTRL + H, you can simply show or hide and element from the diagram.

## Diagram Synchronization with the ModelExplorer

When the user selects an element in a Sirius Diagram, this element is selected in the Papyrus ModelExplorer.

## Diagram Synchronization with the Property View

When the user selects an element in a Sirius Diagram, the property view of this element is displayed.

## ModelExplorer Synchronization with a Papyrus Sirius Diagram

When the user selects an element in the ModelExplorer, if the open Diagram contains a graphical representation of this element, this one is selected.

## Pin / Unpin

Pinning an element makes it protected from any action which can modify the position of this element in the diagram, such as arrange all.

## Xtext

Xtext autocompletion is available when renaming an element using direct edition with F2 shortcut. When using Ctrl + Space key, the auto completion tool propose a list of label to use.

## Rotative Images

Rotative images can be applied to Bordered Nodes. These Bordered Nodes use an image whose orientation depends on the position of the Bordered Node regarding its parent Node or Container. For example, with the InputPin and OutputPin on the Activity diagram, the arrow image used in these Bordered Nodes rotates according to the North/South/East/West position of the Bordered Node.

## Popup Bar

Since Sirius 7.2.0, the popup bar is now displayed when the mouse is hover a diagram element. This popup displays available tools for this specific element.

# Activity Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

- Label of UML element with the isAbstract feature set to true is displayed in italic
- On the Sirius ActivityDiagram, when creating an ActivityPartition in an Activity, the partition is added in the Activity#partition feature of the Activity. This feature is a subset of the Activity#OwnedGroup containment feature.
- An AcceptEventAction is represented with an hourglass when it has exactly one Trigger that references a TimeEvent in its Trigger#event feature.

#### Pins

Here are some specific behavior about the Pin in the Sirius based ActivityDiagram:

- The Pin creation tool is deactivated if several containment features are possible to own the Pin.
- On an UML element, if the feature multiplicity is [0..1] or [1..1] or [1..*], a Pin is created at the same time as the element creation.
- The Pin name is set with the name of the feature, if the feature is [0..1] or [1..1].

#### Graphical Container

Some containers do not contain semantically their graphical nodes. This is the case for `ActivityPartition` and `InterruptibleActivityRegion`.

ActivityNodes contained in those containers are owned by the first parent `Activity`.

#### Decision Node

A note attached to the `DecisionNode` is displayed when the `DecisionNode#decisionInput` feature is set.

Note that when deleting the `DecisionNode` from the diagram, the note might still be present. Indeed, the delete from diagram action does not trigger the refresh of the diagram.

You need to manually perform the refresh to make the note disappear (F5 or the refresh tab-bar button).

## Edge creation

Edges are allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

Same rules as for the Composite Structure diagram are used here.

- Border nodes in general cannot be drag and dropped. (Pin, ExpansionNode, ActivityParameterNode)

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. No specific cases have been implemented here.

## Reconnection

Same rules as for the Composite Structure diagram are used here.

# Class Diagram

## Features

- Label of UML element with the isAbstract feature set to true are displayed in italic
- Label of UML element with the isStatic feature set to true are underlined.

### UML::Property

- Specific menu to create a default value on a UML::Property from the diagram

- Specific menu to delete a default value on a UML::Property directly from the diagram

# Communication Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

- Label of UML element with the isAbstract feature set to true is displayed in italic
- Label of Lifeline which represent a Property will display the Property name instead of the Lifeline name.

## Edge creation

- Edges are usually allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

- Messages can only be created between Lifelines and the message orientation is displayed with a target arrow on the edge.

- Links can only be created to link a Comment or Constraint to an other element.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

No graphical drop is authorized on this diagram because there is no Container node.

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. Some specific cases have been implemented:

- A Type can be drag and drop on the Interaction root of the digram. A new Property will be semantically created and this Property will be typed with the Type. Then a Lifeline will be semantically created and this Lifeline will represent the new Property (feature represents is used). Finally, the node to represent the Lifeline will be created on the Interaction root of the diagram.
- A Property can be drag and drop on a Lifeline node. Then, the Lifeline will represent this Property (feature represents is used).
- A Type can be drag and drop on a Lifeline node. A new Property will be semantically created and this Property will be typed with the Type. Then the Lifeline will represent the new Property.

## Reconnection

Same rules as for the Composite Structure diagram are used here.

# Component Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

- Label of UML elements with the isAbstract feature set to true are displayed in italic
- Label of Properties with the isStatic feature set to true are underlined.
- Label of Ports with the isConjugated feature set to true are displayed with "~" as prefix.
- Properties in Components with the aggregation feature set to AggregationKind::shared are displayed with a dashed border.
- Interfaces have a "receptions" compartment to store Reception elements.
- Connector edges are represented with cardinalities, as in the Composite Structure diagram.

## Edge creation

- Edges are usually allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

Same rules as for the Composite Structure diagram are used here.

- Ports cannot be drag and dropped on another container (like Border nodes in other diagrams)

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. Some specific cases have been implemented here:

- Type can be drag and drop on Property or Port to type its associated semantic element.
- Property/Port contained in Type can be drag and drop on Property/Port typed by this Type.

## Reconnection

Same rules as for the Composite Structure diagram are used here.

# Composite Structure Diagram

## Representation

### Label

Keywords on Node and Edge are displayed in the first separate line of the label. If the semantic element is stereotyped, the stereotype is displayed in a second separate line (only when the stereotype layer is activated). Finally, the internationalized label will be displayed on the third line. The internationalized label displayed can be the qualified label if the corresponding layer is activated. It also can be the simple name of the element if there is no internationalized label and for specific case, the label can be more complex. For example, on Property, the label can contain Direction and name and type.

Each created NamedElement is automatically named. Strategy used to build the name of new element is the same than the third option in Papyrus preference naming strategy called "Unique index". The name convention forces a unique index by looking at all the contents of the current parent and looking for all elements that have the same name without the suffix (i.e. name of the Metaclass to create without any number). Finally the name of the new element is given by its Metaclass name suffixed by the number of element with the same name incremented by one.

### Specific Features

- Label of UML element with the isAbstract feature set to true is displayed in italic
- Label of UML element with the isStatic feature set to true is underlined.
- Label of Port with the isConjugated feature set to true is displayed with "~" as prefix.
- Property Node with feature aggregation equals to shared is represented with a dash line border.

## Edge creation

Edges are allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

If a user want to drag and drop a graphical element in another one, he has to select an element on the diagram and drag and drop it in a new element.

General rule for graphical drag and drop is the following one.

You can drag and drop an element in a new container where the drag and drop element type is accepted as a child of the new container. For example, you can drag and drop an Activity from its container into Classifier or Package.

Some specific cases have been implemented :

- Property can only be drag and drop on Structured Classifier or typed Property,
- Ports are not authorized to be drag and drop,
- Comment can only be drag and drop on an Element different from a Comment.

## Semantic Drag and Drop

If a user want to drag and drop an element from the model explorer view on the diagram, he has to select the element from ModelExplorer view and drag and drop it into its container Node in the diagram (no semantic modification). Semantic drag and drop will always be authorized in its container representation except for specific case :

- Type can be drag and drop on Property or Port to type its associated semantic element.
- Collaboration can be drag and drop on CollaborationUse to type its associated semantic element.

Semantic drag and drop of Edge will drag and drop Edge on diagram if it does not already exist. If source Edge or target Edge or both are not represented on diagram, source and/or target will be drag and drop too.

## Reconnection

To reconnect an Edge, users can click on the source or target of the Edge to reconnect and drag and drop this end Edge on a new element. If the new source or target is an element represented with a compartment, the user can drag and drop the end Edge on the compartment of the element or on the header of the element, reconnection will work in both cases.

## Representation loop on typed property

On a synchronized diagram, it is possible to create infinity representation loop on property typed with its container directly or indirectly. Indeed, on property typed in synchronized diagram, content of the type is represented in the property. So if a port is type by its container, the port is represented on the port and so on.

To avoid this configuration, every Node detected in the infinity loop will not be represented and an error message will be display in the Error Log.

This message warn user that "A potential infinity loop has been detected: The port XXX is typed by XXX which directly or indirectly references XXX through ports type hierarchy."

# Deployment Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

- Label of UML elements with the isAbstract feature set to true are displayed in italic

## Edge creation

- Edges are usually allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

Same rules as for the Composite Structure diagram are used here.

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. No specific cases have been implemented here.

## Reconnection

Same rules as for the Composite Structure diagram are used here.

# Package Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

## Edge creation

- Edges are usually allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

- Links can only be created to link a Comment or Constraint to an other element.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

No graphical drop is authorized on this diagram because there is no Container node.

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. No specific cases have been implemented here.

## Reconnection

Same rules as for the Composite Structure diagram are used here.

# Profile Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

- Label of UML element with the isAbstract feature set to true is displayed in italic

## Edge creation

Edges are allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label. It is not possible to activate the direct edit on an imported metaclass.

## Graphical Drag and Drop

Same rules as for the Composite Structure diagram are used here. No specific cases have been implemented here.

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. No specific cases have been implemented here.

## Reconnection

Same rules as for the Composite Structure diagram are used here. When reconnecting an Extension target to another Class, the Stereotype property type is updated.

# Sequence Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

We describe here some specific features. For other features, see the sections below for more details.

- The Sequence Diagram is always Synchronized with the semantic model.
  - If a second Sequence diagram is created on the same interaction, the elements ordering will be the same. Only the layout can be different (gapes, heights etc.).
- Some ordering information are stored in the root Interaction element. If the Interaction model is modified externally (out of the Sequence Diagram) by adding or removing elements, the ordering cannot be guaranteed.

It is highly recommended to avoid direct model modifications (adding or removing elements) out of the Sequence Diagram (by using the Model Explorer for instance).

## Node creation

- Executions are created by applying the tool on a lifeline.
- CombinedFragment can be created by applying the tool on a target lifeline or by a click + drag on a whole area to cover several lifelines.
- Time Constraints and Time Observations can be created by selecting the event end where it should be created. Only one TimeConstraint or TimeObservation can be created by event end.

## Edge creation

In the sequence diagram, messages are allow between lifeline and executions. Messages can be recursive on the same execution or lifeline.

- We can create a synchronized message on an existing execution by selecting its start area:

- Lost and Found messages are created by selecting the send or receive event location on a lifeline or an execution.
- Create and Delete messages are created by selecting the send event location first and then the target lifeline.
- The DurationConstraint and the DurationObservation can be created by selecting two event end. If the two event end belongs to the same fragment, the duration is represented by a label and a simple edge toward the element. Otherwise, it is represented by a bracket edge.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

- Only Comment and Constraint can be graphically drag and drop.
- Executions can be moved within or out of a CombinedFragment but cannot be dropped on another lifeline.

Note: An execution with at least one message connected cannot be moved. With this restriction, we avoid complex reordering issues.

- Messages can be moved vertically, and thus, be connected to another execution for instance.

## Semantic Drag and Drop

The Sequence diagram allows to drop a Property or a Class from the semantic explorer on the diagram.

- If a Property is dropped on a Lifeline, the `lifeline#represents` feature is set with the dropped property.
- If a Class is dropped on a Lifeline, a Property is created and typed with the dropped Class. The `lifeline#represents` feature is set with the created property.
- If a Class or a Property is dropped on the diagram blank, the LifeLine is created and the `lifeline#represents` feature is set as described above.

## Reconnection

- A message can be moved vertically (in this case, it is an event reordering). A message end (send or receive) cannot be reconnected.
- A Link edge can be reconnected to another element or another Comment or Constraint.

# Use Case Diagram

## Representation

### Label

Same format as for the Composite Structure diagram is used here.

### Specific Features

- Label of UML element with the isAbstract feature set to true is displayed in italic

## Edge creation

Edges are allowed between Nodes with their type matching the correct type of source and target. If Edge is not authorized, a forbidden decorator will appear. It is not possible for now to create an edge between two Edges or between an Edge and a Node.

## Direct Edit

DirectEdit on this diagram only authorizes to edit the name of the element on which DirectEdit tool is activated. Remember that direct Edit can be launched with F2 key or double click on label.

## Graphical Drag and Drop

Same rules as for the Composite Structure diagram are used here.

Some specific cases have been implemented :

- Actors are not authorized to be drag and drop into Subject, Subject can only contains UseCase
- when UseCase is drag and drop inside Subject, subject feature of UseCase is updated with its new Subject container and feature ownedUseCase of the Subject Container is filled with the UseCase
- when UseCase is drag and drop outside of Subject, the former Subject container is removed from the subject feature of UseCase and the UseCase is removed from the ownedUseCase feature of the former Subject container.

## Semantic Drag and Drop

Same rules as for the Composite Structure diagram are used here. No specific cases have been implemented here.

## Reconnection

Same rules as for the Composite Structure diagram are used here.