private void hookDoubleClickAction() {
   viewer.addDoubleClickListener(
       new IDoubleClickListener() {
         public void doubleClick(DoubleClickEvent event) {
           doubleClickAction.run();
         }
       });
 }
Example #2
0
  protected void createViewer(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    fExportPart.createControl(composite);
    GridData gd = (GridData) fExportPart.getControl().getLayoutData();
    gd.heightHint = 125;
    gd.widthHint = 150;
    gd.horizontalSpan = 2;

    TableViewer viewer = fExportPart.getTableViewer();
    viewer.setContentProvider(new ExportListProvider());
    viewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    viewer.setComparator(ListUtil.PLUGIN_COMPARATOR);
    viewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            if (event.getSource() instanceof CheckboxTableViewer) {
              IStructuredSelection selection = (IStructuredSelection) event.getSelection();
              ((CheckboxTableViewer) event.getSource())
                  .setChecked(
                      selection.getFirstElement(),
                      !((CheckboxTableViewer) event.getSource())
                          .getChecked(selection.getFirstElement()));
              fExportPart.updateCounter(
                  ((CheckboxTableViewer) event.getSource()).getCheckedElements().length);
            }
          }
        });
    fExportPart.getTableViewer().setInput(getInput());
  }