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

Bug 228590

Summary: Gallery widget does not NotifySelectionListeners when Selection is removed
Product: z_Archived Reporter: Trevor Campbell <trevor>
Component: NebulaAssignee: Nicolas Richeton <nicolas.richeton>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P2 Keywords: plan
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip none

Description Trevor Campbell CLA 2008-04-23 23:59:32 EDT
Build ID: Build id: I20080207-1530
org.eclipse.nebula.widgets.gallery_1.0.0.200802110300.jar

Steps To Reproduce:
1. Create a view containing a Gallery widget. I used the NoGroupRenderer
2. Add a selection listener to the gallery, e.g. mGallery.addSelectionListener(mySelectionListener)
3. Populate the gallery with a set of images.  
4. Display the view and monitor the selection listener in debug mode while selecting and un-selecting (click away from an image) items in the view. 


More information:
This has the effect of making it pretty much impossible to toggle Actions depending on the selection state of the widget.

Both methods Gallery#setSelected() and Gallery#deselectAll() are probably implicated in this bug.
Comment 1 Nicolas Richeton CLA 2008-04-24 02:49:28 EDT
Fixed on CVS.
This may change the behavior of some app based on the widget. 
Comment 2 Nicolas Richeton CLA 2008-11-30 09:42:34 EST
New problem raised on newsgroups :

>I noticed that some of my actions weren't getting disabled when the gallery >selection became empty - ie something was selected, then click on a blank group >area, now nothing selected.
>
>Turns out that no SeletionEvent is fired by the Gallery in this situation.
>
>I've made a simple change to onMouseDown() which does the trick for me, to just >call notifySelectionListeners with a null GalleryItem. 

Need to check SWT API for this case.
Comment 3 Nicolas Richeton CLA 2009-04-16 03:12:17 EDT
Fixed > 20090416.
Behavior based on Cocoa 3.5M6 Table. 
Selection events are also sent on deselection with last previous item if there are still item selected or null if no more selected items. 

Change : on deselection (with Control), item is now one of the remaining item instead of the item that was deselected.
Comment 4 Nicolas Richeton CLA 2009-04-16 03:12:22 EDT
Created attachment 132024 [details]
mylyn/context/zip