Compare editor

You can view the differences between two resources by comparing them. You can compare the design of all the entity types, or the source code of Macros. You can compare two versions of the same instance, or two instances. When a common ancestor exists, you can compare three resources.

When the comparison is complete, the default compare editor opens in the editor area. For all the entities except Macros, the default compare editor (Design content compare) compares the structure and the design of the instances. For Macros, the default compare editor (Macro source compare) compares the COBOL source of Macros from a textual angle.

Changes are computed relatively to the reference source, which determines the direction of the comparison.

The compare editor is constituted of two views, in which the display and the selection are synchronized:
  • The Structural changes view displays the summary of all the changes that were detected by the compare process. It contains one line for each change and indicates the nature of each change.
  • The detail view displays the elements of each change that is selected in the Structural changes view. It is constituted of two parts: the compared resource in the left part and the reference resource in the right part.
    • For a design comparison, this view displays by default the instance composition, that is to say all the instances it calls. You can also display the instance attributes, most of which come from the instance Definition.
    • For a comparison on the Macro source code, this view displays the source codes that are compared from a textual angle.
In the compare editor, you can browse through all the changes and copy them from one resource to the other.
Note: You can customize the default colors of changes. To do so, select Window > Preferences > General > Appearance > Colors and fonts from the toolbar and expand Design compare in the tree view.

Toolbar

From the toolbar of the compare editor, you can do the following actions:
  • Switch the compare viewer:
    According to the content type, the system determines which compare viewer is the best for the comparison. You can select other viewers in the drop-down list. The two viewers to be used for Rational® Programming Patterns are the following ones:
    • Design content compare for all the entities other than Macros,
    • Macro source compare for Macros.
  • Show the attributes Show attributes:

    This action is available for a design comparison. It is used to display the changes carried out in the instance attributes.

  • Show composition Show composition:

    This action is available for a design comparison. It is used to display the changes carried out in the calls of instances.

  • Swap the reference instance and the compared instance in the editor Swap left / right:

    In a comparison between instances, you can swap the reference instance, relatively to which the comparison is carried out, and the compared instance. By default, the reference instance is the second instance in the alphabetical order. However, you might need to compare the instances by taking the first instance as the reference. In this case, you must swap the two instances.

  • Show or hide the ancestor pane Ancestor pane:

    With this action, you can perform a three-way comparison. It is useful to compare a conflicting file or a file to be merged. In both cases, a common ancestor is automatically searched for. By default, the ancestor pane is hidden.

  • Copy all the changes to the reference instance (to the right) Copy all the changes from left to right:

    This action is available for a comparison between two instances. It copies the entire contents of the compared instance into the reference instance. Both contents are then identical.

    This action is not available for a comparison in the history because in this case, the reference version is in a read-only mode.

  • Copy all the changes from the reference instance to the compared instance (to the left) Copy all non-conflicting changes from right to left:

    This action is always available, whatever the comparison type is. It copies the entire contents of the reference instance into the compared instance. Both contents are then identical.

  • Copy the current change to the reference instance (to the right) Copy current change from left to right:

    This action merges the changes by copying the change that is selected in the compared instance into the fragment that is selected in the reference instance. The selected fragment is overwritten in the reference instance.

    This action is not available for a comparison in the history because in this case, the reference version is in a read-only mode.

  • Copy the current change to the compared instance (to the left) Copy current change from right to left:

    This action merges the changes by copying the change that is selected in the reference instance into the fragment that is selected in the compared instance. The selected fragment is overwritten in the compared instance.

  • Select the next change Select next change:

    This action highlights the next change that is detected by the comparison.

  • Select the previous change Select previous change:

    This action highlights the previous change that is detected by the comparison.

  • Select the next difference Select next difference:

    This action highlights the next difference that is detected by the comparison. It is available for a comparison on the Macro source code only.

    A change is a portion of text that was modified within the line. A difference is a section of file that consists of one or more lines, and that can contain many changes.

  • Select the previous difference Select previous difference:

    This action highlights the previous difference that is detected by the comparison. It is available for a comparison on the Macro source code only.

    A change is a portion of text that was modified within the line. A difference is a section of file that consists of one or more lines, and that can contain many changes.


Feedback