[java] Key Shortcut for Eclipse Imports

It's been a while since I last used Eclipse. I used to love this handy key shortcut that added all the imports to the top of the source file, but I've forgotten it. Does anyone know what this shortcut is?

This question is related to java eclipse

The answer is


CTRL + 1 can also be used which will suggest to import.


Some other useful shortcuts:

  1. Alt + Shift + R : Rename
  2. Alt + Shift + Y : Word wrap
  3. Alt + Shift + V : Move the selected elements
  4. Alt + Shift + I : Inline refactoring
  5. Alt + Shift + M : Extract Method refactoring.
  6. Alt + Shift + L : Extract Local Variable
  7. Alt + Shift + A : Block selection mode
  8. Alt + Shift + Arrow Keys: selects enclosing elements
  9. Alt + Shift + F1: Focus on eclipse element to know plugin implementation details.
  10. Alt + Shift + F2: Plugin implementation details.
  11. F4 : Type Hierarchy
  12. Ctrl + Shift + T : Open Type
  13. Ctrl + Shift + H: Open Type in Hierarchy
  14. Ctrl + Alt + H: Call Hierarchy
  15. Ctrl + Shift + G: Reference in workspace
  16. Ctrl + Alt + G: Quick Search for selected text
  17. Ctrl + Shift + O: Organize imports
  18. Ctrl + Shift + M: Add import for currently selected.
  19. Ctrl + Shift + L: Shows you a List of your currently defined shortcut keys
  20. Ctrl + Shift + U: Occurrence in current file
  21. Ctrl + Shift + A: Open plug-in Artifact
  22. Ctrl + Shift + {: Two side by side editors with current file
  23. Ctrl + Shift + Space : Parameter Hints
  24. Ctrl + Shift + Mouse hover : To view javadoc
  25. Shift + Mouse hover : To view source code
  26. Ctrl + Space : Content Assist
  27. Ctrl + F3/O : Outline
  28. Ctrl + T: Type Hierarchy
  29. Ctrl + H : Open Search Dialog
  30. Ctrl + 1 : Quick Fix
  31. Ctrl+Shift+NUM_KEYPAD_DIVIDE : Collapse All code blocks
  32. Ctrl+Shift+NUM_KEYPAD_MULTIPLY : To open all code blocks
  33. Alt + left arrow : Open recently closed file

Ctrl+Shift+ any key :Direct actions (on text mostly)

Alt+Shift+ any key : Indirect actions


Ctrl It was originally used to send Control character to terminals. Ctrl commands are commonly used shortcuts. (In Mac Command)

Alt It enables alternate uses for other keys.


The above shortcuts are default, if we want to change shortcuts we can do. In eclipse -> Windows -> preferences -> keys. Where we can find all shortcuts with full details:
enter image description here

and
https://shortcutworld.com/IntelliJ-IDEA/win/IntelliJ_Shortcuts https://shortcutworld.com/Eclipse/win/Eclipse-Helios_Shortcuts https://www.jetbrains.com/help/idea/migrating-from-eclipse-to-intellij-idea.html#Shortcuts


Yes. you can't remember all the shortcuts. You will forget many of them for sure. In this way, you can recall it and get the work done quickly.

Press Ctrl+3

And type whatever the hell you want :) It's a shortcut for shortcuts

enter image description here


You also can enable this import as automatic operation. In the properties dialog of your Java projects, enable organize imports via Java Editor - Save Action. After saving your Java files, IDE will do organizing imports, formatting code and so on for you.


Some useful shortcuts. You're looking for the 1st one...

  1. Ctrl + Shift + O : Organize imports
  2. Ctrl + Shift + T : Open Type
  3. Ctrl + Shift + F4 : Close all Opened Editors
  4. Ctrl + O : Open declarations
  5. Ctrl + E : Open Editor
  6. Ctrl + / : Line Comment
  7. Alt + Shift + R : Rename
  8. Alt + Shift + L : extract to Local Variable
  9. Alt + Shift + M : extract to Method
  10. F3 : Open Declaration

Source Here


For static import select the field and press Ctrl+Shift+M


Ctrl+Space : Show Imports

This displays imports as you're typing a non-standard class name provided the proper references have been added to the project.

This works on partial or complete class names as you are typing them or after the fact (Just place the cursor back on the class name with squigglies).


IntelliJ just inserts them automagically; no shortcut required. If the class name is ambiguous, it'll show me the list of possibilities to choose from. It reads my mind....