1 of 36

DSML-Based Customization with �Eclipse Papyrus 3.0

A guide to customizing Papyrus for specific domains

Nicolas Hili

2 of 36

About Me

  • Born and raised in Nice (France)
  • UG in Paris
  • PhD and Postdoc fellow at CEA and the Computer Science Laboratory in Grenoble (the capital of the beautiful french Alps !)
    • Embedded system design
    • Safety-critical interactive systems
  • Postdoc fellow at Queen’s University
    • Reactive real-time embedded systems
  • Research Interests:
    • MDE
    • Real-time/Embedded/Reactive/Interactive systems
    • HCI

2

3 of 36

About this Presentation

  • Two parts:
    • Part I: Installing and using Papyrus (special focus on Profile def) -- beginner/intermediate,
    • Part II: Customizing Papyrus -- intermediate/expert.
  • Few slides but a bunch of opportunities to make it as interactive as possible (live demos, Q&A, feedback, discussing your own case studies, etc.);
  • Some parts may be too basic. Feel free to tell me;
  • Do not hesitate to interrupt me whenever you want :)
  • Apresentação em Inglês mas eu posso tentar responder em Português.

3

4 of 36

About this presentation (cont’d)

  • Three time slots: Wed 17, Thu 18, and Tue 23
  • Depending on how long we spend on the presentation today, two propositions:
    • 1st Proposition:
      • Wed 17: Installing, using and customizing Papyrus (full)
      • Thu 18: Eclipse Papyrus for Real-Time (Papyrus-RT)
      • Tue 23: Free slot (PhD thesis, extending the Papyrus-RT code generator, using Papyrus designer)
    • 2nd Proposition:
      • Wed 17: Installing and using Papyrus (first part of this presentation)
      • Thu 18: Customizing Papyrus (second part of this presentation)
      • Tue 23: Eclipse Papyrus for Real-Time (Papyrus-RT)

4

5 of 36

Context

Objective: Tailoring UML to your own needs

  • Based on the Eclipse Platform and Eclipse Papyrus 3.0
  • Simplify the diagram styles
  • Simplify the Eclipse UI
  • Adopt rules defined in the UML profile

Why using Eclipse Papyrus?

  • Full UML2-compliant modelling editor
  • Based on several standards: UML 2.5, fUML 1.2.1, ALF 1.0.1, …
  • Open source and fully customizable
  • Can be used to tailor UML for a particular domain

5

“Don’t reinvent the wheel, adopt UML instead, but tailor it to your’’

�Papyrus User Guide Series:

About UML profiling, version 1.0.0

6 of 36

Agenda

  • Context
  • Installing and Using Eclipse Papyrus 3.0
  • Customizing with Papyrus
    • Overview
    • UML Profile application: the HOE2 use case example
    • UI Customization: diagrams, model explorer, property menus…
    • Limitation and next steps

6

7 of 36

Papyrus

  • Full UML2-compliant editor;
  • Provide graphical editors for class diagrams, sequence diagrams, state machine diagrams, component structure diagrams, etc.
  • Built on top of Eclipse Modeling Framework (EMF), Graphical Modeling Framework (GMF), and the UML2 project in Eclipse;
  • Support the definition and application of UML Profiles.

7

8 of 36

Papyrus Main Features

8

Model execution�with Moka

Fully customizable environment�with Papyrus Toolsmith

UML Modeling

Code generation�with Papyrus Designer

9 of 36

Downloading Papyrus

To download Papyrus: https://www.eclipse.org/papyrus/download.html

9

10 of 36

Overview of Papyrus

10

Model explorer

Project explorer

Graphical editor

Property menu

Tabbed diagrams

11 of 36

UML Profiles

  • A UML Profile consists of:
    • Stereotypes extending UML metaclasses
    • Constraints (expressed in OCL)
  • Stereotypes can encompass:
    • attributes and references to other stereotypes
    • graphical information (icons/shapes)
  • Stereotypes can extend other stereotypes
  • Stereotypes can be abstract or concrete
  • Stereotypes can be required (isRequired=true) or optional

