Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 44277 - [navigation] Enable CTRL-mouse navigation for implementing classes
Summary: [navigation] Enable CTRL-mouse navigation for implementing classes
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P2 enhancement with 2 votes (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Raksha Vasisht CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 131537 197349 206685 256152 259038 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-07 04:10 EDT by Joni Freeman CLA
Modified: 2011-06-20 13:42 EDT (History)
11 users (show)

See Also:


Attachments
Ctrl+click now shows the implementation for methods. (20.39 KB, patch)
2009-02-25 06:11 EST, Raksha Vasisht CLA
daniel_megert: review-
Details | Diff
Patch with review changes. (19.80 KB, patch)
2009-02-26 06:36 EST, Raksha Vasisht CLA
daniel_megert: review-
Details | Diff
Made the minor changes. (25.25 KB, patch)
2009-02-27 03:19 EST, Raksha Vasisht CLA
no flags Details | Diff
Pls take this one. (19.63 KB, patch)
2009-02-27 03:24 EST, Raksha Vasisht CLA
daniel_megert: iplog+
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joni Freeman CLA 2003-10-07 04:10:24 EDT
In Eclipse it is very convinient to browse and navigate the sources with mouse
and CTRL key.  When a method where one tries to navigate is declared in an
interface, Ecplise always goes to the declaring interface. Popup window where a
concrete implementation of that method could be chosen would allow one to go
directly to the implementation class.
Comment 1 Dani Megert CLA 2003-10-08 08:27:26 EDT
There are plans to investigate such a behavior for hovers. This could probably
applied to [modifier] + click as well.
Comment 2 Dani Megert CLA 2007-07-09 11:45:05 EDT
You can use Ctrl+T.
Comment 3 Martin Aeschlimann CLA 2007-07-23 05:09:59 EDT
*** Bug 197349 has been marked as a duplicate of this bug. ***
Comment 4 Kamlesh Nanda CLA 2007-08-17 10:55:34 EDT
Is there any plan to address it any time soon. May be as a patch to Europa?
Comment 5 Dani Megert CLA 2007-08-21 06:35:02 EDT
We'll see what we can do for 3.4.
Comment 6 Martin Aeschlimann CLA 2007-10-18 05:32:42 EDT
*** Bug 206685 has been marked as a duplicate of this bug. ***
Comment 7 Martin Aeschlimann CLA 2007-10-18 05:33:20 EDT
Note: bug 206685 contains a patch implementing a suggestion
Comment 8 Dani Megert CLA 2008-04-24 08:08:13 EDT
We'll see how much we have to do during RC1.
Comment 9 Dani Megert CLA 2008-11-24 03:25:13 EST
*** Bug 256152 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2008-12-17 06:02:42 EST
*** Bug 259038 has been marked as a duplicate of this bug. ***
Comment 11 Dave Boden CLA 2008-12-18 05:07:04 EST
(In reply to comment #10)
> *** Bug 259038 has been marked as a duplicate of this bug. ***
> 

Thanks for marking the duplicate, apologies I didn't find the original bug myself.

Just a quick comment is that the resolution I had in mind for the bug I raised is slightly different to what's described in this bug report. Specifically, the concept of Eclipse remembering which implementation class you were last on and picking that by default. I'd prefer that to popping up a list of implementing classes. Crucially, I almost always want to go back to the implementing class that I was last looking at. However, for a totally consistent approach we need to consider the more complex case of when a method definition is in a *subclass* of the class you were last browsing. In that case, a popup will be required to navigate to the correct implementation subclass. It sounds really complex, but I think it could work well in practice.
Comment 12 Dani Megert CLA 2008-12-18 05:15:30 EST
I saw your ideas but there are no plans to add LRU behavior for that. Note that you are free to provide your own hyperlink detector which does this.
Comment 13 Raksha Vasisht CLA 2009-02-25 06:11:51 EST
Created attachment 126695 [details]
Ctrl+click now shows the implementation for methods.
Comment 14 Dani Megert CLA 2009-02-25 08:17:23 EST
Hi Raksha, the patch is not good:
- it gives NPE for methods without a receiver (i.e. for foo() instead of t.foo())
- it logs an error each time there's more than one match

Some minor issues:
- always log before doing work (I already mentioned that previously)
- don't catch OperationCanceledException
- only log in case of errors (not when interrupted)
- the new createHyperlink method can return 'null' but that's not documented
- in JavaElementHyperlinkDetector you define "IHyperlink link;" in the wrong
  scope as it is only used inside the for-loop
- two of your new strings are missing the JavaElementImplementationHyperlink_
  prefix
- as you can see from the class name we write "canceled" not "cancelled"
  NOTE: we use American English and not British English
- the hyperlink class has a warning (non-localized string)
- the operation canceled string is not needed: simply use the 0-arg constructor
- openTypeHierarchyForEditorInput has no Javadoc
- openTypeHierarchyForEditorInput is not a good name, use openQuickHierarchy 
  instead
- check 'type' for null at the top
- Searching all method declarations.. misses a third '.'
  NOTE: better would be "Searching for implementors of ''{0}''..." and fill in
  the element
Comment 15 Raksha Vasisht CLA 2009-02-26 06:36:19 EST
Created attachment 126838 [details]
Patch with review changes.
Comment 16 Dani Megert CLA 2009-02-26 09:47:23 EST
Sorry, but I have to reject the patch as several of my previous comments are still not fixed. 

>- the new createHyperlink method can return 'null' but that's not documented
Still not correct:
1. such things must be documented in @return (or @param for parameters).
2. it must be documented in the super class not in the subclass

- one file has a warning.
- local variables are still not declared closed to where they are used

Some other things:
- in case of a real exception (InvocationTargetException) we must not continue
- you could move the add
- why do you use Modifier.isAbstract instead of using Flags?
Comment 17 Dani Megert CLA 2009-02-26 09:49:33 EST
>- you could move the add
Forget about this (copy/paste problem)
Comment 18 Raksha Vasisht CLA 2009-02-27 03:19:39 EST
Created attachment 126960 [details]
Made the minor changes.
Comment 19 Raksha Vasisht CLA 2009-02-27 03:24:24 EST
Created attachment 126961 [details]
Pls take this one.
Comment 20 Dani Megert CLA 2009-02-27 04:13:57 EST
The patch is good. I committed it with some improved Javadoc and formatting.

There are some further issues that we need to look at:

- bug 266443: [navigation] JavaElementImplementationHyperlink does not work for method declarations
- bug 266442: [navigation] JavaElementImplementationHyperlink.open() must show dialog in case of error
Comment 21 Dani Megert CLA 2009-08-03 06:00:04 EDT
*** Bug 131537 has been marked as a duplicate of this bug. ***