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.
Difference between revisions of "Papyrus/Papyrus User Guide"
(→Create constraints) |
(→Create and edit constraints) |
||
Line 140: | Line 140: | ||
</center> | </center> | ||
− | * Within the Model Explorer via right clicking a model element and then selecting New Child | + | * Within the Model Explorer via right clicking a model element and then selecting New Child -> Create a new Constraint. The context is automatically set to the parent of the constraint. The context can be changed via the Properties View if required.<br> |
<center> | <center> |
Revision as of 16:46, 15 May 2014
Contents
- 1 Using UML modeling editors
- 2 Developing custom DSL based editor with Papyrus
- 3 Additional Utilities of Papyrus
Using UML modeling editors
UML modeling
Getting Started
Papyrus Perspective
The Papyrus perspective contains :
- Model Explorer view
- Outline view
- Multi diagram editor view
- Properties view
- Toolbar
Model Explorer View
The model explorer is used to navigate to the all model's elements and the diagrams.
This action link the model explorer with the active diagram selection. This action works bidirectionally.
This action allow to add new semantic element.
This action allow to add new diagram in current selection.
All actions are available on diagram item.
The model explorer used Common Navigator Framework and provide facilities to customize view.
To customize the content of treeViewer:
To filter the content of treeViewer:
Outline View
The Outline offers a thumbnail of the graphical representation and the list of semantic elements used in current diagram.
Tutorials on UML modeling with Papyrus
Model/Diagram creation wizard
Create a new Model.
Choose the model file name and the first diagram to create.
Create a diagram from an existing uml file
From your uml file, select the "Initialize Papyrus diagram" to access the creation wizard of Papyrus. Your Papyrus diagram will be linked with your existing model.
Apply a static profile
- 1 - Select a package element (ie a Model or a Package).
- 2 - Select the tab "Profile" on the "Properties" view
- 3 - Click on the plug-in icon
- 4 - Select your static profile
- 5 - Choose profiles to apply
Load an additionnal resource
Show additional resources in your model explorer view
Ensure that the filter for the additional resources is not checked on your model explorer view :
Add an additional resource
Right click on an element of your model and select the menu "Load resource..."
Table Documentation
See http://wiki.eclipse.org/Papyrus_User_Guide/Table_Documentation
Papyrus Zoo of UML Models
Composite Structure Diagram
The project is available here [1]
Constraints in Papyrus
Create and edit constraints
Define a constraint and its context Papyrus supports the creation of UML constraints. To create a constraint, and associated context, do one of the following:
- Within any Papyrus diagram select the constraint tool from the palette and then press the mouse button at the position where you want to create the constraint on the diagram canvas. The constraint should then be connected to another element on the diagram, via a ContextLink relationship, by clicking on the target element in the diagram (in two-click mode). If you are in one-click-mode (connection tool preference), press the mouse button on the constraint and keep it pressed until the context object is selected. This ContextLink relationship defines the context for which the constraint will be evaluated.
- Within the Model Explorer via right clicking a model element and then selecting New Child -> Create a new Constraint. The context is automatically set to the parent of the constraint. The context can be changed via the Properties View if required.
Specify the context
Before editing a constraint body, it is important to specify the context of a constraint; it can be for instance a stereotype or an operation (in fact, it can be any meta-model element that inherits from namespace).
Do one of the following
- Use the context-link-tool to create a visual link to the context element (Papyrus selects the context-link-tool automatically after creation of a constraint): if in two-click-mode
(connection tool preference), target the context-line towards the context element and click. If you are in one-click-mode, press mouse button on the constraint and keep it pressed until the context object is targeted.
- Use the property view to select the context via a dialog popup
Define constraint specification
Each constraint has a specification containing a condition. Whereas it may be an arbitrary value specification, such as a StringExpression or LiteralInteger, it is in most cases useful to define an opaque expression consisting of a pair of language and body (a list of these pairs). The constraint body may be written into OCL, JAVA, or natural language. In order to make constraints usable by the Papyrus, constraint must be written in OCL or JAVA.
Select a constraint in a diagram or model explorer. Then do one of the following to edit a specification
- Open the default editor for constraints using the keyboard shortcut F2 or with a second click on an already selected constraint. All editors are using opaque expressions and support a specific language. This language is configured automatically within the opaque expression, the user edits directly the body. The default editor can be controlled via the preferences.
- Select a specific editor via the context menu, as shown in the following screenshot.
Use the property view to create a new or open an existing specification, as shown in the following figure. In the sequel, we assume that the specification is an opaque expression.
You can add the language, as in the following figure:
This method is a bit more complicated, but gives the user full control over the opaque specification. In particular, it is possible to enter more than one language, body pair (even if this is rarely needed).
SysML Modeling
Tutorials on SysML modeling with Papyrus
Papyrus Zoo of SysML Models
MARTE Modeling
Tutorials on MARTE modeling with Papyrus
Papyrus Zoo of MARTE Models
fUML and Alf Modeling
Using fUML and Alf to produce executable models
Developing custom DSL based editor with Papyrus
UML Profile Modeling
MetaModel Modeling
Additional Editor Integration (this section is for the Backone)
Diagram Editors Customizations
Specific Diagram Editors Creation
Diagram Editor Palette Customization
Here you can find the documentation describing palette customization: Doc
This document can also be found in Papyrus help section => User Guide => Palette customization
Property Editor Customization
Model Explorer Customization
Diagram Appearance Customization with CSS Stylesheets
Additional Utilities of Papyrus
Collaborative Work Support
Layer Support
See Layers Guide
Automatic Layout Support
Code Generation Support
JAVA Code Generation
C/C++ Code Generation
see Papyrus C++ code generation