Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 259038

Summary: Subclass (implementation) context-sensitive navigation through hyperlinks in the Java editor
Product: [Eclipse Project] JDT Reporter: Dave Boden <dave>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert
Version: 3.4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Dave Boden CLA 2008-12-16 17:50:04 EST
Build ID: M20080911-1700

Steps To Reproduce:
//Please copy and paste the following into an Eclipse Java Editor:

//Look at the comments and follow the instructions in order
//within the Eclipse Java editor.
public class NavigationContext {
	class Subclass extends SClass {
		public void actionPerformed() {
			controlWorkflow(); //Ctrl-click here first
		}
		
		public void doSomething() {
			//Would be great if we ended up here after the 2nd click!
			System.out.println("Doing something very important.");
		}
	}
	
	abstract class SClass implements IFace {
		public void controlWorkflow() {
			doSomething(); //Ctrl-click here second
		}
	}
	
	interface IFace {
		void doSomething(); //Here's where we end up :o(
	}
}

More information:
In this example, we're looking at the behaviour of Subclass. We Ctrl-click to navigate to the controlWorkflow method defined in SClass. We then further Ctrl-click on doSomething().

It seems far more likely that the user would really like to be shown the doSomething implementation in Subclass. Thinking in a task-oriented way, the user is far more likely to be trying to follow through what a bit of code does (mimicking a debugger) than wanting to look at the abstract structure of the class.

The navigation could, in my opinion, perform better by remembering a specific subclass context when navigating to a superclass. It's the starting point of a task. So, in the above example, when navigating from SuperClass to SClass, the editor remembers that it has come from SuperClass and keeps that as context information. Then, when the second Ctrl-click occurs the editor can see that SuperClass has an implementation of doSomething and take the user there rather than the abstract definition of the method.

A single class context should suffice, but it may ultimately make sense to capture a context subclass across a number of different class hierarchies to help a user navigate to implementation methods rather than abstract declarations across a whole range of code.
Comment 1 Dani Megert CLA 2008-12-17 06:02:42 EST

*** This bug has been marked as a duplicate of bug 44277 ***