PackageDescription: RBDynamicRefactoringUI

RB Dynamic Refactoring UI

Last published: October 21, 2009 by 'nross'

Defines 1 Classes
Extends 3 Classes

This goodie uses method wrappers to analyse method call sites to support method renaming. It offers dynamic renaming as a middle alternative (Rename some...) when a static rename raises a 'multiple implementors' warning dialog, showing e.g.

This will refactor all of the 3 implementors and 5 senders of
Do you want to proceed?
Yes Rename Some... No

Selecting the middle option opens a multi-page step-by-step UI with detailed instructions (which also advise users about the powers and perils of method wrappers). Users then run tests or exercise code by hand and the system records which implementors were used in which locations. The user can also supply that information directly via a pop-up menu on the call site page. The system warns if there are true polymorphic cases requiring hand rewrite. At any point, the user can inspect the refactoring code generated so far and execute it.

Do not load if you do not want Method Wrappers Base in your image. Read that parcel's comment if unfamiliar with method wrappers.

Using this goodie to rename a selector makes sense if you have a good test set for that selector or can exercise it adequately by hand or are confident you can provide the information for any unresolved call sites.

See RBDynamicRefactorings comment for more information.

If you wish to be able to invoke dynamic renaming directly from the menu, implement the following extension to add a 'Dynamic Rename' option to the RB's 'Method' menu.

"In the custom refactoring project, dynamic renaming is offered as a third alternative when a static rename receives a 'multiple implementors' warning. This pragma lets you invoke dynamic renaming directly from the menu."

icon: nil
nameKey: #dynamicRename
enablement: #isSelectorSelected
indication: nil
menu: #(#selectorMenu)
position: 40.031>

(DynamicRenameMethodUI new
selectorHolder) value: self selector