Search code examples
javaeclipserefactoringibm-rad

Rename getter/setter option by refactoring is disabled


I'm using IBM RAD 9.0. When I enter Refactoring dialog on the field name (2x alt+ctrl+R) I see the options to rename getters and setters disabled.

I can't find any setting that would disable that options. I've used refactoring of field names a lot in normal Eclipse, being forced to refactor the field name 3 times (for field, for setter and for getter) is a big time loss.

What can cause disabling/enabling that refactoring options in rename field dialog?


Solution

  • I'm not sure I'm following your scenario, but this is what I do

    1. Highlight the field name
    2. Open Rename field dialogue. Either use Crtl + Alt + R
    3. Change the name of the field
    4. Check Rename getter and setter.

    Keep in mind that if you don't have the getter and setter already in the file, or the getter and setter name doesn't match the convention, the Rename options will be disabled. In this case use Generate getter and Setter dialogue

    1. Right-click the field
    2. Select Source > Generate Getter and Setters
    3. Select the fields for which you want to generate the getters and setters, if not already.
    4. Click OK.

    Hope this helps, if no, please add more details to the problem