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

Bug 313895

Summary: click once gets response twice with gallery selection listener
Product: z_Archived Reporter: David Song <micromms>
Component: NebulaAssignee: Nicolas Richeton <nicolas.richeton>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: laurent.caron
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description David Song CLA 2010-05-21 07:20:23 EDT
Build Identifier: 20100506-2000

selection listener to the gallery just like below:

Gallery gallery = new Gallery(info, SWT.BORDER | SWT.VIRTUAL | SWT.V_SCROLL);
gallery.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));

gallery.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
GalleryItem item = (GalleryItem)e.item;
new ImagePreviewDialog(getShell(), item.getImage(), item.getText(), item.getDescription()).open();
}
});

DefaultGalleryGroupRenderer gr = new DefaultGalleryGroupRenderer();
gr.setMinMargin(2);
gr.setItemHeight(56);
gr.setItemWidth(72);
gr.setAutoMargin(true);
gr.setFillIfSingleColumn(true);
gallery.setGroupRenderer(gr);

ListItemRenderer gi = new ListItemRenderer();
gi.setShowLabels(true);
gallery.setItemRenderer(gi);

InputStream input = null;
Image img = null;
//add the licence image
GalleryItem licenceGroup = new GalleryItem(gallery, SWT.NONE);
licenceGroup.setExpanded(false);

licenceGroup.setText("Licence");
try {
GalleryItem licence = new GalleryItem(licenceGroup, SWT.NONE);
input = c.getLicenceCopy().getBinaryStream();
img = new Image(getShell().getDisplay(), input);
licence.setText("Licence");
licence.setImage(img);
} catch (Exception e) {
e.printStackTrace();
}

//add attachement images
GalleryItem attachmentGroup = new GalleryItem(gallery, SWT.NONE);
attachmentGroup.setExpanded(false);
attachmentGroup.setText("Attachment");

for (CustomerAttachment attchment : c.getAttachments()) {
try {
GalleryItem group = new GalleryItem(attachmentGroup, SWT.NONE);
group.setText(attchment.getTitle()); //$NON-NLS-1$
input = attchment.getAttachment().getBinaryStream();
img = new Image(getShell().getDisplay(), input);
group.setImage(img);
group.setDescription(attchment.getMemo());
} catch (SQLException e) {
e.printStackTrace();
}
}

but when I click on the item, the same dialog opened twice.

Reproducible: Always
Comment 1 Laurent CARON CLA 2019-09-19 08:47:52 EDT
Tried this today, the bug is no longer existing.