Bug 38510 - [navigation] Getting Java element for caret position editor should be smarter
Summary: [navigation] Getting Java element for caret position editor should be smarter
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 40252 30698
  Show dependency tree
 
Reported: 2003-06-05 08:27 EDT by Dirk Baeumer CLA
Modified: 2022-07-15 16:27 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 Dirk Baeumer CLA 2003-06-05 08:27:59 EDT
M1

Since the members view doesn't show types linking the view to the editor's 
caret should be more tolerant. For example

- Object field;<cursor> should select the field
- void foo() {
  } <cursor> should select the method

- <cursor> void foo() {
  } should select the method, even if the method doesn't have a java doc 
  comment
Comment 1 Dani Megert CLA 2003-06-05 09:34:12 EDT
This surfaces especially in the Members view because there is no selection
anymore. However, all other views and actions suffer the similar problem, e.g.
the Outline view removes the selection from the field and selects the parent (type).
Comment 2 Martin Aeschlimann CLA 2003-07-23 11:02:37 EDT
+1

moving to jdt.text
Comment 3 Dani Megert CLA 2003-07-25 04:40:48 EDT
Adapted summary.

The editor uses ICompilationUnit.getElementAt(int position) which returns the CU
if the caret is after the ;

Could JDT core try to guess the closest element? Otherwise JDT Text would have
to do this by sending multiple calls to getElementAt(int).
Comment 4 Philipe Mulet CLA 2003-07-25 05:46:25 EDT
The problem is that there is a match in the enclosing element, how could we not 
consider it ?
Comment 5 Philipe Mulet CLA 2003-07-25 05:49:40 EDT
Just to clarify, this API is doing exactly what it is supposed based on source 
ranges. The fact you do not want certain type of elements may simply indicate 
that you would need something different, since we have existing clients would 
likely need this behavior.

Deferring for now
Comment 6 Dani Megert CLA 2003-07-25 06:00:02 EDT
I agree that we would need another method (e.g. getting the element(s) for a
given range.

We will try to be smarter in our area to improve navigation fro Members and
Outline view.

Comment 7 Dani Megert CLA 2006-09-27 07:30:33 EDT
Reassigning to inbox since there are currently no plans to work on this.
Comment 8 Eclipse Genie CLA 2020-07-10 15:06:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 9 Eclipse Genie CLA 2022-07-15 16:27:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.