score:189

Accepted answer

ctrl + shift + o (<-- an 'o' not a zero)

note: this shortcut also removes unused imports.

score:0

for static import select the field and press ctrl+shift+m

score:0

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

score:1

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

score:2

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).

score:3

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....

score:6

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.

score:20

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 is originally used with other chars by shell for perform special function. (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

score:45

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


Related Query

More Query from same tag