score:274

Accepted answer

select the project in the package explorer and press ctrl + shift + o (same keystroke as the single class version). should work for packages, etc.

score:0

if you want to run save actions against a whole project you can right click on the project, then choose source and then clean up...

score:0

i have leadbolt ads in my android app. on every leadbolt version, leadbolt force me to re-update the name of the java import. for example, in my app it was :

import com.kwswsuyruzouggmtbzxb.* 

then on the update they gave me a new package with the name:

import com.izwevyqazy.*

and therefore, i have to make a change from the older name to the newer name on around 20 or more of java source code files. so, what i did is to re-organize the imports using this way in eclipse i.d.e.:

  1. select in your application, the package name, the one directly under the folder "src" in your project folder.
  2. right click the package name and select "organize imports"
  3. please don't forget to change the names too in the androidmanifest.xml; otherwise, your app will crash.

score:0

for mac you can use cmd + shift + o. alternatively, you can do it through the menu: source -> optimize imports

you can run this on individual files, or for each source folder. the option is greyed out if you try it at the project level of the project explorer. so you may have to do it a couple time if you have a bunch of modules and source folders. :)

score:4

for eclipse helios, open the "project explorer" view, clic right on your src folder, go under the source menu, and clic "organize imports" that should work for all your project. or just hit the combination ctrl + shift + o on the src folder.

score:22

you can edit the clean up options on save to make it organize imports. that way all of your imports will always be organized.

in eclipse 3.4 just go into window - preferences. in the tree view look under java -- editor -- save actions.

this is how i keep my imports organized all of the time.


Related Query

More Query from same tag