16

Say I have:

public class A extends B {
  /* autocompletion doesn't suggests protected methods from B to 
     override with Ctrl+SPACE
  */
}

I'm currently using Intellij IDEA 11.0.2.

Octavian Helm
  • 39,405
  • 19
  • 98
  • 102
kaneda
  • 5,981
  • 8
  • 48
  • 73

3 Answers3

21

Right click in your editor pane for class A, go to 'Generate...' -> 'Override Methods...'.

You'll then be presented with a list of all methods that can be overridden.

'Generate...' can also be called up via keyboard shortcuts, I'm on a Mac currently and it's ^N. IIRC the shortcut on Windows/Linux is Alt-Insert.

darrengorman
  • 12,952
  • 2
  • 23
  • 24
  • Thanks! I'm currently on Linux, the shortcut to the 'Override Methods' is CTRL + O as MalsR said in his answer above. – kaneda Apr 02 '12 at 22:36
  • 2
    This is stupid, not your answer, why don't they make it autocomplete for you like how Xcode does it. – mskw Jul 02 '14 at 20:57
12

Tried to add this as a comment but the keyboard shortcuts are clear when added as a reply ;)

Once in your subclass do CTRL + O (Windows) this will list the methods that you can override, which includes the standard ones as well as the methods from your superclass.

Additional Info (Not related to question): Also posted a link that contains some other very useful intelliJ shorcuts if they are of use to you. IntelliJ shortcuts that I can't find

Community
  • 1
  • 1
MalsR
  • 1,197
  • 1
  • 12
  • 23
  • 1
    Thank you MalsR for the shortcut tip (which also is the same at Linux). Also thank you for the link. I will check it out. – kaneda Apr 02 '12 at 22:37
2

On Mac with the latest Intellij (13), use Code > Override Methods... and start to type the method you want to override, it will automatically generate the whole method with the @Override annotation for you

The shortcut for this is Cmd + O

Thai Tran
  • 9,815
  • 7
  • 43
  • 64