开发者

How can I quickly lookup an interface method's parameters from the Eclipse editor (Java)?

I am using Eclipse 3.5.2 for my Java projects. Here is an example of what I'd like to do. Given the class object I am creating for an Android project:

public class Test1 extends Activity implements TextWatcher {

I need to define 3 methods to satisfy the TextWatcher interface: beforeTextChanged(), onTextChanged(), afterTextChanged(). I wou开发者_JAVA百科ld like to be able to quickly look up the parameters for each method, after I've finished typing the method name. For example, suppose I just added the line:

public void afterTextChanged()

I would like to be able to see the method declaration template so I can easily fill out the parameter list declaration for my implementation of that method. I tried every option in the Content Assist menu that I could find and did not get any proposals. Is there a way to do this? I guess I'm looking for the functionality provided by the New Class dialog, but in a way that works with an existing class that I am extending to support a new interface, not a new class.

If there is a way to do this, then even better, is there a way to get the documentation's parameter list declaration pasted in without having to retype them myself?

-- roschler


1) Check this out: alt+shift+s -> override/implement methods

2) Also, somewhere in the class body press ctrl+space and select "afterTextChanged"

3) place your cursor in the first line of class declaration ("public class..."), press ctrl+1 and select "add unimplemented methods"


If you already know the method name and just want to see its parameters, then press ctrl+space after you type the (

So, in your case type

public void afterTextChanged(

and then ctrl+space.

You can also do ctrl+O to see all the methods for the current class. Press again ctrl+O to see all methods from the current class and ancestors

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