Bug 14965 - Search results in .class files don't select reference
Summary: Search results in .class files don't select reference
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-30 16:54 EDT by Peter Burka CLA
Modified: 2002-05-14 13:23 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Burka CLA 2002-04-30 16:54:35 EDT
M5

If you do a search which finds results in .class files, and then double click 
on one of the results it should open the associated source file and select the 
source code which the search result refers to.

This behaves as expected if no editor is open on the .class file.

However if an editor is already open on the file, the editor is simply brought 
to the front. The only way to find the reference is to close the editor and 
double click on the search result again.
Comment 1 Dani Megert CLA 2002-05-02 12:36:14 EDT
Test case was not very accurate. It works for class files which are in an
internal JAR but not for class files coming from outside Eclipse i.e. external
JARs like JDK.

This problem was fixed some time ago and now seems to be back for some reason.
Asking the Kai (editor) for comment.
Comment 2 Dani Megert CLA 2002-05-02 12:42:34 EDT
The bug is also in build 20020501
Comment 3 Dani Megert CLA 2002-05-07 11:03:56 EDT
The problem is in JavaCore.isReferencedBy(...): because the handle identifier
contains the project name even for external resources we get false for the same
external element if it comes from a different project. This can happen if I
search for X and J Core finds X in project A while the editor already opened X
but from/via project B.
This can be fixed
a) if the handle identifier for external classes would not contain the project
b) if isReferencedBy would ignore the project when comparing external resources

NOTE: isReferencedBy should be improved because the Javadoc does not match the
code: the code only works for binary Java elements while the javadoc speaks for
all Java elements.

Moving to J Core
Comment 4 Philipe Mulet CLA 2002-05-13 07:04:33 EDT
Fixed by regenerating a marker/markerDelta element from the handleID. Element 
comparison supports matching external ones.

Note that this hasn't changed recently, and was thus wrong since day one when 
we adopted this helper method from UI land.

Fixed
Comment 5 Olivier Thomann CLA 2002-05-14 13:23:04 EDT
Fixed.