Friday, November 27, 2015

Save Actions in Eclipse editor



While developing any code in eclipse editor, we have to remove unused imports, unused variables manually, if not used in our programs.
This is sometimes very cumbersome process and takes lots of time.

Eclipse provides the solution for the same. Using this,  we can set the option, so while saving the program, eclipse automatically remove the unused import statements/variables for us. and Accordingly format the code.

In Eclipse editor
  1. Go to menu Windows |  Preferences.
  2. On Left Side, Expand Java, then click Edior.
  3. Select the Save Actions.




































Click Configure... button.

Select the appropriate options on each of the below tabs as per the project requirements.
































After selecting the appropriate options, Click OK.

Now, whenever user saves the file, if there are any unused local variables or unused imports, will get removed automatically.

1 comment: