eclipse 在eclipse中创建方法存根的快捷方式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2521940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Shortcut to create a method stub in eclipse
提问by Abhijeet Kashnia
I think some shortcut to create a method stub in eclipse might be useful. Does anyone know how to do it?
我认为在 eclipse 中创建方法存根的一些快捷方式可能很有用。有谁知道怎么做?
采纳答案by Ha.
Type public_method
(see Java/Editor/Templates in preferences for more options) or method name and press ctrl+space.
键入public_method
(有关更多选项,请参阅首选项中的 Java/Editor/Templates)或方法名称,然后按ctrl+ space。
回答by alexander
In Addtion to the accepted answer:
Typing pu
for a public method (with returntype
and name
)is enough:
除了已接受的答案:输入pu
公共方法(使用returntype
和name
)就足够了:
Type pu
and then hit CTRL+ SPACEand then ENTER.
键入pu
然后打CTRL+ SPACE,然后 ENTER。
回答by Mike
Type your method name and hit Ctrl+ Space.
输入您的方法名称并点击Ctrl+ Space。
Also worth noting is, type 'test' and hit Ctrl+ Spaceand it will give you the option to create a test method stub.
另外值得注意的是,键入“test”并点击Ctrl+ Space,它将为您提供创建测试方法存根的选项。
回答by jo_
How about loking to this link eclipse ref doc?
看看这个链接 eclipse ref doc怎么样?
It says that : Alt+ SHIFT+M" will do , plus many others.
它说: Alt+ SHIFT+ M“会做,再加上其他许多人。
回答by J.Holst
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.
如果按ALT+ SHIFT+ S。
有一个下拉菜单,然后选择覆盖/实现方法,您可以从那里以首选方式设置和实现该方法。
回答by Curtis Yallop
CTRL+ 1
CTRL+ 1
(COMMAND+ 1on Mac)
( COMMAND+1在 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.
如果不存在要复制的超类方法,并且您键入了类似“myClass.newMethod(myInt, myEmployee)”的内容,Eclipse 可以使用提供的参数类型在 myClass 中生成 newMethod。
回答by Curtis Yallop
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
创建方法存根的另一种快捷方式是 ALT+SHIFT+M。来源:http: //help.eclipse.org/juno/index.jsp?topic=/org.eclipse.jdt.doc.user/reference/ref-menu-refactor.htm