Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+37 votes

Is it possible to change a variable name to a call to an accessor method using Refactor on Eclipse? My code originally had video be an instance of the controller class, as opposed to getting it from a ProjectData object. I wondered if there was an easy way to change all the cases within my code that called video to project.getVideo() using the refactor feature on Eclipse.

asked in CSC285_Fall2018 by (1 point)

2 Answers

+16 votes

I believe that Alt+Shift+R will allow you to rename variables globally in the class you are working. I’m not sure if it would do it for the whole project but it will definitively do it for the current class. Just rename it to be the methodcall.

I’m not sure if this is what you meant.

answered by (1 point)
+14 votes

There's an off chance that Eclipse may be able to achieve this, but I'm guessing it's safest to do this kind of refactoring manually.

answered by (508 points)