Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 212191

Summary: Select All in Expression view does not send notifications
Product: [Eclipse Project] Platform Reporter: Daniel Friederich <danielfriederich>
Component: DebugAssignee: Platform-Debug-Inbox <platform-debug-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, darin.eclipse
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Daniel Friederich CLA 2007-12-06 15:15:17 EST
Build ID: I20070621-1340

Steps To Reproduce:
1. start eclipse, open Expression view.
2. remove all existing expressions
3. Using the context menu, add an expression "1"
4. Using the context menu, add an expression "2"
5. Using the context menu, Select All.
6. BUG: in context menu, Remove is disabled (also in Toolbar)
  This bug only happens if there was no expression selected, that's why step 2 deleted all existing ones.
7. Select the first expression 1
8. Using the context menu, Select All.
9. Select Delete from context menu
10. Bug. only expression "1" got deleted.



More information:
The problem is that the select all action is just calling into 
SWT's Tree control and calls SelectAll.

org.eclipse.debug.internal.ui.actions.SelectAllAction:

		if (control instanceof Tree) {
			((Tree)control).selectAll();
		}

Now SWT does not send out any selection changed notification for this.

I'm not sure if SWT is supposed to do this, if so, its a SWT bug. If not its a debugger UI bug.

I will attach a fix triggering the change notification from the debugger UI as the same thing is already done for the breakpoint select all action.
Comment 1 Daniel Friederich CLA 2007-12-06 15:19:02 EST
A fix which works for me is to explicitly repeat the selection in 
rg.eclipse.debug.internal.ui.actions.SelectAllAction


	/**
	 * @see IActionDelegate#run(IAction)
	 */
	public void run(IAction action){
		if (!(getView() instanceof IDebugView)) {
			return;
		}
		Viewer viewer = ((IDebugView) getView()).getViewer();
		Control control = viewer.getControl();
		if (control instanceof Tree) {
			((Tree)control).selectAll();
		}
		// ensure that the selection change callback is fired. 
		// as in SelectAllBreakpointsAction
		IWorkbenchPartSite site = getView().getSite();
		if (site != null) {
			ISelectionProvider selectionProvider= site.getSelectionProvider();
			if (selectionProvider != null) {
				ISelection sel= selectionProvider.getSelection();
				if (sel != null) {
					selectionProvider.setSelection(sel);
				}
			}
		}
		
	}


I don't think this is especially elegant, but its basically the same as it is done for the SelectAllBreakpointsAction already.
That fix assumes that the bug is in the debug UI, not sure if it is not in the SWT instead. I did not see where that part of the SWT behavior is explicitly defined.

Comment 2 Curtis Windatt CLA 2007-12-06 17:45:44 EST
Might be related to Bug 148553.
Comment 3 Daniel Friederich CLA 2007-12-11 08:50:12 EST
When looking into the sources noted that it was actually fixed already
as bug 195160 :-)
I did search for a bug previously, but I failed to find it.

*** This bug has been marked as a duplicate of bug 195160 ***
Comment 4 Daniel Friederich CLA 2007-12-11 08:52:00 EST
sorry, last comment went to the wrong bug.
Comment 5 Daniel Friederich CLA 2007-12-11 09:42:02 EST
(In reply to comment #2)
> Might be related to Bug 148553.
> 

Yes, they are related.
The fix in this bug also worked for the 148553 bug, basically both cases are suffering from a missing selection notification.
The observed behavior though is a bit different, so I did not mark this one as duplicate.
Comment 6 Darin Wright CLA 2009-06-05 14:34:15 EDT
Fixed in 3.5

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