SWT Gallery on Nebula

My SWT widget is on the nebula CVS.
The project is org.eclipse.nebula.widgets.galery :-)


  • david

    hi Nicolas,
    Thanks for your excellent widget. I am using it in my project.
    Could you help me about the selection listener in Gallery widget? I add a 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. I just want just one dialog, please help me,
    Thank you very much again.

    David

  • http://blog.richeton.com/ Nicolas Richeton

    Hi David,

    Can you try with the latest nightly build from http://www.eclipse.org/nebula/downloads.php ?
    If the problem still arises, please open a bug.

    In the mean time, you can try to keep track of opened dialogs and ensure that you don't open a dialog twice as a workaround.

  • david

    I just opened a bug in eclipse.org