Reapplying and reversing pattern application

You can reapply a pattern to invoke the pattern expansion code for all bound arguments. You can use the Unapply Pattern menu item to remove the pattern instance and its binding relationships to the pattern arguments.

About this task

Reapplying the pattern may be necessary if you modify a model element that has been used as an argument to a pattern. Reapplying the pattern examines all of the argument values and their dependencies on each other. For example, applying the Delegation pattern results in the following relationships between an interface and a class:

Delegation pattern with bound arguments that a dependency and an association relationship.

Adding an operation to the interface element does not affect the class. However, reapplying the pattern causes it to re-evaluate the parameters and the operation is added to the class.

Results of the reapply of a Delegate pattern to show the distributed operation.

This command must be performed on the pattern instance in the diagram view.

Procedure

  1. To reapply a pattern to all bound elements, in the diagram editor, right-click the pattern instance and click Patterns > Reapply Pattern.
  2. To reverse a pattern application, in the diagram editor, right-click the pattern instance and click Patterns > Unapply Pattern. The pattern instance is deleted from the model.

    By default, elements added to a model as pattern arguments are not removed by use of the Unapply Pattern menu item. If you want to remove individual argument bindings, use the Unbind Argument menu item.


Feedback