11

“A stereotype defines how an existing metaclass may be extended, and enables the use of platform or domain specific

terminology or notation in place of, or in addition to, the ones used for the extended metaclass.’

�OMG Unified Modeling Language TM (OMG UML)�Specification v 2.5

12 of 36

UML Profiles (cont’d)

12

extension

generalization

OCL constraint

isRequired attribute

13 of 36

UML Profile definition

  • In order to be used, a profile must be defined;
  • Various information can be entered
    • Version number,
    • Date and author,
    • Comments,
    • Copyright,
    • Settings for OCL constraints.
  • Version number is automatically incremented
  • Based on the version number, Papyrus automatically determines whether a profile has been updated and needs to be reapplied;
  • OCL settings:
    • Embedding OCL constraints into the profile definition,
    • Creation a validation plugin instead (finer-grain control).

13

14 of 36

Profile application

Once a profile has been defined, it can be applied to a model

14

15 of 36

Stereotype applications and validation of constraints

15

self.base_UseCase.ownedBehavior->selectByType(Interaction)�->forAll(interaction | interaction.message->includes(self.trigger))

16 of 36

Quick Way for Testing OCL Constraints

16

OCL interactive console

“self” designates the currently selected element (diagram/model explorer)

Options to configure

17 of 36

Agenda

  • Context
  • Installing et Using Eclipse Papyrus 3.0
  • Customizing with Papyrus
    • Overview
    • UML Profile application: the HOE2 use case example
    • UI Customization: diagrams, model explorer, property menus…
    • Limitation and next steps

17

18 of 36

Papyrus

Not only a UML2 editor but a fully customizable platform

18

19 of 36

Adapting Papyrus for a Specific Domain

19

Kind of adaptations

Adapt the�semantics of UML

Shorten “Workflows”

Hide elements

20 of 36

Where to Adapt? Example with UML-RT

20

21 of 36

Where to Adapt? Example with UML-RT

21

22 of 36

Papyrus for Toolsmiths

Papyrus for Toolsmiths

  • A set of plugins for customizing Papyrus
  • Provides wizards and models to customize the Eclipse UI: �palette, property menu, model explorer, diagrams...

Important note about the version

  • Since Papyrus 3.0 (Oxygen)
    • No longer bundled with Papyrus; has to be downloaded separately
    • Full refactoring (not yet complete)
    • Based on the architecture description ISO42010 standard (proposal)
    • Different system of viewpoint

What impact?

  • A model to rule them all: architecture model
  • Some documentation outdated
  • Some Wizards not yet implemented for now

22

ISO42010 definition Architecture Description

23 of 36

Papyrus Architecture Model in a Nutshell

  • Allows for defining new Architecture Description Languages (ADLs)
  • An ADL consists of:
    • Stakeholders and concerns
    • Viewpoints
    • Model kinds (diagrams, tables, etc.)
    • Rules for creating model kinds, restricting elements in the palettes, etc.

23

Source: https://wiki.eclipse.org/Papyrus/Oxygen_Work_Description/NewFeature/PapyrusAFViewpointSwitch

Main difference between �Papyrus 2 and 3:

  • In Papyrus 2.0, viewpoints are globally configured for the entire workspace
  • In Papyrus 3.0, viewpoints are locally configured for each project

⚠ Still a proposal -> under development -> everything not implemented yet

24 of 36

Architecture Model: Example

24

Viewpoint

ADL

Representation kind

Creation rules

Palette rules

Diagram style

Palette ID

Domain

25 of 36

Architecture Model: A lot of Potential for Extensibility

Papyrus allows for merging architecture models:

  • Domain with the same name are merged
    • ADLs with the same name are merged
      • Stakeholders with the same name are merged
      • Concerns with the same name are merged
      • Viewpoints with the same name are merged
        • Representation kinds are merged

25

26 of 36

Papyrus Customization: the Process

26

«step 1»Define your domain

myDSL.profile.uml

