| Summary: | [navigation] Open Declaration should work like hyperlink in .java file not on classpath | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Text | Assignee: | Raksha Vasisht <raksha.vasisht> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | daniel_megert, deepakazad |
| Version: | 3.4 | ||
| Target Milestone: | 3.7 M1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Markus Keller
Like that since 3.4. We have bug 78522 for a command that does the same as hyperlinking. Regarding F3, we should leave it as is i.e. show the dialog and not the lightweight chooser. But of course I agree that functionality wise it should do the same. Test Case:
1. create a Java project with 'src' as source folder (default out of the box)
2. create file 'Test.java' in the project (not in 'src' folder) with this:
import java.util.HashMap;
public class Test {
void foo() {
bar();
}
private void bar() {
HashMap m= new HashMap();
m.isEmpty();
}
}
==> Ctrl+click works on "bar" inside 'foo', on "HashMap" and on "isEmpty" but F3 does not.
NOTE: It does work for Ctrl+click and F3 in the following example:
1. create a Java project with the project itself as the source folder
2. create file 'Test.java' in the project's '.settings' folder with this:
import java.util.HashMap;
public class Test {
void foo() {
bar();
}
private void bar() {
HashMap m= new HashMap();
m.isEmpty();
}
}
Example :
//File aaaa.java
package p;
public class aaaa {
public aaaa(){
aaaa a = new aaaa();
a.toString();
zoo z= new zoo();
z.foo();
}
@Override
public String toString(){
return "hi";
}
}
// File zoo.java
package p;
public class zoo {
public void foo() {
}
}
1) Create a new Java Project Test, paste the 2 files into the src folder .
2) Now remove src from build path. (Right click on Src Build Path -> Remove from Build Path
3) Ctrl+click on a.toString() -> works as normal
F3 -> gives an error : Cannot Perform Operation : The resource is not on the build path of a Java project.
4) Ctrl+click on zoo -> no hyperlink
F3 -> gives the same error as (3)
I looked into the code to fix step (3)(declaration in same class) , that should adopt the same logic as hyperlink and jump to the appropriate declaration but do we continue to show the error dialog for f3 in step(4) or is there anything else we want to do?
>F3 -> gives the same error as (3) Yes of course and this is acceptable as Markus already wrote in comment 0: >Ctrl+click works perfectly for members that are declared in the same file, and >it works reasonably well when I Ctrl+click other references (only opens types >that are on the classpath, but that's OK and expected). Fixed in HEAD. (In reply to comment #4) > >F3 -> gives the same error as (3) > Yes of course and this is acceptable as Markus already wrote in comment 0: > >Ctrl+click works perfectly for members that are declared in the same file, and > >it works reasonably well when I Ctrl+click other references (only opens types > >that are on the classpath, but that's OK and expected). We continue to show the error dialog in case of step 4 (outside references). (In reply to comment #6) > Fixed in HEAD. Fixed in org.eclipse.jdt.ui.actions.OpenAction. Verified with I20100802-1800 on Ubuntu. |