### Table of Contents

- Viewpoint Development
- First Steps
- Option #1: Creation of viewpoint
- Option #2: Import of the Basic Mass viewpoint
- Viewpoint Aspects
- Configuration
- Data

- Inheritance
- Extension

- User Interface (Property views)
- Diagram
- Viewpoint Guidelines

## Viewpoint Development

- The abstract principles to develop viewpoints are explained in Kitalpha.
- The Technical Information section will help you to setup a development environment
- Access to the page of the Basic Viewpoints for existing viewpoint samples.

### First Steps

There is 2 means to start working with a viewpoint in a workspace:

- Creating a new viewpoint
- Importing a sample viewpoint for inspiration

### Option #1: Creation of viewpoint

Instead of importing the viewpoint, it is possible to create it from scratch:

- Apply the commands: File/Newâ€¦/Project â€“ Viewpoint DSL Project
- Set the name, choose Capella

To create a new aspect, in the mass.spec.vptext:

    CTRL+Space: choose the new aspect to be created
    Modify the name of the aspect file and Finish

## Viewpoint Aspects

The `spec.vptext` is the root file containing the VPDSL information.

### Configuration

The `conf.vptext` will contain the configuration of the viewpoint.

- Target is the targeted application. This can be `Capella`, `CDO for Capella` (targeting for instance Team for Capella), `XML` (generating additional files)

### Data

The Data aspect is essential because information of some other aspects (e.g., UI, Diagram) is deducted from the data description.

In this figure, the classes Mass and PartMass have attributes and no association.

#### Inheritance

Inheritance is identified by the key word superClass, such as for PartMass. Mass has no inheritance. Due to the "Capella" Target Application, during the generation of the ecore file (Cf. org.polarsys.capella.vp.mass plugin), a class without superclass inherits from the Capella NamedElement class.

The mechanism of inheritance enables to a have complete inheritance at the viewpoint level, not only from the data but also for the diagrams for instance.

#### Extension

An extension creates extension elements in an extended element. For Basic Mass, PartMass extends (Capella) Part. All the PartMass elements are contained by a Part element

### User Interface (Property views)

The UI contents is empty at the beginning. Populate it by CTRL-Space and selection of the "UI - Generate User Interface for all classes" option in the menu. The generated contents is deduced from the data description. The generation is not incremental. This means that when the Data aspect part evolves, a new generation is produced apart and ignores the previous one.

By CTRL-Mouse on an attribute (e.g. mass.data.Mass.value), it is possible to navigate toward the attribute defined in the Data aspect.

#### Sirius Property Views

âš ï¸� Using Sirius Property Views in a Capella Viewpoint requires some adaptations of the tooling. It is possible but may cause some problems with existing extensions and tools integrations in Capella. For this reason we do not provide it in the Capella Studio release and the specific dependencies needs to be added. âš ï¸�

In order to develop your viewpoint with this capability, it is first necessary to update your Capella Studio to include the dedicated features and their dependencies. The Sirius update site located under: https://download.eclipse.org/sirius/updates/ contains the required features. Please use the correct repository depending on your version of capella (to get this information head to `https://download.eclipse.org/capella/core/updates/releases/[YOUR_CAPELLA_VERSION_HERE]/targets/capella.target-definition.targetplatform` and check the line with Sirius). Then install the "Sirius Specification Environment" feature. After installing this, the dedicated Sirius Property views will be available.

You will then need to bundle you viewpoint and install it on Capella.

In order to get it working on Capella it will be necessary to update your Capella installation and install EEF and then `Sirius Specification Environment` from the Sirius update site. As an alternative, one may add the following features as dependencies in your viewpoint build (in `<my_viewpoint_name>.representation.feature/feature.xml` or `<my_viewpoint_name>.feature/feature.xml`) and publish again the viewpoint (these files are not re-generated when publishing the viewpoint):

    <includes id="org.eclipse.sirius.runtime.ide.eef" version="0.0.0"/>
    <includes id="org.eclipse.sirius.properties.feature" version="0.0.0"/>
    <includes id="org.eclipse.eef.ext.widgets.reference.feature" version="0.0.0"/>
    <includes id="org.eclipse.eef.sdk.feature" version="0.0.0"/>

### Diagram

A diagram is made of three parts: 1) the diagram extension when a diagram extends an existing one, 2) the mapping of the data onto diagram elements, 3) the actions applicable on the diagram.

ðŸš© Even if it is possible to generate a skeleton for diagram tools using VPDSL , the `odesign` file will be the place to edit and maintain diagram representations. See Sirius Tutorials

### Option #2: Import of the Basic Mass viewpoint

This first option is to import the viewpoint as depicted below from the Plug-ins view, with the "Import As"/"Source Project" command.

After the import of the viewpoint plugins, open the model folder in the vpdsl plugin.

Open a vptext file by double-click. If an error occurs, this means that the vptext is not recognized automatically. In this case, on the vptext file, right-click and Open With Data / User Interface / Diagram / Configuration for the data / ui / diagram / conf vptext files

#### Viewpoint description: Model and text equivalence

The viewpoint description with Kitalpha is stored in a model (.vpdesc file) and edited with a set of editors dedicated by aspect.

## Viewpoint Technical Guidelines

âš¡ See Viewpoint Guidelines

âš¡ For CDO for Capella, due to #141, the generated code may not be directly compliant with the targeted application.

- If you inherit from a `ModelElement`, please ensure that the viewpoint Factory is initializing the id within the contructor, like FilteringFactoryImpl**