«step 4»Customize the UI

myDSL.architecture

myDSL.paletteconfiguration

myDSL.ctx

myDSL.creationmenumodel

«step 2»Define your viewpoints, stakeholders, etc.

«step 2a»Generate EMF code

«step 2b»Generate validation plugin

«step 3»Define your representations

myDSL.style

myDSL.elementtypesconfig

myDSL.genmodel

myDSL.ecore

java

java

java

java

java

java

27 of 36

Papyrus Customization: the Process

27

«step 1»Define your domain

myDSL.profile.uml

«step 4»Customize the UI

myDSL.architecture

myDSL.paletteconfiguration

myDSL.ctx

myDSL.creationmenumodel

«step 2»Define your viewpoints, stakeholders, etc.

«step 2a»Generate EMF code

«step 2b»Generate validation plugin

«step 3»Define your representations

myDSL.style

myDSL.elementtypesconfig

myDSL.genmodel

myDSL.ecore

java

java

java

java

java

java

28 of 36

Step 1: Define your Domain: Example with HOE2

28

Highly Heterogeneous Object Oriented Efficient Engineering (HOE2):

  • Language for describing Applications and Platform of Embedded Systems
  • Define how applications are implemented on multiple chained platforms (platform layering)
  • Strong emphasis on traceability to requirements.

In HOE2, requirements of a System are captured in a �requirement model where:

  • Actors and UseCases have a priority (aka. causality):
    • Primary
    • Secondary
  • UseCase are described using a set of scenarios
  • A scenario is a sequence of messages showing a �possible interaction between an actor and the system;
  • Scenarios can be:
    • Nominal scenarios
    • Error scenarios

29 of 36

Step 1: Define your Domain: Example with HOE2 (cont’d)

29

In HOE2, a requirement model have a set of constraints:�

  • An interaction is always at the initiative of an actor;
  • All scenarios contained in the same useCase are activated by the same message (aka. trigger) between the actor and the system. The trigger is defined within the useCase;
  • A useCase contains:
    • at least one nominal scenario
    • Zero or multiple error scenarios
  • Scenarios of a primary useCase can only be triggered by a primary actor.
  • ...

30 of 36

Papyrus Customization: the Process

30

«step 1»Define your domain

myDSL.profile.uml

«step 4»Customize the UI

myDSL.architecture

myDSL.paletteconfiguration

myDSL.ctx

myDSL.creationmenumodel

«step 2»Define your viewpoints, stakeholders, etc.

«step 2a»Generate EMF code

«step 2b»Generate validation plugin

«step 3»Define your representations

myDSL.style

myDSL.elementtypesconfig

myDSL.genmodel

myDSL.ecore

java

java

java

java

java

java

31 of 36

Step 2: Define your viewpoints, stakeholders, etc.

31

  • Tree view model editor
  • Allows for defining the domain, the viewpoints, the stakeholders, and the concerns
  • Specific information for a profile-based DSL:
    • Creation Command Class: Java Class to initialize the model with contents
    • Profiles: List of profiles to use
  • Architecture model has to be registered via an Eclipse extension point:

<extension

point="org.eclipse.papyrus.infra.architecture.models">

<model

path="resource/architecture/hoe2.architecture">

</model>

</extension>

32 of 36

Step 2: Define your viewpoints, stakeholders (cont’d)

32

33 of 36

Papyrus Customization: the Process

33

«step 1»Define your domain

myDSL.profile.uml

«step 4»Customize the UI

myDSL.architecture

myDSL.paletteconfiguration

myDSL.ctx

myDSL.creationmenumodel

«step 2»Define your viewpoints, stakeholders, etc.

«step 2a»Generate EMF code

«step 2b»Generate validation plugin

«step 3»Define your representations

myDSL.style

myDSL.elementtypesconfig

myDSL.genmodel

myDSL.ecore

java

java

java

java

java

java

34 of 36

Step 3: Adding CSS stylesheet

34

35 of 36

Current Result

35

36 of 36

Thank You