Abhijeet Kashnia
Abhijeet Kashnia

Reputation: 12880

Shortcut to create a method stub in eclipse

I think some shortcut to create a method stub in eclipse might be useful. Does anyone know how to do it?

Upvotes: 21

Views: 40750

Answers (7)

Curtis Yallop
Curtis Yallop

Reputation: 7309

CTRL + 1

(COMMAND + 1 on Mac)

If no superclass method exists to copy and you typed something like "myClass.newMethod(myInt, myEmployee)", Eclipse can generate newMethod in myClass using the types of the arguments provided.

Upvotes: 1

alexander
alexander

Reputation: 1342

In Addtion to the accepted answer: Typing pu for a public method (with returntype and name)is enough:

Type pu and then hit CTRL + SPACE and then ENTER.

Upvotes: 10

jo_
jo_

Reputation: 191

How about loking to this link eclipse ref doc?

It says that : Alt + SHIFT+M" will do , plus many others.

Upvotes: 5

J.Holst
J.Holst

Reputation: 21

If you press ALT + SHIFT+ S.
There comes a dropdown, then select the override/implement methods, from there you can setup and implement the method in the prefered way.

Upvotes: 2

user2142913
user2142913

Reputation:

One other shortcut to create a method stub is ALT+SHIFT+M. source: http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-menu-refactor.htm

Upvotes: 1

Mike
Mike

Reputation: 4550

Type your method name and hit Ctrl + Space.

Also worth noting is, type 'test' and hit Ctrl + Space and it will give you the option to create a test method stub.

Upvotes: 6

Ha.
Ha.

Reputation: 3454

Type public_method (see Java/Editor/Templates in preferences for more options) or method name and press ctrl+space.

Upvotes: 17

Related Questions