[HOWTO] CTRL+CLICK Method => Nav to implementation

I thought one could quickly navigate to the particular implementation of a method using the ctrl+click gesture.

If I have a class Foo that implements say the Runnable interface and I have:

public class Test {
public void someMethod() {
Foo foo = new Foo();
foo.run();
}
}

Shouldn't ctrl+click on run() above take me to Foo's run() and not the Runnable interface? Or am I maybe thinking of some other editor.

I realize that once in Runnable, I can select from one of the many classes in classpath the implement the method.

Sri

5 comments
Comment actions Permalink

Ctrl-Click goes to declaration, no implementation. It's the difference between Ctrl-B and Ctrl-Alt-B.

0
Comment actions Permalink

In fact it's customizable. Check keymap options.

--
Best regards,
Mike Aizatsky.
-


JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


0
Comment actions Permalink

OK, I see what what both Russell and Mike have pointed out.

However every time I ctrl+click on a method, I want to go to the implementation in the class that is in context. In the original example that's reproduced here,

public class Test {
public void someMethod() {
Foo foo = new Foo();
foo.run();
}
}


that would be the implementation in the class Foo. It is immaterial to me that the run() method is implemented by 18 other classes in my classpath.

I understand that I can customize the keymappings. However, is it possible to make IDEA see that I have clicked foo.run(); then since foo is of type Foo, look in the class Foo -- instead of presenting a list?

Sri

0
Comment actions Permalink

It should work exactly the same way you've described. And I actually have
checked this out and everything appears just OK.
Are you sure you declare
Foo foo = new Foo();

and not
Runnable foo = new Foo();

?

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Srivaths Sankaran" <sri.sankaran@sas.com> wrote in message
news:1341882.1055777532943.JavaMail.itn@is.intellij.net...

I thought one could quickly navigate to the particular implementation of a

method using the ctrl+click gesture.
>

If I have a class Foo that implements say the Runnable interface and I

have:
>

public class Test {
public void someMethod() {
Foo foo = new Foo();
foo.run();
}
}

>

Shouldn't ctrl+click on run() above take me to Foo's run() and not the

Runnable interface? Or am I maybe thinking of some other editor.
>

I realize that once in Runnable, I can select from one of the many classes

in classpath the implement the method.
>

Sri



0
Comment actions Permalink

You are correct. It was

Runnable foo = new Foo();

My mistake.

I wonder if it calls for too much mind reading if we want the same
functionality with the above declaration...:)

Sri


0

Please sign in to leave a comment.