# Aird Editor

This document describes the new form-based editor for `aird` files introduced in version 5.0. This editor is associated to `*.aird` files (which contains Sirius representations data) and provides end-users complete overview of their models and representations, and direct access to the most common operations.

This document assumes you are already faimiliar with the vocabulary associated with Sirius; if that is not the case, please refer to the Modeling Project documentation which describes in details the more “traditional” Sirius UI and the associated concepts.

Note: This new editor has been introduced with Sirius 5.0. While it is already functional, it should be considered as a first iteration, and its UI is subject to change without warnings in later versions based on experience and user feedback.

## Overview

The traditional Sirius UI is centered on the Modeling perspective, and in particular on the Model Explorer view. For some use cases, especially when Sirius representations are not the primary focus of the user but only a secondary feature to support their main task, this reliance on a specific perspective or view can be inconvenient. The Aird editor is designed to provide an alternative UI to interact with Sirius that is better suited for these use cases. Because the editor is available from any perspective and directly exposes the most common user operations inside its UI, it makes it more convenient to use Sirius in a variety of contexts.

Note that most of the features available from the aird editor are also available from the Model Explorer's UI; the editor simply provides alternative ways to use them that can be more convenient in some contexts. There are two exceptions, described in more details below, which are currently specific to the Aird editor: the generic model creation wizard and the ability to add/remove elements directly from the semantic models.

Using Sirius to display and manipulate your domain models requires telling Sirius:

- which are the models (files) your are interested in;
- which of the compatible representation types you want to make use of.

Representation types are defined in plug-ins which extend Sirius and that you need to install in your environment. Which ones will be available to you depend on what concrete modelers you have installed. Sirius-based modelers can provide many alternative representation types for the same semantic models, and organize them in viewpoints, which corresponds to the different activities or point of views that can be applied to the models.

This organization is reflected in the editor, which presents two main blocks:

On the left, the Models block shows the raw semantic models, which can come from multiple files (resources), and allows you to configure which models should be loaded, to navigate inside them, to perform some basic editing tasks, and finally to create and manage Sirius representations on them.

On the right the Representations block displays all the types of representations available and all the concrete ones already created, organized by viewpoint (by default). It also allows you to manage the representations and viewpoints. The representation types available to you will depend both on the kind of models you have loaded and which modeler plug-ins you have installed in your environment. For example if you have installed UML Designer and have at least one `*.uml` model loaded, you will find there the different kinds of UML diagrams implemented in UML Designer.

## Opening the Aird Editor

The Aird editor is the default editor associated to the `*.aird` files in Eclipse. In some perspectives (e.g. Java), double-clicking on an `aird` file will open the editor and automatically load all the files/models needed if that it not already the case. In other contexts where double-click performs a different operation you may need to open the context menu and select Open With > Aird Editor.

It is also possible to configure Sirius to automatically open the Aird editor when an `*.aird` file is first loaded. When this mode is enabled, opening/expanding a Modeling Project from the Model Explorer, which triggers the loading of the models, will also open the editor. This behavior can be enabled via the Sirius preference Automatically open the aird editor when an aird file is loaded :

When this preference is activated, then aird editor is opened automatically in the following situations:

- After clicking Finish button of the Create a modeling project wizard, the project is created as well as its aird file. The newly created aird file is automatically opened in the editor.

- When a project with the Modeling nature is opened from Model Explorer or Project Explorer, the aird editor is also automatically opened if it contains a main aird file.

- When the aird file is first expanded from a project with Modeling nature from Model Explorer or Project Explorer view, the aird editor is also opened automatically.

## Closing the Aird Editor and unloading models

You have four different ways to close the aird editor. But not all the ways have the same behaviour.

There is one thing to take in consideration when it comes to close the aird editor:

- An opened aird editor has all its referenced models loaded in memory as well as any representation opened in a Sirius editor. For big models and big representations, this can have a big memory footprint. So when you want to close the aird editor you must ask yourself if you want to free the memory used by the loaded aird or not. Then you have to choose the right way to close the editor accordingly. Indeed some way to close the editor will not free this memory and some others will.

The closing mechanism which does not unload models and representations is the following:

- Clicking on the editor white cross on the top right corner of editor’s tab. This will only close the aird editor and will not free memory used by loaded models and representations opened in Sirius editors.

The closing mechanisms which do unload models and representations from memory are the following:

- If your aird editor refers to an aird file on a Modeling Project, the only way to unload models and representations from memory is to close it.

