Example usage for org.eclipse.jface.viewers CheckboxTableViewer newCheckList

List of usage examples for org.eclipse.jface.viewers CheckboxTableViewer newCheckList

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers CheckboxTableViewer newCheckList.

Prototype

public static CheckboxTableViewer newCheckList(Composite parent, int style) 

Source Link

Document

Creates a table viewer on a newly-created table control under the given parent.

Usage

From source file:org.erlide.dialyzer.ui.prefs.DialyzerPreferencePage.java

License:Open Source License

private void createPltSelection(final Composite group) {
    final Composite composite = new Composite(group, SWT.NONE);
    composite.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    gd.horizontalSpan = 2;/*from w  w  w  .  ja v a 2  s . c  o m*/
    composite.setLayoutData(gd);
    final Label l = new Label(composite, SWT.NONE);
    l.setText("PLT files (multiple PLTs require Erlang/OTP R14B01 or later)");
    gd = new GridData();
    gd.horizontalSpan = 2;
    l.setLayoutData(gd);
    new Label(composite, SWT.NONE);
    fPLTTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
    fPLTTableViewer.setLabelProvider(new LabelProvider());
    fPLTTableViewer.setContentProvider(new ContentProvider());
    fPLTTableViewer.setInput(this);
    final Table table = fPLTTableViewer.getTable();
    table.

            addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent e) {
                    enableButtons();
                }
            });
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    gd.horizontalSpan = 2;
    table.setLayoutData(gd);
    gd.heightHint = convertHeightInCharsToPixels(12);
    final Composite buttons = new Composite(composite, SWT.NULL);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    final GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);
    fAddButton = createButton(buttons, "Add...", new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            addPLTFile();
        }
    });
    fEditButton = createButton(buttons, "Change...", new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            changeSelectedPLTFiles();
        }
    });
    fRemoveButton = createButton(buttons, "Remove", new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            removeSelectedPLTFiles();
        }
    });

    if (isProjectPreferencePage()) {
        fAddButton.setVisible(false);
        fEditButton.setVisible(false);
        fRemoveButton.setVisible(false);
    }
}

From source file:org.erlide.ui.launch.ErlangMainTab.java

License:Open Source License

/**
 * @param comp/*w w  w. jav a2  s.c  o  m*/
 */
private void createProjectsGroup(final Composite comp) {
    final Group projectsGroup = SWTUtil.createGroup(comp, "Projects", 2, GridData.FILL_HORIZONTAL);
    projectsTable = CheckboxTableViewer.newCheckList(projectsGroup, SWT.HIDE_SELECTION | SWT.BORDER);
    projectsTable.setLabelProvider(new ProjectsLabelProvider());
    projectsTable.setContentProvider(new ProjectsContentProvider());
    final Table table_1 = projectsTable.getTable();
    final GridData gd_table_1 = new GridData(SWT.LEFT, SWT.FILL, true, true);
    gd_table_1.widthHint = 287;
    gd_table_1.heightHint = 126;
    gd_table_1.minimumHeight = 108;
    gd_table_1.minimumWidth = 256;
    table_1.setLayoutData(gd_table_1);
    projectsTable.addCheckStateListener(new ICheckStateListener() {
        @Override
        @SuppressWarnings("synthetic-access")
        public void checkStateChanged(final CheckStateChangedEvent event) {
            updateLaunchConfigurationDialog();
        }
    });
}

From source file:org.erlide.ui.prefs.DialyzerPreferencePage.java

License:Open Source License

