Eclipse Shortcut to open method implementation

Eclipse Shortcut:

Eclipse shortcut keys are really useful for Java developers. In this article we will see how to set up eclipse shortcut to open method implementation directly. Normally, to open method implementation, we used to press the ctrl button and place the cursor over the method name and click the open implementation link. This can be made simple by setting up a shortcut key.

Quite often while working in Java files we might want to navigate to variable/method declaration. In order to navigate quickly, we can place the cursor in the variable/method name and press F3 button which takes us to the variable/method declaration. I think in eclipse F3 is set as shortcut key by default for this.

But to navigate to method implementation instead of method declaration, no shortcut is setup by default. This is quite needed because most often we will be using reference of interfaces to call a method. In this case if you place the cursor in the method name and press F3, it will only take you to the method definition in the interface. But we want to go to the method implementation defined in the implementation class. Here is how to set the shortcut key.

1. Go to Window->Preferences->General->Keys.

eclipse keys

2. Type “Open Implementation” in the search box. Select the result.

eclipse open implementation

3. Place the cursor under binding and press F4 as the shortcut key(or any key you desire. Don’t select the key which is already set as key for some other functionality). Select “In Windows” under the option When:(This says where/when this shortcut should apply)eclipse key binding

4. Click OK.
5. Now keep the cursor in method name and press F4. You will see that it takes you to method implementation.

You can do similar steps to setup shortcut for any functionality you desire e.g. Open project, close project, copy qualified name etc.

The following two tabs change content below.
Working as a Java developer since 2010. Passionate about programming in Java. I am a part time blogger.

Add Comment

Required fields are marked *. Your email address will not be published.