Bug 74854 - [breakpoints] Ctrl+B should set a method breakpoint if invoked from the method signature
Summary: [breakpoints] Ctrl+B should set a method breakpoint if invoked from the metho...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.3 M1   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2004-09-23 16:23 EDT by Nick Edgar CLA
Modified: 2006-08-01 16:11 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 Nick Edgar CLA 2004-09-23 16:23:42 EDT
build I20040921

- went to set a breakpoint on Tree.releaseWidget():
  - Ctrl+Shift+T, Tree
  - Ctrl+O, releaseWidget
  - Ctrl+Shift+B
- wanted to see how many times this was called during shutdown
  - shutdown the target
  - the breakpoint was hit several times, making me think there was an error
- it turns out that the method was only getting called once, but because the
first line of releaseWidget() was a for loop, the breakpoint was being hit for
each iteration (I only figured this out when I happened to see the value for i
changing in the variables view)
(if you're interested in more details on this debug scenario, see
eclipse.platform.rcp newsgroup post: "Problem closing an RCP application")

The source for Tree.releaseWidget() is:
void releaseWidget () {
	for (int i=0; i<items.length; i++) {
		TreeItem item = items [i];
		if (item != null && !item.isDisposed ()) {
			item.releaseResources ();
		}
	}
...
}

This happened because Ctrl+Shift+B always sets a line breakpoint.
I think it would be less confusing if it set a method breakpoint if invoked when
the selection is on the method signature.
Comment 1 Darin Wright CLA 2004-09-23 16:29:50 EDT
Using the ruler double-click, and appropriate breakpoint is created (i.e. 
method vs. watchpoint vs. line breakpoint). We aren't doing the same thing for 
CTRL-Shift-B, as it invokes the "toggle line breakpoint" command. However, it 
seems like we should do the same thing.
Comment 2 Darin Wright CLA 2004-10-28 14:15:34 EDT
There is an issue to be careful of with this one: when a method declaration 
also contains the first line of a method, we should insert a line breakpoint 
in favour of a method breakpoint. Similarly, when a field contains an 
initializer, a line breakpoint should be installed. Thus, when "toggle line 
breakpoint" is invoked, the line breakpoint should have first priority over 
watchpoints/method breakpoints.
Comment 3 Nick Edgar CLA 2004-10-28 14:25:20 EDT
Just curious, why would a line breakpoint be preferable in the case where the
signature and first statement are on the same line?
Comment 4 Darin Wright CLA 2004-10-28 14:34:42 EDT
It might be preferrable (up to the user, not sure why). However, if we hard-
code the action to create only a method breakpoint in such situations, my 
observation is that there would be no way to create a line breakpoint, if that 
is what the user really wanted.
Comment 5 Darin Wright CLA 2005-04-04 10:20:04 EDT
We have introduced a new interface to toggle breakpoints (any kind). We would 
need to introduce a new action "toggle breakpoint", and bind to Ctrl-Shift-B.
Comment 6 Nick Edgar CLA 2005-04-04 10:33:04 EDT
Isn't Toggle Breakpoint already bound to Ctrl+Shift+B?  I use it a lot -- it's
much more consistent than using the ruler due to clutter there (even with
folding turned off).

Comment 7 Darin Wright CLA 2005-04-04 10:40:08 EDT
It's bound to "toggle *LINE* breakpoint", we want to bind it to "toggle *SOME 
KIND* of breakpoint". The double-click action allows the target action to 
determine what kind of breakpoint to create (i.e. not specific to line, 
method, watchpoint...).
Comment 8 Nick Edgar CLA 2005-04-04 10:57:38 EDT
OK, makes sense.
Comment 9 Darin Wright CLA 2005-04-18 11:06:12 EDT
Deferred. We think adding a "toggle breakpoint" action would confusing in the 
menu. We could bind ctrl-shift-B to the "toggle breakpoint" action, without 
placing it in the menu, but that is also confusing, as the key binding would 
not appear in any menu.
Comment 10 Darin Wright CLA 2006-08-01 13:29:21 EDT
Re-opening for 3.3
Comment 11 Darin Wright CLA 2006-08-01 13:31:32 EDT
Fixed. Added a new "Toggle Breakpoint" action in the Run menu bound to CTRL-Shift-B. This action uses the generic 'toggle breakpoint' adapter that clients provide or reverts to line breakpoints if clients only provider the 'toggle line breakpoint' function. This way a breakpoint of the appropriate type is created based on cursor location. The user can still create a line breakpoint specifically (for example, fields with initializer), by using the "Toggle Line Breakpoint" action specifically.
Comment 12 Darin Wright CLA 2006-08-01 13:34:19 EDT
Please verify, Mike.
Comment 13 Michael Rennie CLA 2006-08-01 16:11:31 EDT
verified.