Bug 303553 - [breakpoints] No property action in breakpoints view
Summary: [breakpoints] No property action in breakpoints view
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 7.0   Edit
Assignee: Pawel Piech CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-22 16:40 EST by Patrick Chuong CLA
Modified: 2010-05-28 12:19 EDT (History)
2 users (show)

See Also:
john.cortell: review+


Attachments
Fix. (12.14 KB, patch)
2010-03-05 13:44 EST, Pawel Piech CLA
john.cortell: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Chuong CLA 2010-02-22 16:40:18 EST
Build Identifier: HEAD

The property action is missing from the breakpoints view when there is a DSF-GDB debug session active.

Using platform 3.6M5, this action is not visible.

Reproducible: Always
Comment 1 Pawel Piech CLA 2010-03-05 13:44:01 EST
Created attachment 161161 [details]
Fix.

This patch converts the brakpoint properties action into a handler that gets the breakpoint object through getAdapter()... so that it works with DSF wrappers in view.
Comment 2 Pawel Piech CLA 2010-03-05 13:45:14 EST
I committed the fix.  John, please review.
Comment 3 John Cortell CLA 2010-03-05 14:59:04 EST
Some insight into why this wasn't working:

DSF makes use of the recently added flexible-hierarchy support in the Breakpoints view. Even though ICBreakpoints are being created (by default in stock CDT), the Breakpoints view's model elements aren't CBreakpoints when a DSF session is the active debug context. Rather, they are DSF BreakpointVMContext objects. The Properties action was an object contribution tied to ICBreakpoint.
Comment 4 John Cortell CLA 2010-03-05 15:26:53 EST
Pawel, looks good. Just two points:

1. CBreakpointPropertiesHandler.getBreakpoint(Object) should check that only one thing is selected; return null otherwise. Bringing up the properties dialog while multiple breakpoints are selected is confusing. Note that the previous objectContribution action was enabled for only 1.

2. Maybe I'm paranoid, but I would put an Assert.fail("not expecting this to be called") in each of the no-op'ed ISelectionProvider methods to validate assumptions about how PropertyDialogAction will or will not use the selection provider...if for no other reason, to guard against an unexpected future behavioral change.
Comment 5 Pawel Piech CLA 2010-03-05 15:40:50 EST
(In reply to comment #4)
> Pawel, looks good. Just two points:
> 
> 1. CBreakpointPropertiesHandler.getBreakpoint(Object) should check that only
> one thing is selected; return null otherwise. Bringing up the properties dialog
> while multiple breakpoints are selected is confusing. Note that the previous
> objectContribution action was enabled for only 1.
Good point.  I committed the change.

> 2. Maybe I'm paranoid, but I would put an Assert.fail("not expecting this to be
> called") in each of the no-op'ed ISelectionProvider methods to validate
> assumptions about how PropertyDialogAction will or will not use the selection
> provider...if for no other reason, to guard against an unexpected future
> behavioral change.
I'd rather avoid something that would create a regression...  this was a cut and paste job from the old action and I'm not too familiar with the properties dialog.
Comment 6 John Cortell CLA 2010-03-05 15:44:24 EST
(In reply to comment #5)

> > 2. Maybe I'm paranoid, but I would put an Assert.fail("not expecting this to be
> > called") in each of the no-op'ed ISelectionProvider methods to validate
> > assumptions about how PropertyDialogAction will or will not use the selection
> > provider...if for no other reason, to guard against an unexpected future
> > behavioral change.
> I'd rather avoid something that would create a regression...  this was a cut
> and paste job from the old action and I'm not too familiar with the properties
> dialog.

An assertion check wouldn't cause a regression for the end-user, as it's inactive in that environment. However, it would signal us (during development) that something unexpected and wrong is happening in the code--that we've made a bad assumption.
Comment 7 Pawel Piech CLA 2010-03-05 15:54:13 EST
(In reply to comment #6)
I added an assert in the setSelection() method.  The other ones could reasonably still be called by the dialog.
Comment 8 John Cortell CLA 2010-03-05 16:03:24 EST
True. Even if someone calls the provider to register a selection changed listener, since we know the selection can't change (we now assert that), we'd never have a reason to call the listeners. Thus it would be pointless for the provider to record any listeners; i.e., the no-op is a valid implementation. Thanks.
Comment 9 John Cortell CLA 2010-03-05 16:06:35 EST
BTW, can you tell I've been buried in junit code lately by my recommendation to use Assert.fail()? :-)
Comment 10 Patrick Chuong CLA 2010-03-15 11:21:48 EDT
With this patch, I am not seeing the "Properties..." menu action in the breakpoints view.

Also, there is an exception 

Unable to create menu item "org.eclipse.cdt.debug.menu.command.breakpointProperties", command "org.eclipse.cdt.debug.command.breakpointProperties" not defined
Comment 11 Pawel Piech CLA 2010-03-15 11:30:37 EDT
(In reply to comment #10)
> With this patch, I am not seeing the "Properties..." menu action in the
> breakpoints view.
> 
> Also, there is an exception 
> 
> Unable to create menu item
> "org.eclipse.cdt.debug.menu.command.breakpointProperties", command
> "org.eclipse.cdt.debug.command.breakpointProperties" not defined

Are you able to debug this further.  The patch included a org.eclipse.cdt.debug.command.breakpointProperties command.  Also, are you seeing this for CDI, DSF-GDB, etc?
Comment 12 Patrick Chuong CLA 2010-03-15 11:39:50 EDT
(In reply to comment #11)
> Are you able to debug this further.  The patch included a
> org.eclipse.cdt.debug.command.breakpointProperties command.  Also, are you
> seeing this for CDI, DSF-GDB, etc?

I don't see the command (org.eclipse.cdt.debug.command.breakpointProperties) being defined anywhere in the xml file for the org.eclipse.ui.commands extension point.

I am using dsf-gdb with a CLine breakpoint, with the platform HEAD and CDT HEAD.
Comment 13 Patrick Chuong CLA 2010-03-15 11:41:21 EDT
one additional note: without an active debug session, I don't see the menu action in the breakpoints view.
Comment 14 Pawel Piech CLA 2010-03-15 12:05:16 EDT
(In reply to comment #12)
> I don't see the command (org.eclipse.cdt.debug.command.breakpointProperties)
> being defined anywhere in the xml file for the org.eclipse.ui.commands
> extension point.
Looks like John refactored it out when removing the CDI disassembly view.
Comment 15 John Cortell CLA 2010-03-15 12:10:16 EDT
(In reply to comment #14)
> (In reply to comment #12)
> > I don't see the command (org.eclipse.cdt.debug.command.breakpointProperties)
> > being defined anywhere in the xml file for the org.eclipse.ui.commands
> > extension point.
> Looks like John refactored it out when removing the CDI disassembly view.

Not intentionally. I'm on it...
Comment 16 Pawel Piech CLA 2010-03-15 12:13:18 EDT
(In reply to comment #15)
> > Looks like John refactored it out when removing the CDI disassembly view.
> 
> Not intentionally. I'm on it...

I had a moment of hesitation when placing the declaration along with the disassembly commands, but laziness prevailed.  I filed a separate bug 305875 ...
Comment 17 John Cortell CLA 2010-03-15 12:18:53 EDT
(In reply to comment #16)
> (In reply to comment #15)
> > > Looks like John refactored it out when removing the CDI disassembly view.
> > 
> > Not intentionally. I'm on it...
> 
> I had a moment of hesitation when placing the declaration along with the
> disassembly commands, but laziness prevailed.  I filed a separate bug 305875
> ...

Laziness + sloppiness = missing feature.