Bug 385310 - [navigation] Smart method hyperlink with subclass memory on Open Declaration
Summary: [navigation] Smart method hyperlink with subclass memory on Open Declaration
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-17 09:59 EDT by Markus Keller CLA
Modified: 2013-04-30 05:25 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2012-07-17 09:59:27 EDT
Remember the subclass when Open Declaration jumped to a superclass. In the superclass, add a smart method hyperlink that allows me to jump to the deepest implementation of the method as seen from the original subclass.

This is not a fully fledged-out proposal, but I just ran into this problem and want to capture my current thoughts on how the workflow could be improved.


A concrete use case:

I'm in org.eclipse.ui.internal.ide.handlers.OpenResourceHandler
#queryFileResource() line 159, and I need to know what dialog.open() does here:

    final OpenResourceDialog dialog = new OpenResourceDialog(parent, input,
		IResource.FILE);
    final int resultCode = dialog.open();

I can Ctrl+Click the open() method to see the implementation of the method. Then I'll jump to super.open(). Everything's fine so far.

But now I want to check out the create(); call. Ctrl+Click would take me to the implementation of this method in the Window class. But what I'm really interested in is the overriding method that will be called at run time. My context is still the OpenResourceDialog class where I started. So I'd like to jump to the implementation that is used in OpenResourceDialog, i.e. org.eclipse.ui.dialogs.FilteredItemsSelectionDialog#create().

Unfortunately, this implementation is quite hard to find. In Window, I can use the Open Implementation hyperlink, but that gives me a huge tree of overriding methods -- and OpenResourceDialog is not even there, since only a superclass overrides the method.

Currently, I have to remember the method name, go back to OpenResourceDialog, press Ctrl+O Ctrl+O, enter the method name, pick the right match (usually the first one), and then remember what I wanted to do.

=> The proposed smart method hyperlink should allow me to jump to the actual implementation directly.


Implementation hints:
- keep a map from type to recently visited subtype(s)
- update the map when the user navigates to super types via hyperlinks, Open Declaration, Quick Outline, Quick Type Hierarchy
- when the map contains a recent subtype and hyperlinks are computed for a method, then check whether there's a recent subtype. If yes and if one of the subtypes overrides the method, then show an additional method link
"Open Implementation in 'SubTypeName'"

Open questions:
- Can we determine the actual subtype even if a method invocation calls a method from a supertype (e.g. dialog.open() calls open from FilteredResourcesSelectionDialog, but it originally meant OpenResourceDialog#open())?
- When do we remove a subtype from the map? Do we need a way to explicitly remove subtypes?