Bug 77988 - Wrong "target location" logic when right-clicking in the Java editor
Summary: Wrong "target location" logic when right-clicking in the Java editor
Status: RESOLVED DUPLICATE of bug 19825
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-05 15:31 EST by Allan Pratt CLA
Modified: 2004-11-08 05:21 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 Allan Pratt CLA 2004-11-05 15:31:03 EST
When you right-click in the Java editor to bring up a context menu, the 
editor's notion of the target (the point of interest in the source code) comes 
from the location of the text cursor, but it should be based on the location of 
the mouse pointer when the right-click occured.

Example:

class BugDemo {
	static int  methodOne() {
		return 1;
	}
	static int  methodTwo() {
		return 2;
	}
}

1. Left-click so the type-in cursor is inside the word "methodOne"
2. Move the mouse so it is over the word "methodTwo"
3. Right-click, choose Refactor/Move.

You will see that you are moving methodOne, even though you right-clicked on 
methodTwo.

All target-sensitive operations on the context menu suffer from this, not just 
refactoring: "Source/Toggle comment" and "References" both also use the text 
cursor location as the target location.
Comment 1 Dirk Baeumer CLA 2004-11-07 13:54:41 EST
my two cents:

- if the selection's length != 0 this is not the desired behaviour
- if we do something for length == 0 then a right mouse click should move the 
  cursor. Otherwise it will be very confusing.

Moving to Text.
Comment 2 Dani Megert CLA 2004-11-08 05:21:00 EST

*** This bug has been marked as a duplicate of 19825 ***