private void createPltSelection(final Composite group) {
    final Composite composite = new Composite(group, SWT.NONE);
    composite.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    composite.setLayoutData(gd);// w  w w .  j a  v a 2s. com
    final Label l = new Label(composite, SWT.NONE);
    l.setText("PLT files (multiple PLT requires Erlang/OTP R14B01 or later)");
    gd = new GridData();
    gd.horizontalSpan = 2;
    l.setLayoutData(gd);
    fPLTTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
    fPLTTableViewer.setLabelProvider(new LabelProvider());
    fPLTTableViewer.setContentProvider(new ContentProvider());
    fPLTTableViewer.setInput(this);
    // fPLTList = new org.eclipse.swt.widgets.List(composite, SWT.MULTI
    // | SWT.V_SCROLL | SWT.BORDER);
    final Table table = fPLTTableViewer.getTable();
    table.

            addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent e) {
                    enableButtons();
                }
            });
    // gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 3, 1);
    gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    gd.horizontalSpan = 2;
    table.setLayoutData(gd);
    gd.heightHint = convertHeightInCharsToPixels(12);
    final Composite buttons = new Composite(composite, SWT.NULL);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    final GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);
    gd = new GridData();
    gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
    fAddButton = new Button(buttons, SWT.PUSH);
    fAddButton.setText("Add...");
    fAddButton.setLayoutData(gd);
    fAddButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            addPLTFile();
        }
    });

    fEditButton = new Button(buttons, SWT.PUSH);
    fEditButton.setText("Change...");
    fEditButton.setLayoutData(gd);
    fEditButton.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(final Event evt) {
            changeSelectedPLTFiles();
        }
    });

    fRemoveButton = new Button(buttons, SWT.PUSH);
    fRemoveButton.setText("Remove");
    fRemoveButton.setLayoutData(gd);
    fRemoveButton.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(final Event evt) {
            removeSelectedPLTFiles();

        }
    });

    if (isProjectPreferencePage()) {
        fAddButton.setVisible(false);
        fEditButton.setVisible(false);
        fRemoveButton.setVisible(false);
    }
}

From source file:org.erlide.ui.wizards.EdocExportWizardPage.java

License:Open Source License

@Override
public void createControl(final Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    final GridLayout gridLayout = new GridLayout();
    composite.setLayout(gridLayout);/*from   w  w  w  . j a v a2s. c o  m*/
    setControl(composite);

    final Label selectProjectsForLabel = new Label(composite, SWT.NONE);
    selectProjectsForLabel.setLayoutData(new GridData());
    selectProjectsForLabel.setText("Select projects for which edoc documentation will be generated:");

    checkboxTableViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
    checkboxTableViewer.setContentProvider(new TableContentProvider());
    checkboxTableViewer.setLabelProvider(new TableLabelProvider());
    table = checkboxTableViewer.getTable();
    final GridData gd_table = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd_table.widthHint = 423;
    table.setLayoutData(gd_table);
    checkboxTableViewer.setInput(this);

    final Group optionsGroup = new Group(composite, SWT.NONE);
    optionsGroup.setText("Options");
    final GridData gd_optionsGroup = new GridData(SWT.FILL, SWT.CENTER, false, false);
    optionsGroup.setLayoutData(gd_optionsGroup);
    final GridLayout gridLayout_1 = new GridLayout();
    gridLayout_1.numColumns = 2;
    optionsGroup.setLayout(gridLayout_1);

    final Label selectLabel = new Label(optionsGroup, SWT.NONE);
    selectLabel.setText("Destination (relative to each project):");

    destination = new Text(optionsGroup, SWT.BORDER);
    final GridData gd_destination = new GridData(SWT.FILL, SWT.CENTER, false, false);
    gd_destination.widthHint = 179;
    destination.setLayoutData(gd_destination);
    destination.setText("doc");
}

From source file:org.fornax.cartridges.sculptor.framework.richclient.table.CustomizableTableViewer.java

License:Apache License

public static CustomizableTableViewer newCheckList(Composite parent, int style) {
    return new CustomizableTableViewer(CheckboxTableViewer.newCheckList(parent, style));
}

From source file:org.fornax.cartridges.sculptor.framework.richclient.table.CustomizableTableViewer.java

License:Apache License

public static CustomizableTableViewer newSingleCheckList(Composite parent, int style) {
    final CheckboxTableViewer checkedViewer = CheckboxTableViewer.newCheckList(parent, style);
    checkedViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(final org.eclipse.jface.viewers.CheckStateChangedEvent event) {
            checkedViewer.setCheckedElements(new Object[] { event.getElement() });
        }//from w w w .j  a va 2s .  c  om
    });

    return new CustomizableTableViewer(checkedViewer);
}

From source file:org.fusesource.ide.commons.ui.actions.ConfigureColumnsDialog.java

License:Open Source License

/**
 * Creates the columns viewer./*from   w w w  . j a v a  2 s. c  o m*/
 * 
 * @param parent
 *            The parent composite
 */
private void createColumnsViewer(Composite parent) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(Messages.configureColumnsMessage);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);

    columnsViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    columnsViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    columnsViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof ColumnConfiguration) {
                ColumnConfiguration config = (ColumnConfiguration) element;
                return config.getName();
            }
            return super.getText(element);
        }
    });
    columnsViewer.setContentProvider(new ArrayContentProvider());
}

