Protecting generated code when you rerun transformations

To protect generated code when you rerun a transformation, you must create a Java code template. The transformation uses the template to enclose the generated method bodies. When you rerun the transformation, it does not overwrite the code that the template encloses.

About this task

To protect generated code when you rerun a transformation:

Procedure

  1. Click Window > Preferences.
  2. In the Preferences window, expand Java > Code Style and click Code Templates.
  3. In the Configure generated code and comments pane, expand the Code list and click Method body.
  4. Click Edit.
  5. In the Edit Template window, replace the existing code with the following code:
    // begin-user-code
    // ${todo} Auto-generated method stub 
    ${body_statement} 
    // end-user-code
     
  6. To avoid syntax errors when you rerun the transformation, after // end-user-code, press Enter.
  7. Click OK.

Feedback