0

I am using Eclipse for about 5 years. Now I'm begging with IntelliJ Idea 13. I can not get used to code completion :-(

How can I create new public method?

In Eclipse i press:

pub CTRL+SPACE ENTER int CTRL+SPACE test ENTER

and get

public int test() {

}

how can I do it in Idea?

enter image description here

martin
  • 1,707
  • 6
  • 34
  • 62

3 Answers3

0

IF this scenario is important to you, You can use IntelliJ's Live Templates

Mike Ruder
  • 23
  • 3
0

You can add a 'Live Template' in IntelliJ. Go to Preferences -> Live Templates -> Select your language (if Java is not there, you can select Other), select the "+" symbol and add a new template. e.g. Abbreviation = test, and put your method in the Template text.

IntelliJ will display a message 'No applicaable contexts yet'. Define' just below the box. If you click on 'Define' you can select 'Java' in the list that shows up.

In your editor, type the template abbreviation and press the tab key.

Andy
  • 1,023
  • 1
  • 9
  • 17
  • I do not have Java in Live teplate, so I create my tpmplate in Other. After I write `pub` and press TAB I get `pub ` - pub and one space :-( – martin Oct 27 '14 at 01:06
  • 2
    When you add a new template, IntelliJ would have given you a message in red 'No applicaable contexts yet'. Define'. If you click on 'Define' you can select 'Java' in the list that shows up. It should then work. – Andy Oct 27 '14 at 01:14
0

There are no built-in templates for that. You can create your own, like other answers advise. But in general, just typing the method with autopopup completion seems to require almost the same number of key presses:

pub < autopopup appears with "public" selected, hit ENTER > int test( < CTRL+SHIFT+ENTER >

Peter Gromov
  • 17,615
  • 7
  • 49
  • 35