From source file:org.fusesource.ide.foundation.ui.chart.TableChartDialog.java

License:Open Source License

/**
 * Creates the columns viewer./*  w ww .j  a  va 2s . c o  m*/
 * 
 * @param parent
 *            The parent composite
 */
private void createColumnsViewer(Composite parent) {
    Label label = new Label(parent, SWT.NONE);
    label.setText(Messages.configureColumnsMessage);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);

    columnsViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    columnsViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    columnsViewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof TableChartColumnInfo) {
                TableChartColumnInfo col = (TableChartColumnInfo) element;
                return col.getName();
            }
            return super.getText(element);
        }
    });
    columnsViewer.setContentProvider(new ArrayContentProvider());
}

From source file:org.gluster.storage.management.console.views.pages.AbstractTableViewerPage.java

License:Open Source License

private void createTableViewer(Composite parent) {
    int style = SWT.FLAT | SWT.FULL_SELECTION;
    style |= (multiSelection ? SWT.MULTI : SWT.SINGLE);

    if (useCheckboxes) {
        tableViewer = CheckboxTableViewer.newCheckList(parent, style);
    } else {//from w  w  w .  j  a  v  a 2s.  c o m
        tableViewer = new TableViewer(parent, style);
    }

    tableViewer.setLabelProvider(getLabelProvider());
    tableViewer.setContentProvider(getContentProvider());
    setupTable(parent, tableViewer.getTable());
}

From source file:org.gw4e.eclipse.launching.test.GW4ELaunchConfigurationTab.java

License:Open Source License

private void createAdditionalExecutionContextContainer(Composite parent) {

    Label lblNewLabel = new Label(compositeContainer, SWT.NONE);
    lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
    lblNewLabel.setText(MessageUtil.getString("additionalExecutionContext"));

    ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_QUALIFIED);
    fAdditionalTestViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
    fAdditionalTestViewer.setContentProvider(new IStructuredContentProvider() {
        @Override// w w w  . j  a v  a 2  s .  c  om
        public Object[] getElements(Object inputElement) {
            Display display = Display.getCurrent();
            Runnable longJob = new Runnable() {
                public void run() {
                    display.syncExec(new Runnable() {
                        public void run() {
                            if (inputElement == null) {
                                additionalExecutionContexts = new IType[0];
                            }
                            IType type = (IType) inputElement;
                            List<IType> all = null;
                            try {
                                all = JDTManager.getOrphanGraphWalkerClasses(type, doHint);
                            } catch (Exception e) {
                                ResourceManager.logException(e);
                                additionalExecutionContexts = new IType[0];
                            }
                            additionalExecutionContexts = new IType[all.size()];
                            all.toArray(additionalExecutionContexts);
                        }
                    });
                    display.wake();
                }
            };
            BusyIndicator.showWhile(display, longJob);
            return additionalExecutionContexts;
        }
    });
    fAdditionalTestViewer.setLabelProvider(labelProvider);
    fAdditionalTestViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
    fAdditionalTestViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            validatePage();
        }
    });
    fAdditionalTestViewer.getTable().setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,
            GW4E_LAUNCH_TEST_CONFIGURATION_ADDITIONAL_TEST);

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    GridData gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    composite.setLayoutData(gd);

    Composite compButtons = new Composite(composite, SWT.NONE);
    compButtons.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true, 1, 1));
    compButtons.setLayout(new FillLayout(SWT.VERTICAL));

    fSelectAllButton = new Button(compButtons, SWT.NONE);
    fSelectAllButton.setText(MessageUtil.getString("selectAll"));
    fSelectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            fAdditionalTestViewer.setAllChecked(true);
            validatePage();
        }
    });
    fSelectAllButton.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID,
            GW4E_LAUNCH_TEST_CONFIGURATION_SELECTALL_BUTTON);

    fDeselectAllButton = new Button(compButtons, SWT.NONE);
    fDeselectAllButton.setText(MessageUtil.getString("deselectAll"));

    fDeselectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            fAdditionalTestViewer.setAllChecked(false);
            validatePage();
        }
    });

    hintButton = new Button(compButtons, SWT.CHECK);
    hintButton.setText(MessageUtil.getString("hint"));
    hintButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            hint();
        }
    });
    hintButton.setData(GW4E_LAUNCH_CONFIGURATION_CONTROL_ID, GW4E_LAUNCH_TEST_CONFIGURATION_HINT_BUTTON);

}