Validity View (new in Luna)

Validity View (new in Luna)

The standard EMF validation capabilities provide a useful overview of problems:

The Validity View provides a much more detailed view of the problems and so assists in debugging bad models and/or bad constaints.

The Validity View may be shown by invoking OCL->Show Validity View from the right button menu of some model editors such as the Sample Ecore Model Editor. Alternatively the Validity View view may be created by Window->Show View->Other... OCL->Validity View.

The left-hand pane titled Model Elements provides a tree view of the Resources in a ResourceSet in a similar fashion to the Sample Ecore Editor. However an additional child element (in blue italics) is added for each constraint applicable to its parent element. Checkboxes enable or disable the element from re-validations and JUnit-like status icons show the status of the most recent validation. Hovertext provides further detail.

The right-hand pane titled Metamodel Constraints provides a tree view of the model hierarchies that contribute constraints. An additional child element is added for each model element to which the constraint applies.

The displays track the mouse selection in other views. Whenever the mouse selection can be resolved to an EObject, that EObject’s ResourceSet populates the left hand pane and constraints affecting the left hand pane populate the right hand pane. Tracking the mouse selection is quite expensive, and probably irritating. It can be inhibited by pinning the view to the current selection.

There is generally much too much detail if all elements and constraints are considered and so the view provides many facilities to facilitate focusing on the interesting combinations.

View Tool Bar

The View Tool Bar is at the top and right of the view following the Validity View title. It provides facilities common to both Model Elements and Metamodel Constraints.

Expand All

The plus icon causes the Model Elements and Metamodel Constraints to be fully expanded to display all their contents. Beware that for large models this may result in slow screen updates.

Collapse All

The minus icon causes the Model Elements and Metamodel Constraints to collapse to display only their top level elements.

Pin

The pin icon toggles the track current cursor selection. When unpinned, the default, any change in mouse selection may cause recomputation of Model Elements and Metamodel Constraints contents. When pinned the contents are stable.

Refresh

The double arrow icon causes the Model Elements and Metamodel Constraints to be recomputed. This may be necessary for a metamodel change to be used.

Run

The white triangle in green circle icon runs a validation on all enabled model element/constraint combinations updating the status indications for constraints in the left hand Model Element and model elements in right hand Constraint pane.

Filter

The Filtering menu hides unwanted contributions to the display. Each of the validation result statuses can be individually enabled.

  • Show all errors

  • Show all infos

  • Show all failures

  • Show all warnings

  • Show all successes

By default none of the selections are enabled so everything is shown. As soon as a specific status is enabled all display elements with other non-enabled statuses are hidden. Thus selecting just *Show all warnings" hides error/info/failure/success results.

Save

The floppy disk icon supports export of the validation results.

The available export formats are extensible through the org.eclipse.ocl.examples.emf.validation.validity.validity_exporter extension point.

The default exporters support

html

An HTML file summarising the results.

model

An XMI model conforming to validity.ecore containing all results with references to the model elements and constraints.

text

A text file summarising the results.

Model Elements Pane

The Model Elements Pane is the left hand pane of the Validity View.

It comprises a title and tool bar, text filter and scrollable tree of model elements and their constraints.

Model Elements Tool Bar

The Model Elements Tool Bar is at the top and right of the left hand pane following the Model Elements title. It provides facilities specific to the Model Elements.

Expand All

The plus icon causes the Model Elements to be fully expanded to display all their contents. Beware that for large models this may result in slow screen updates.

Collapse All

The minus icon causes the Model Elements to collapse to display only their top level elements.

Enable All

The tick icon causes all Model Elements to be enabled and so included in the next validation.

Disable All

The no-tick icon causes all Model Elements to be disabled and so excluded from the next validation.

Show/Hide disabled

The document icon with a query controls whether disabled Model Element selections are visible. A diagonal strikethrough shows when selections are hidden.

By default disabled selections are hidden, which allows the unwanted root elements of large models to be unchecked and so hidden before a slow attempt is made to display them.

Text Filter

The text filter takes a StringMatcher pattern that selects which elements are visible. The pattern may contain

  • a * to match zero or more characters

  • a ? to match exactly one character

  • a \ to escape the following character

Model Elements tree

The scrollable tree shows the containment hierarchy of all elements in the ResourceSet containing the model element identified by the mouse selection.

The +/- collapse/expand icons preceding each element enable interesting elements to be shown and others folded away.

Each element is preceded by a check box that enables its usage within the next validation run. All elements may be enabled or disabled using the icons in the Model Elements Tool Bar. Enabling/disabling individual elements enables/disables the element’s descendants and propagates a partial enable/disable to the element’s ancestors.

The checkbox is followed by a validation status icon.

  • tick for validation successful

  • red cross for validation unsuccessful but incomplete

  • blue cross for validation failure (incomplete)

  • amber warning for a validation warning

  • question mark for no validation performed

The status icon is followed by an element-specific icon identifying its type and label.

Double-clicking a leaf Constraint in the left-hand pane makes the corresponding constraint and parent model-element visible in the right-hand pane.

Model Elements Context Menu

The context menu in the model elements tree offers the following facilities in addition to those also available in the toolbar.

