Bug 39943 - [navigation] outliner auto-changes selection (multi-fields)
Summary: [navigation] outliner auto-changes selection (multi-fields)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-11 12:20 EDT by Adam Kiezun CLA
Modified: 2004-02-12 10:51 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Kiezun CLA 2003-07-11 12:20:03 EDT
20030703+jdtui0709

create this:
package p;
class A {
	private int var11, var2, var3;
}
in the outliner, select var3
notice that the selection in the outliner _automatically_ changes to var11
Comment 1 Adam Kiezun CLA 2003-07-11 12:25:12 EDT
actually, the field don't have to be all on 1 line
Comment 2 Dani Megert CLA 2003-07-18 08:08:45 EDT
can you explain what you mean with comment 1? It works for me if the fields are
declared one per line.

Will investigate.
Comment 3 Dani Megert CLA 2003-07-18 08:16:48 EDT
Debugged the code. The position used to ask the CU for the element is correct.
Moving to JDT Core for further investigation.
Comment 4 Olivier Thomann CLA 2003-07-28 13:35:46 EDT
This happens only if the "Link with editor" option is selected.
Could you please let me know what code is called at that moment?
Comment 5 Olivier Thomann CLA 2003-07-28 15:14:09 EDT
Cannot reproduce it after getting HEAD contents of jdt.ui. I get it if I use the
plugin org.eclipse.jdt.ui from the 0723 integration build.
Moving back to JDT/UI to investigate if it still occurs. I suspect something was
boggus in ui code.
Comment 6 Dani Megert CLA 2003-11-14 02:51:12 EST
Here are the steps to reproduce using I20031113

1. download and install the build to a new location
2. start with a fresh workspace
3. create Java project J and switch to the Java perspective
4. create class A in default package with the following content
class A {
	private int var11, var2, var3;
}
5. click into the field names in the Java editor and observe: it always selects
the first field in the Outline view no matter which one you select in the editor

Set a breakpoint in JavaEditor.computeHighlightRange() at the line:
IJavaElement element= getElementAt(caret, false);

Moved milestone target from M4 to M5 (feel free to remove it, if this cannot be
done for M5).
Comment 7 Philipe Mulet CLA 2003-11-14 05:23:54 EST
The source range of a multiple field declaration is overlapping (the type is 
included for all of them). 
Comment 8 Jerome Lanneluc CLA 2004-01-06 12:01:46 EST
Changed JavaElement.getSourceElementAt(int) to look at the name range in the 
case of a multi-fields declaration.

Added regression tests CompilationUnitTests.getElementAt3() to getElementAt6()
Comment 9 David Audel CLA 2004-02-12 10:51:13 EST
Verified for 3.0M7