Community
Participate
Working Groups
Source -> Organize Imports does not work correctly for static imports. For example, I am using lwjgl and I call glLoadIdentity(); When I organize imports, i expect that the line import static org.lwjgl.opengl.GL11.glLoadIdentity; is place at the top... but this does not happen.
Move to JDT/UI
Stephen, we are not automatically generating static imports. This isn't possible since it would mean that we know all static fields and methods in the workspace, which is currently not possible. Static imports can only be added using Add Import. I will keep the bug as an enhancement.
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
Bug 283287 offers an alternative solution.
*** Bug 409142 has been marked as a duplicate of this bug. ***
I see it's been quite a while since this report last saw some action, but the recommended solution in a previous comment is not really as practical as it might appear at first. I think this report is still valid and (hopefully) someone will work on it :c I've tried using content assist for this as suggested in Bug 283287 and in this SO post (https://stackoverflow.com/questions/288861/eclipse-optimize-imports-to-include-static-imports) Unfortunately, I find that the content assist is does not work as I expect (e.g. as effectively/efficiently as the automatic inclusion of non-static imports). In fact, to make it "work", I find that I have to manually add pretty much everything in the library I'm trying to use (e.g. lwjgl). This happens to be a very frustrating situation, to say the least, especially when you're learning/testing a new library and end up fighting the tool that should be helping you out instead; it severely interrupts developer workflow...
I think I'm sufficiently annoyed by this bug that I'd like to try working on it. If anyone could give me some pointers for where to start that would be greatly appreciated.