How do I convert a local variable in a method to a method parameter using eclipse refactor?
views:
57answers:
2
+1
A:
If you remove the declaration of your local variable, the places you used that variable will no longer compile. You can then choose "Add parameter" from the quick fix menu (Ctrl-1 I think, don't have Eclipse open now).
Jorn
2010-05-23 19:23:58
Although it doesn't use the Eclipse refactor feature, this works just as well
chrisbunney
2010-05-23 19:26:09
+5
A:
You can use the "Introduce Parameter" option on the Refactor.. submenu when you right-click.
You'll need to select an expression, such as the expression used to initialise the local variable, for this to work.
chrisbunney
2010-05-23 19:24:59