- If your aird editor does not refer to an aird file on a Modeling Project, a button Unload models is provided by the editor and allows to close the aird editor and free memory used by loaded models and representations.

- When aird editor is not in a Modeling Project, Close action in contextual menu of the aird file is available. This action is reachable in any view showing the aird as an IFile like Model Explorer, Package Explorer etc...

## Managing the Semantic Models

This section describes how to manage the semantic models associated to your aird file, which are visible in the Models block on the left side of the editor:

The Models block displays a tree showing all semantic models associated to the aird file, organized in two categories:

- The models located in the same workspace project as the one containing the aird file from which editor has been opened. These are visible as root items on the graphical tree.

- The models located in a project that is different from the project containing the aird file from which the editor has been opened. These models are visible under the Project Dependencies category.

For example:

Regardless of the category they appear in, all the semantic models associated with an aird file are fully loaded, and you can expand the tree elements to navigate inside your models. The tree can be filtered on the elements labels using the search box at the top to quickly locate specific model elements:

In addition to the actual semantic elements, this view also includes all existing representations (diagrams, tables, trees). As in the case of the Model Explorer, the representations are available directly below the semantic element they represent, and can be opened by double-clicking on them.

### Loading an Existing Model

To be able to edit a semantic model with a Sirius modeler, you must first tell the aird it can edit that model. There are two mechanisms to do so:

- An automatic one were, if your project has Modeling nature, any model file added inside the project will be automaticall added to the aird file.
- A manual one were you have two different buttons in the editor:
  - The New... button, which opens a wizard allowing to create a new model from any registered package and in any project you want (see the next section for more details on the wizard). The newly created model will be loaded automatically in the aird file.
  - The Add button, which allows to load into the aird file an already existing model either from the same project or from another one.

Note that you can also add a new semantic model to a session by simply drag and dropping the model file from the workpace (from any Eclipse view) into the Models block on the left side of the editor.

### Creating New Models

The aird editor features a generic model creation wizard that can be used to create new models files of any kind supported in the environement (i.e. instances of any installed meta-model). To create a new model, select the New... button. It opens a creation wizard:

- The first page asks you to select which kind of model you want to create. It will present you all the EMF metamodels available in your installation (e.g. UML or BPMN). You can use the text field to filter among all the meta-models available (in large installations, there may be hundreds of them).

- Once the metamodel is selected, the second page asks for the type of the root element in the new model file. By default Sirius will try to infer good candidates for this root element type, and show only those. You can deselect the Show only suggested root types checkbox to reveal all the concrete types defined in the metamodel you selected.
- Finally, the third page of the wizard will ask you for the name and location of the new file to create. By default, the file will be created in the same project as the `aird` file and have a generated name.

### Removing Model Dependencies And Representations From The Aird Editor

To remove models dependencies, you must select the root model items and click on the Remove button:

Note that this action does not delete the physical model file.

The removal can be applied only if some rules are respected. If they are not, the remove button will still be active and its activation, will inform you of the reasons why you cannot proceed the removal.

The rules regarding models dependencies removal are the following :

- A model dependency cannot be removed if at least one of its element contains a representation. Note that the representation can be invisible if the viewpoint providing it is not enabled.

- A model dependency cannot be removed if you are working inside a project with the Modeling nature and the semantic model is located inside this project. Indeed, the Modeling nature ensures that all model files stored inside the project are always loaded in the project’s `aird` file.

- A model dependency cannot be removed if it is a fragment of a model. In this situation you need to use the Uncontrol action to remove it.

### Removing Representations From The Aird Editor

To remove a representation from the aird file, you can either select it in the editor and use the right click contextual action Delete or the DEL keyboard key.

### Models Quick Editing

The normal way to display and edit models with Sirius is to do it through one or several Sirius-defined representations ( modelers), which define domain-specific ways to represent and manipulate the data, and ensure some level of consistency.

In some situations you may need to manipulate the model elements more directly, even if no Sirius-based modeler or tool has been defined to support your use case. The aird editor provides support for “quick editing” of the semantic models independently of a Sirius representation. It works like any generic EMF models editor:

- You can right-click on a semantic element to create new children inside, or to delete it.
- When you have selected an element, you can use the Properties view to edit its features. Note that the content of this view depends on which viewpoints are currently enabled. If you have enabled viewpoints which define specific properties views for your elements, these will be used instead of a generic one, so not all direct model operations may be available.

