Reputation: 3165
Usually when I'm typing a Java import statement in Eclipse or otherwise referencing a class via the packages that it is in, Eclipse shows a context menu with a list of all classes within that package. There have been several times, however, that it would only shows subpackages within a package and would not show classes within that package.
Does anyone know why this is? It sounds like a setting/preference was changed, but I never knowingly changed anything related to this.
Upvotes: 0
Views: 797
Reputation: 22435
There are at least two types of import dialogs. If you start typing a class name, it will search all packages and list possible matching classes. If you start typing a package, it will list all classes and sub packages within the package you're typing.
Sometimes you need to press Ctrl+space
in order to cycle to the desired dialog.
Upvotes: 1
Reputation: 14558
You generally should not need to do imports yourself. As you type your code if you use code assist ( ctrl + space)
it will show you possible matches and when you hit the enter it will automatically import what you have selected.
Also ( ctrl+ shift + o )
will help you optimize your imports by removing unused ones and sort the needed ones.
for your q : If you still want to do it yourself, it may be a bug if it sometimes work and sometimes does not (which is possible but still unlikely)
Upvotes: 2
Reputation: 21608
You could try to check the "auto completion proposal settings". In eclipse you can define, which kind of proposals you want to see. By default you have several pages of proposals.
Check Window/Preferences/Java/Editor/ContentAssist/Advanced
to see all configurated pages of proposals, and to see which kinds of proposals they are containing.
I'm not sure whether this is the answer to your question, but it might be helpful to know, where to configure those settings... :)
Upvotes: 2