This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 142112 - [65cat] Introduce "Go to Implementation" or change "Go to Declaration"
Summary: [65cat] Introduce "Go to Implementation" or change "Go to Declaration"
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Navigation (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 18 votes (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 18358 62015 104311 170558 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-29 18:23 UTC by piero
Modified: 2012-11-28 22:33 UTC (History)
8 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Screenshot how it looks like in IntelliJ IDEA (79.30 KB, image/jpeg)
2008-07-31 12:40 UTC, piero
Details

Note You need to log in before you can comment on or make changes to this bug.
Description piero 2008-07-29 18:23:28 UTC
While navigating through my source I often use CTRL+B.
The annoying part is that this opens up the interface, not a specific 
implementation. In most cases the interface is not that interesting... but 
the implementation is.

Couldn't the IDE bring me to the implementation instead of the interface in 
cases where only one implementation exists? If there exists more than one 
implementation, it could be smart enough to bring me to the one that I 
instantiated earlier. Or at least give me the option to choose where to jump.

There is a thread on the NetCat Mailing list as well:
http://www.nabble.com/-65cat--RFE%3A-CTRL%2BB-td18716473.html
Comment 1 piero 2008-07-29 18:41:42 UTC
Daniel Sheppard brought up a good point on the Mailing List.
Maybe it would be better to introduce a new Shortcut named "Go To Implementation" instead of overwrite the existing "Go 
To Declaration".


Comment 2 piero 2008-07-31 12:40:53 UTC
Created attachment 66162 [details]
Screenshot how it looks like in IntelliJ IDEA
Comment 3 nvarun 2008-07-31 15:44:55 UTC
Actually, the attached image, is a snapshot of Intelli J’s Java Editor, with Logical View of Project on the left. The
code shows, when you use a pre-defined shortcut key, on a method invocation (which is an implementation of an interface
method), the editor pop-up a code-completion like window with the list of classes that might have implemented that
particular method. That’s ridiculous! This is what Intelli J provides, so it contradicts Dynamic Binding concept, and
Piero wants to have such feature in NetBeans. Well, I would like to refine this RFE as follows-
In NetBeans, the user should have an option/shortcut key (as suggested by Daniel) to navigate to the implemented method,
analogous to the concept of dynamic binding. Not, what the image shows in Intelli J.

Following is the usecase-

 6 public class UserImpl implements User {
 7 
 8     public void callCheck() {
 9         callImpl();
10         new UserImpl().callImpl();
11     }
12 
13     public void callImpl() {
14         System.out.println("Implementation Invoked...");
15     }
16 
17     public static void main(String[] args) {
18         new UserImpl().callCheck();
19 
20         // Dynamic Binding...
21         User anonUser = new UserImpl();
22         anonUser.callImpl();
23     }
24 }
25 
26 interface User {
27 
28     public void callImpl();
29 };

Clicking on callImpl() in line #22, doesn't navigate to the implemented version of callImpl(), i.e. line #13. Instead,
user is navigated to line #28. So, this should not exist, hence Piero filed a RFE, and I hope this post makes it even
more clear, what enhancement is required.

This doesn't work for Windows too! I am using Windows XP SP2.
Comment 4 Vitezslav Stejskal 2008-08-01 08:54:04 UTC
*** Issue 62015 has been marked as a duplicate of this issue. ***
Comment 5 Vitezslav Stejskal 2008-08-01 08:54:17 UTC
*** Issue 18358 has been marked as a duplicate of this issue. ***
Comment 6 Tomas Pavek 2008-09-17 14:16:50 UTC
Aren't issue 104311 and issue 136532 duplicates as well?
Comment 7 pughbri 2009-01-31 18:16:46 UTC
Just a note that despite nvarun's comment that the intellij "go to implementations" is ridiculous, I personally (and
many developer I know where I work where intellij is heavily used) find it extremely useful and one of things that we
miss when we use Netbeans for some projects.  The small pop-up window with all possible implementations on the classpath
is very useful.  My experience is that 95% of the time I can quickly identify exactly which implementation I'm
interested in, select it, and be at the implementation I care about in a second or less without having needed to use the
mouse. It really helps navigate code quickly in my experience and I would love to see it in Netbeans.
Comment 8 nvarun 2009-06-29 08:13:22 UTC
@pughbri,

I think I sounded too harsh. I realized my mistake and had removed the same in my blog entry[1] last year itself.
However, I forgot to do the same here. I am again sorry for that comment. 

[1] http://nbguru.wordpress.com/2008/07/30/getting-your-basics-right/#comment-549

Hope this sounds better.
Comment 9 malfunction84 2009-07-15 20:24:19 UTC
It would be okay with me to combine "Go to Declaration" and "Go to Implementation" into a single shortcut.  The class
selection menu that appears could contain both declarations and implementations, perhaps with icons or color differences
to easily differentiate the two.  But I can also see why someone might want them to be separate.

Regardless of whether or not they are combined, if the class selection menu would only contain one class, it should jump
directly to that class and not display the menu.  In the "Go to Implementation" plug-in for previous versions of
NetBeans, this was not the case.  If there was only one implementation, it would display a menu containing that one
class, which adds an unnecessary extra click.
Comment 10 neolivz 2009-08-19 06:40:58 UTC
*** Issue 170558 has been marked as a duplicate of this issue. ***
Comment 11 malfunction84 2010-08-20 15:11:28 UTC
*** Bug 104311 has been marked as a duplicate of this bug. ***