Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename/refactor a variable in Eclipse PDT in a Netbeans-like way

In the NetBeans IDE, changing a variable name in the parameters of a function also changes all occurrences of that name in the function. How can I get that behavior with Eclipse PDT? There is a Refactor → Rename item in the context menu, but it let me refactor only the file name.

This issue has been open since 2006 and you can vote for it in the PDT bug tracker #149818.

like image 565
singleton-player Avatar asked Apr 05 '11 07:04

singleton-player


People also ask

How to Refactor variable name in eclipse?

Solution. Select the element in the JDT editor and then select Refactor→ Rename, or right-click the element and select Refactor→ Rename. Enter the new name you want to give the item, and you're set.

How do I Refactor in Netbeans?

In the Inspect and Transform dialog box, select the Configuration option and choose the Migrate to JDK 7 set of inspections from the drop-down list. Click Inspect. Changes that convert the code to JDK 7 syntax display in the preview panel. Click Do Refactoring to apply the changes if required.

How to change all variable names in eclipse shortcut?

Select the variable you with to change, right click, and select Refactor->Rename. This will highlight all instances of the variable. Changing the variable name is automatically propagated to all of the instances.


1 Answers

Code refactoring presence is the difference between PDT and Zend Studio as it is shown at the comparison page. So no, there is no way to do code refactoring in PDT.

like image 152
purebill Avatar answered Oct 05 '22 09:10

purebill