Using Refactoring

Renaming Elements

This procedure describes how to rename a Maple element and ensure that all references to that element are updated. All Maple elements can be renamed and refactored from Maple Explorer view. The following is a list of applicable Maple elements:

  • Modules
  • Procedures
  • Arrows
  • Names
  • and much more...

Elements can either be renamed from within the editor itself if the In-place refactoring feature is activated (will not display a preview of changes) or from the Rename Element dialog.

Renaming Elements within the Editor

To rename an element within the editor:

  1. In the editor, place your cursor on the element to be renamed.
  2. From the context menu (right-click) select Rename element -or- press Alt-Shift-R. All occurrences of the element are put in a frame and the Refactor popup is displayed.

  3. Type the new element name in the box.
    All occurrences of the element name are automatically updated.
  4. Click Enter to apply the refactoring.
    A dialog is displayed prompting you to save the file before the refactoring is applied.
  5. Mark the 'Always save all modified resources automatically prior to refactoring' checkbox so that the dialog will not be displayed again.
  6. Click OK.
  7. The element will be renamed and all instances where that element is referenced will be updated to reflect the changes.

Renaming Elements through the Refactor Dialog

To rename an element through the Refactor dialog:

  1. In the editor, place your cursor on the element to be renamed.
  2. From the context menu (right-click) select Rename element -or- press Alt-Shift-R. All occurrences of the element are put in a frame and the Refactor popup is displayed.
  3. From the Refactor popup menu select Open Rename Dialog

  4. Type the new element name in the box.
    Click OK to apply your changes or click Preview if you want to see a preview of the changes that this refactoring will create.
  5. If you clicked preview a preview window will open with a changes tree showing all the changes which will be made to reflect the rename of the element. The changes will be listed according to the context within which they appear.

  6. Use the Next / Previous Change arrows to scroll through all possible changes. Unmarking the checkboxes next to the changes will cause those changes not to take effect.
    Note: If changes will be made in other files which reference the element being refactored, the changes will also be listed here under the file name.
  7. The changes to be applied will be displayed in the bottom pane.
    You can scroll through the different changes using the scrolling arrows:
    • Next / Previous Difference scrolling arrows - Scroll through changes to be applied within the element selected in the top pane.
    • Next / Previous Change scrolling arrows - Scroll through all changes to be applied. If you unmarked changes in the top pane, these will not be displayed when using these arrows.
  8. Once you are satisfied with the changes, click OK.