Promoting a Method Value to be a Local Method Constant

When editing a JADE method, you can promote a method string, numeric, or boolean value to a local method constant.

To promote a method value to a method constant

  1. Click on a string, numeric, or boolean value within the logic of the method.

  2. Select the Promote to Method Constant command from the Refactor submenu of the Edit menu.

    The Set name for Local Method Constant Value dialog is then displayed, showing the selected value.

  3. In the Constant Name text box, specify the name that you require for the local method constant.

  4. Click the OK button.

The constant is then added to the constants section of the method (which is created if it does not exist) and the selected instance of that constant in your method is replaced by the specified name.

The Promote to Method Constant command does not replace all instances of that constant, because the value can appear in unrelated contexts; for example, false, 0, and so on.

To undo the change or changes, press Ctrl+Z to undo each change in that method.