PDP Source Code editor

You use this editor to see and modify the generated code of a Source Code instance. This editor complements the functions of the standard code editor.

To see the code through this editor, you must have generated a Source Code instance. Then, in the Design Explorer view, right-click the corresponding generated file and select Open with > PDP Source Code editor.

Modifying the generated code

You can modify the generated code to adapt it to your particular needs.

You can insert code lines easily by calling Static Micropatterns from the Snippets view, RPP SDK Micropattern Snippets category. You can also call micropatterns that were created with the application programming interface. It is strongly recommended not to modify the code that is generated by a micropattern. Warnings in the margin indicate where the insertion of specific code can disrupt the reconciliation. Such is the case if you override a line that is generated by a micropattern and add a micropattern call in the specific code that is generated by a micropattern.

The PDP editor includes many functions. For example, you can cut, copy, paste, filter the lines, debug, compare, and display the content assist by pressing the Ctrl and space keys.
Limit: The Undo and Redo functions of the editor are no longer available after a generation. The pile of changes to undo and redo is emptied after each generation. The changes that are made before a generation cannot be undone with the Undo function. To delete changes (including the generation) made before the generation, you can exit the editor without saving or use the Revert File function.
The PDP COBOL editor indicates a modified state with an asterisk (*) in the editor tab when the generated file is directly modified. To discard the changes, right-click and select Revert File.
Note: In the design editors, you can modify the designs that are involved in the generation. In this case, the PDP COBOL editor does not display a modified state. It only indicates the desynchronization between the design and the generated code with the Desynchronization between the design and the generated code icon. If you close the design editors without saving, then close the PDP COBOL editor and open it again, the desynchronized state is no longer indicated. You must be aware that if an instance is opened in several editors simultaneously, the modifications are held as long as you have not closed the last of these editors and saved.

Desynchronization between the design and the generated code

When the design of the generated instance is modified, the generated code is no longer synchronized. In this case, the icon Desynchronization between the design and the generated code is displayed, followed by a special character, in the title of the PDP editor tab. The default special character is > but you can change it by selecting Window > Preferences > Pattern Driven Programming > PDP Framework > Character to use to better visualize the need for regeneration in the PDP Editor. These signals alert you that a new generation is needed. You can regenerate all the desynchronized files in the Generation Manager view.
Note: The desynchronization is also indicated in the Design view of the instance. The color of the generation button changes (Generate is recommended) to inform you that Generate is recommended due to modifications in the design. When the generation is complete, the synchronization is restored and the button returns to its initial appearance.

Specific display of the PDP Source Code editor

The PDP coloring, on top of the standard editor coloring, identifies the origin of the lines. By default, the generated code lines are gray and the micropattern lines are blue.

You can change these PDP default colors by selecting Window > Preferences > Pattern Driven Programming > Source Code editor.

Two symbols that are related to Rational® Programming Patterns can be displayed in the margin:
  • Information is displayed if code lines were deleted or overwritten. If you place your mouse over this symbol, you can see the deleted line or the line that was overwritten by the current line.
  • Warning is displayed in the following cases:
    • On the lines where the reconciliation detects a potential problem. The reconciliation is the process that integrates, after a generation, the new design of an instance with the user-specific changes. A warning is displayed, for example, when the reconciliation is not sure where it must place the specific code because several places are possible, or when the overwritten generated code has changed.

      In the Problems view, these warnings have a PDP Reconciliation Marker type. You can manage them in the Problems view by right-clicking them and Quick fix.

      For example, in the Pacbase facet, if you replaced a Macro call by another Macro call, reconciliation warnings can be generated if the initial Macro contained specific code lines. You can then use the quick fixes to do the following actions:
      • Insert the specific code lines of the initial Macro where they used to be.
      • Insert the specific code lines of the initial Macro and their context to maintain the COBOL code consistency.
      • Leave the code as is. The specific code lines of the initial Macro are removed.
    • On the lines where a micropattern has set a warning.

You can change the display in the PDP editor with filters from the Generated Code Structure view.


Feedback