I have 60 or so Java classes in an Eclipse project that I am reorganizing (everything was in the default package, ick!) that need to import another package in the project (newly created by other refactoring).
I would rather not do a Ctrl+Shift+O
on every file. Is there someway I can speed this up?
Press: CTRL + SHIFT + O and you should see below dialog boxes. Choose your desired import package and click next. It will prompt you for your next import and thats it. You are done.
import java. util. * will import all classes, but only the ones you actually use will be in the compiled code. It does not affect your program once it is compiled.
Automatically organise import statements whenever you save Here are the steps to organising imports whenever you save: Go to Window > Preferences > Java > Editor > Save Actions. Select Perform the selected actions on save (off by default). Ensure that Organize imports is selected (on by default).
How do people cut-and-paste multiple classes within Eclipse? I usually use ctrl + click to multiple select, then crtl + drag/drop to copy the classes to a new project.
Select the project in the package tree, and hit Ctrl-Shift-O. It will organize the imports for all the files of the project.
Just click on your project and press Ctrl-Shift-O.
Or rightclick your project -> select "Source" -> Organize Imports
Righclick on the source folder -> Source -> Organize Imports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With