Papyrus Banner

Introduction

Since Papyrus 3.0 (Eclipse Oxygen), Papyrus provides a generic matrix for UML Relationships. This matrix allows to represent a relation between a row element and a column element by a checkbox. This matrix allows to display, create and remove relationships between the elements of your model.

How does matrices work?

Rows

Column

Cells

General informations and assumptions

Changes done to support Matrices

API Changes for Matrices

Table metamodel changes for Matrices

New plugins for Matrices

Two new plugins have been created to manage matrices:

Expressions

Developing the matrices, we need to provide a way for the user to filter the contents provided by the row sources and the columns sources in order to display only the interesting axis. From this requirement, we created, in the same time, the Expressions framework. This one provides boolean expressions to evaluate the objects of the model and decide if it must be displayed or not in the table. To go further, please read the Expressions Documentation.

How to create a preconfigured matrix of relationship?

The following explanations supposed you already know a bit how works viewpoint, architecture framework and table. Here, we will explain you how to create a matrix dedicated to a given relationship starting from the configuration of the UMLGenericMatrixOfRelationships.

  1. Create a new plugin
  2. Copy the Papyrus file for the generic_matrix_of_relationships.nattableconfiguration located in the folder configs of the plugin org.eclipse.papyrus.uml.matrix.
  3. Open the file, select the root object ( TableConfiguration) and edit these fields:
    1. Description,
    2. Icon Path,
    3. Name,
    4. Type.
  4. Register your new table in a viewpoint (in a new one, or in an existing one).
    1. The field Implementation ID in the viewpoint MUST have the same value than the field Type in the TableConfiguration
    2. In Papyrus, the UMLGenericMatrixOfRelationships matrix is registered in the file org.eclipse.papyrus.uml.architecture/model/uml.architecture.
  5. Create a GenericRelationshipMatrixCellEditorConfiguration as child of the TableConfiguration and edit it:
    1. Cell Content Filter (not mandatory): a BooleanEObjectExpression used as filter to select precisely the relationship to display in the cells of the table,
    2. Cell Editor Id: an id for your cell editor (not yet used in the current implementation),
    3. Direction: define the orientation of the relationship displayed in the cells of the table,
    4. Edited Element: an element type representing the relationship edited in your table. This field is typed with the object ElementTypeConfiguration. To be able to define this field, you must:
      1. load a file *.elementtypesconfigurations. You can have defined your own element types or reuse a Papyrus one. In all cases, you must have the plugin with containing this file in your workspace.
      2. open the tableconfiguration file in text mode, to check that the reference to the element type is defined as href="platform:/plugin/myFilePath" and not as href="platform:/resource/myFilePath" or as href="../../../myFilePath".
        • the final matrix will work only if a cell editor managing the chosen element type exists
      3. relationshipOwnerStrategy: you should define the relationship owner strategy for your new matrix.
  6. Define the feature to listen (same behavior than TreeTable)
    1. Edit the TreeFillingConfiguration for rows and columns
    2. define the feature to listen (wrapped in a IAxis)
    3. define the filter to apply (not mandatory) on the elements referenced by the feature. Only the matching elements will be displayed as rows or as columns.
  7. Register the nattableconfiguration file in the plugin.xml with the extension point org.eclipse.papyrus.infra.nattable.configuration.

How to manage a new kind of relationship in the matrix?

  1. Create a new class implementing org.eclipse.papyrus.infra.nattable.manager.cell.IGenericMatrixRelationshipCellManager
    1. We advice you to extends org.eclipse.papyrus.uml.nattable.matrix.cell.managers.AbstractUMLGenericMatrixRelationshipCellManager
      1. In this case, check if the EClass representing your relationship is already managed by org.eclipse.papyrus.uml.tools.helper.UMLRelationshipHelper
        1. If yes, it will work fine
        2. If not, complete the previous class (if you are a Papyrus developer), or extend it and implements org.eclipse.papyrus.uml.nattable.matrix.cell.managers.AbstractUMLGenericMatrixRelationshipCellManager.getOrCreateUMLRelationshipHelper() in your CellManager.
  2. Register it using the extension point org.eclipse.papyrus.infra.nattable.celleditor.configuration, using the property cellAxisConfiguration