Bug 122820 - [override method] create at cursor doesn't really insert at cursor
Summary: [override method] create at cursor doesn't really insert at cursor
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 100135 114384 168796 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-01-05 17:23 EST by Jon Barrilleaux CLA
Modified: 2008-05-09 04:55 EDT (History)
3 users (show)

See Also:
daniel_megert: review+


Attachments
patch (7.74 KB, patch)
2008-05-08 06:08 EDT, Martin Aeschlimann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Barrilleaux CLA 2006-01-05 17:23:09 EST
Often when I try to override/implement a method the "cursor position" choice is missing in the dialog.  I can't figure out the pattern of when it is or isn't offered, but it seems that it should ALWAYS be offered as an option.
Comment 1 Jon Barrilleaux CLA 2006-01-05 17:32:15 EST
After further testing it seems that the "cursor position" choice is missing if the cursor is between a comment ("//" or "/*") and any class member (field or method),
even if the cursor is on a blank line.
Comment 2 Frederic Fusier CLA 2006-02-03 11:17:46 EST
*** Bug 114384 has been marked as a duplicate of this bug. ***
Comment 3 Jon Barrilleaux CLA 2006-05-11 22:58:16 EDT
I just tested this in 3.2RC2 and the problem still exists.
Comment 4 Jon Barrilleaux CLA 2006-05-11 23:10:51 EDT
A closely related problem to the missing 'cursor position' choice is that when this is offered as a choice the insertion often occurs in the wrong place, such as after a comment when the cursor was positioned before the comment.

I also raised the severity of this bug because the inconsistent nature of the choice and insertion position of this valuable feature makes it almost useless in the general case (i.e. with insertions occuring any place in a file with typical Java '//' and '/**/' comments). 
Comment 5 Jon Barrilleaux CLA 2006-09-19 14:22:08 EDT
This bug is a major hassle, and renders this valuable and often used feature almost useless.  9 times out of 10 when I use override/implement the new code is inserted in the wrong place, so I have to go find it, and then move it to the correct place.

I have reported this problem on 3 separate occassions, in various ways, in various bugs reports, with great detail as to how to reproduce it, but it hasn't been corrected in the last two upgrade cysles.

As reported earlier, the problem is apparently due to this feature of eclipse not recognizing java comments correctly (// and /**), both when inserting the new code, and when determining whether or not to offer the "insert at cursor" choice.

Am I the only one having this problem?  Perhaps the original name of this bug was misleading as to its seriousness.  As such, I changed the name of this bug to better reflect the natuire of the bug (bad code insertion).  
Comment 6 Martin Aeschlimann CLA 2006-12-22 05:18:54 EST
*** Bug 168796 has been marked as a duplicate of this bug. ***
Comment 7 Dani Megert CLA 2008-01-21 11:21:35 EST
See also bug 215982 for some simple broken scenarios.
Comment 8 Martin Aeschlimann CLA 2008-05-08 04:02:55 EDT
*** Bug 100135 has been marked as a duplicate of this bug. ***
Comment 9 Martin Aeschlimann CLA 2008-05-08 05:58:10 EDT
You are right, we are promising too much here. Our code rewrite infrastructure isn't as fine granular that we can specify between which comments to insert. The only granularly is between which members. Changing is a bit of work that doesn't has priority and has to wait.

So I decided to remove the 'At cursor' insertion point an replace it with the 'After xy' that corresponds to the cursor position. I know that's probably not helping you much, but should help avoid other confusions. 

The workaround is to use code assist, which can also insert overridden methods.
Comment 10 Martin Aeschlimann CLA 2008-05-08 06:08:34 EDT
Created attachment 99250 [details]
patch

Patch removes the 'At cursor' insertion point and replaces it with the  corresponding 'Insert after x'
Comment 11 Martin Aeschlimann CLA 2008-05-08 06:09:48 EDT
Dani, can you review?
Comment 12 Dani Megert CLA 2008-05-08 06:55:31 EDT
Patch is good.

I would prefer 'First/Last member' and to propose to insert after the method when the caret is inside a method (currently it's 'Last').
Comment 13 Martin Aeschlimann CLA 2008-05-08 07:12:30 EDT
patch released with the 2 changes suggested > 20080508
Comment 14 Martin Aeschlimann CLA 2008-05-08 07:57:33 EDT
marking as fixed. 
Comment 15 Jon Barrilleaux CLA 2008-05-08 11:51:24 EDT
This bug is NOT fixed nor is it resolved!  All you did was put a bandaid on it, which is fine for now and understandable given your explanation.  However, the bug that was reported is NOT fixed nor resolved. PLEASE leave this bug open so that I won't have to go through this whole tra-la-la again.  This has been dragging on for years now in various forms and missteps.  If need be, reclassify it as a feature request, but don't just drop it.

--jon.
Comment 16 Martin Aeschlimann CLA 2008-05-08 12:04:29 EDT
I understand what you say, and I also hesitated to set it to 'FIXED'. Problem is: the 'insert at cursor position' doesn't exist anymore. This bug is either invalid or fixed. You choose.

If you want the feature 'insert at cursor position' back, then file a new enhancement request. I think that's the cleanest way.
Comment 17 Jon Barrilleaux CLA 2008-05-08 21:41:02 EDT
I changed the severity to "enhancement".  That way the trail of tears as well as the interim bandaids can be preserved for posterity.

--jon
Comment 18 Martin Aeschlimann CLA 2008-05-09 04:51:53 EDT
I prefer a new bug. This one already contains multiple comments dealing with the old state of the feature.
Comment 19 Martin Aeschlimann CLA 2008-05-09 04:55:51 EDT
I filed new bug request bug 231265 for this. Please add additional comments there.