Keep in mind that editing the semantic models this way bypasses any high-level restrictions and rules that may be brought by Sirius modelers. Depending on the semantic models, these direct manipulation may break domain constraints. Use with care.

## Managing Representations and Viewpoints

To use a Sirius modeler to edit a model element, you need to create a graphical representation for it. This representation is then editable with a Sirius modeler that can be a diagram, a tree or a table editor. Concrete representations are created from a representation type, which are provided by Sirius-based modelers, and organized by viewpoints.

In addition to providing representation types from which representation can be created, viewpoints can also provide extensions to other viewpoints' representation types, adding for example new tools to them.

The following sections describe how to create/remove representations and the related functionalities.

### Visualizing Viewpoints and Representations

The aird editor has a block named Representation which displays all the available viewpoints (compatible with the semantic models loaded), the representation types they define, and the actual concrete representations that have been created. All these elements are organized in a tree:

This Representations block is separated in two parts:

- The left is the tree showing viewpoints with their representations types (showing the number of representations it contains) and representations.
- The right part shows the documentation of the viewpoint of the selected element. It allows to find what viewpoint provides the representation type providing Sirius modeler functionalities fitting your needs to edit graphically your models.

To the bottom of these two parts are two checkboxes, that can be used to control which elements are displayed:

- Group representations by viewpoint : when active (the default), viewpoints items are shown in the tree. When deactivated, only representation types and their representations are shown.
- Show disabled viewpoints : when active (the default), all the available viewpoints (and their content) which apply to the semantic elements currently loaded are displayed, even if they are currently disabled. This is useful when starting a new project as it shows you immediatly all the features that are available to you, even if you have not yet enabled any. Once you have enabled the viewpoints you need, you may want to hide the others to help focus.

A viewpoint is grayed out if it is disabled. Otherwise it is enabled in the aird file.

The viewpoints shown are all the viewpoints available in your environment that are compatible with the models loaded in the aird file. So if your environment does not contain any viewpoint compatible with your models or if you have no models loaded, then the graphical representations component will be empty.

Representations can also be seen directly in the models graphical component of the aird editor under the associated model’s element if the viewpoint containing the representation type used to create the representation is activated. If not the representation will not be visible.

To open an exisiting representation, simply double-click on it (this works both in the Representations tree and in the Semantics tree).

### Enabling and Disabling Viewpoints

A viewpoint provides representation types and/or extension for other representation types. In some cases you want need to disable functionalities brought by these extensions or on the contrary to enable them.

To enable/disable a viewpoint, you can either:

- double click on a viewpoint item on the representations graphical component of the aird editor. It will enable or disable the viewpoint depending on its current state.
- use the Enable Disable buttons after having selected one or more viewpoints.
- create a new representation defined in a previously disabled viewpoint. It will activate the viewpoint of the corresponding representation type.

Some viewpoints have dependencies to another ones. Enabling a viewpoint will automatically enable all its dependencies. Disabling a viewpoint that is a dependency of another one will ask you to confirm its disabling as well as the ones depending on it.

### Creating and Removing Representations

After having identified the representation type providing Sirius modeler functionalities you need, three methods are available to create a new representation from it and a model element to edit its content:

- First you can double click on a representation type from the representations graphical component of the aird editor. It opens the Create a new representation wizard. You then have to select a model element compatible with the description from which the new representation will be created.

- Second you can click on the New button of the representations graphical component of the aird editor. It opens the wizard were you have first to select the representation type from which you want to create a representation before choosing the model element.

- The last method is to use the contextual menu action New representation available on right click on a model element from the models graphical component:

The menu shows only representation types compatible with the selected model element and that belong to activated viewpoints. When choosing Other... the wizard to create new representation is opened and show the representation types compatible with the selected element whether they belong to a viewpoint activated or deactivated. If you create a representation defined in a viewpoint that was previously disabled, it will be enabled automatically.

You can remove a representation either from the representations or models graphical components of the aird editor by:

- using the Remove action in the representation’s context menu;
- using the Remove button of representations block when the representation to remove is selected there;
- select the representation and hit the Del key.

### Opening a Sirius Modeler From a Representation

To open a representation to edit graphically the model’s element it is associated to, you just have to double-click on it either in the models or representations graphical component of the aird editor.

If you double click on a representation in the Representations block that belong to a disabled viewpoint, this viewpoint will automatically be enabled before opening the representation.