Validate Selection

Revalidates all constraints applicable to the selected Model Element and its children.

Debug Single Enabled Selection

Launches the debugger for the selected Model Element and associated Constraint.

The entry is greyed out if more than one Constraint is selected, so the invocation should normally be made from a leaf Constraint result.

Debug launching is only available for OCL constraints in Luna SR0.

Show in Editor

Opens an editor for the selected Model Element or Metamodel Constraint.

Opening is not available for all forms of constraint in Luna SR0.

Metamodel Constraints Pane

The Metamodel Constraints Pane is the right hand pane of the Validity View.

It comprises a title and tool bar, text filter and scrollable tree of metamodel constraints and the model elements to which they apply.

Metamodel Constraints Tool Bar

The Metamodel Constraints Tool Bar is at the top and right of the right hand pane following the Metamodel Constraints title. It provides facilities specific to the Metamodel Constraints.

Expand All

The plus icon causes the Metamodel Constraints to be fully expanded to display all their contents. Beware that for large models this may result in slow screen updates.

Collapse All

The minus icon causes the Metamodel Constraints to collapse to display only their top level elements.

Enable All

The tick icon causes all Metamodel Constraints to be enabled and so included in the next validation.

Disable All

The no-tick icon causes all Metamodel Constraints to be disabled and so excluded from the next validation.

Show/Hide disabled

The document icon with a query controls whether disabled Metamodel Constraints selections are visible. A diagonal strikethrough shows when selections are hidden.

By default disabled selections are hidden, which allows the unwanted root elements of large metamodels to be unchecked and so hidden before a slow attempt is made to display them.

Text Filter

The text filter takes a StringMatcher pattern that selects which elements are visible. The pattern may contain

  • a * to match zero or more characters

  • a ? to match exactly one character

  • a \ to escape the following character

Metamodel Constraints tree

The scrollable tree shows the containment hierarchy of all constraints applicable to model elements in the ResourceSet containing the model element identified by the mouse selection.

The +/- collapse/expand icons preceding each element enable interesting elements to be shown and others folded away.

Each element is preceded by a check box that enables its usage within the next validation run. All elements may be enabled or disabled using the icons in the Model Elements Tool Bar. Enabling/disabling individual elements enables/disables the element’s descendants and propagates a partial enable/disable to the element’s ancestors.

The checkbox is followed by a validation status icon.

  • tick for validation successful

  • red cross for validation unsuccessful but incomplete

  • blue cross for validation failure (incomplete)

  • amber warning for a validation warning

  • question mark for no validation performed

The status icon is followed by an element-specific icon identifying its type and label.

Double-clicking a leaf Model Element in the right-hand pane makes the corresponding Model Element and parent Metamodel Constraint visible in the left-hand pane.

Metamodel Constraints Context Menu

The context menu in the metamodel constraints tree offers the following facilities in addition to those also available in the toolbar.

Validate Selection

Revalidates all model elements applicable to the selected constraint and its children.

Debug Single Enabled Selection

Launches the debugger for the selected Model Element and associated Constraint.

The entry is greyed out if more than one Constraint is selected, so the invocation should normally be made from a leaf Model Element result.

Debug launching is only available for OCL constraints in Luna SR0.

Show in Editor

Opens an editor for the selected Model Element or Metamodel Constraint.

Opening is not available for all forms of constraint in Luna SR0.

Constraint Locators

The constraints displayed in the right hand pane are located by constraint locators that are registered with the org.eclipse.ocl.examples.emf.validation.validity.constraint_locator extension point. A constraint locator implements org.eclipse.ocl.examples.emf.validation.validity.locator.ConstraintLocator or the org.eclipse.ocl.examples.emf.validation.validity.ui.locator.ConstraintUILocator to define location, presentation, execution and debug launching of a particular kind of constraint.

Constraint locators are associated with metamodel namespaces which are determined by the nsURI of the EPackage that contains the EClass of a Model Element EObject. Constraint locators may be registered for a particular metamodel namespace or for no namespace. Those registered for no namespace are activated whenever a namespace is encountered for which no specific constraint locators are registered.

The following Constraint Locators are available by default.

org.eclipse.ocl.examples.emf.validation.validity.locator.EClassConstraintLocator

This constraint locator supports discovery of constraints realized by invariant EOperations in the Java code generated by an EMF genmodel.

org.eclipse.ocl.examples.emf.validation.validity.locator.EValidatorConstraintLocator

This constraint locator supports reflective discovery of validateXXXX methods in the Java code generated by an EMF genmodel using the EValidatorRegistry to identify the relevant Java code.

org.eclipse.ocl.examples.validity.locator.DelegateUIConstraintLocator

This constraint locator supports OCL constraints represented as EAnnotations in Ecore metamodels.

org.eclipse.ocl.examples.validity.locator.PivotUIConstraintLocator

This constraint locator supports discovery of org.eclipse.ocl.pivot.Constraint classes in Pivot metamodels.

org.eclipse.ocl.examples.validity.locator.UMLUIConstraintLocator

This constraint locator supports discovery of org.eclipse.uml2.uml.Constraint classes in UML metamodels.