Eclipse: Filter / Exclude certain packages during “Organize Imports”

The Eclipse “Organize Import” Feature (Cntr+Shift + O) allows to automatically import the packages which are used in a program. If there are several options Eclipse suggests all available classes and the user has to select the right one.

organizeImport

If you are working mainly with SWT the fact that Eclipse does also suggest java.awt and javax.swing classes can be annoying.

To prevent this you can add a “Type Filter” under Windows -> Preferences -> Java -> Appearance -> Type Filters. Then these classes are not suggested anymore.

Type Filter

Type Filter

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of vogella.com. With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse and tagged , . Bookmark the permalink.