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

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

Introduction

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

Prototype

public CheckboxTableViewer(Table table) 

Source Link

Document

Creates a table viewer on the given table control.

Usage

From source file:com.mountainminds.eclemma.internal.ui.viewers.ClassesViewer.java

License:Open Source License

/**
 * Attaches the viewer to the given table.
 * //www  . j  a va2s.c om
 * @param table
 *          view table
 */
public ClassesViewer(Table table) {
    this.table = table;
    viewer = new CheckboxTableViewer(table);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new PackageFragmentRootLabelProvider());
    viewer.setSorter(new PackageFragmentRootSorter());
    viewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateCheckedStatus(event.getElement(), event.getChecked());
        }
    });
}

From source file:com.nokia.carbide.cdt.internal.builder.ui.SisFilesBlock.java

License:Open Source License

/**
 * Creates this block's control in the given control.
 * //from  w  w w  .ja  va  2  s .  c om
 * @param ancestor containing control
 */
public void createControl(Composite ancestor) {

    Composite parent = new Composite(ancestor, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    parent.setLayout(layout);
    Font font = ancestor.getFont();
    parent.setFont(font);
    fControl = parent;

    Table table = new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    table.setFont(font);

    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    table.setLayout(new TableLayout());

    TableColumn column1 = new TableColumn(table, SWT.NULL);
    column1.setText("Enabled");
    column1.pack();

    TableColumn column2 = new TableColumn(table, SWT.NULL);
    column2.setText("Partial upgrade");
    column2.pack();

    TableColumn column3 = new TableColumn(table, SWT.NULL);
    column3.setText("Unsigned SIS file");
    column3.setWidth(200);

    TableColumn column4 = new TableColumn(table, SWT.NULL);
    column4.setText("Signed SIS file");
    column4.setWidth(200);

    fFileList = new CheckboxTableViewer(table);
    fFileList.setLabelProvider(new FilesLabelProvider());
    fFileList.setContentProvider(new FilesContentProvider());

    fFileList.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent evt) {
            enableButtons();
        }
    });

    fFileList.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent e) {
            if (!fFileList.getSelection().isEmpty()) {
                editFile();
            }
        }
    });

    fFileList.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            ISISBuilderInfo file = (ISISBuilderInfo) e.getElement();
            file.setEnabled(e.getChecked());
        }
    });

    table.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent event) {
            if (event.character == SWT.DEL && event.stateMask == 0) {
                removeFiles();
            }
        }
    });

    Composite buttons = new Composite(parent, SWT.NULL);
    buttons.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, false, false));
    buttons.setLayout(new GridLayout());
    buttons.setFont(font);

    fAddButton = createPushButton(buttons, "Add");
    fAddButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            addFile();
        }
    });

    fEditButton = createPushButton(buttons, "Edit");
    fEditButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            editFile();
        }
    });

    fRemoveButton = createPushButton(buttons, "Remove");
    fRemoveButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            removeFiles();
        }
    });

    fUpButton = createPushButton(buttons, "Move Up");
    fUpButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            moveFileUp();
            enableButtons();
        }
    });

    fDownButton = createPushButton(buttons, "Move Down");
    fDownButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            moveFileDown();
            enableButtons();
        }
    });

    enableButtons();
    fAddButton.setEnabled(true);
}

From source file:com.nokia.carbide.cpp.pi.peccommon.PecCommonLegend.java

License:Open Source License

/**
 * Constructor//from  w w w  .j a  v a 2s .  co m
 * @param graph the graph that this legend belongs to 
 * @param parent the parent composite
 * @param title Title for the legend
 * @param trace The model containing the samples
 */
public PecCommonLegend(final PecCommonTraceGraph graph, Composite parent, String title, PecCommonTrace trace) {
    super(parent, SWT.NONE);
    this.graph = graph;
    this.trace = trace;

    setLayout(GridLayoutFactory.fillDefaults().numColumns(1).spacing(0, 0).create());

    Label label = new Label(this, SWT.CENTER);
    label.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
    //label.setFont(PIPageEditor.helvetica_8);
    label.setText(title);
    label.setLayoutData(
            GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).create());

    //create table viewer
    final Table table = new Table(this,
            SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    this.viewer = new CheckboxTableViewer(table);

    PecCommonLegendLabelProvider labelProvider = createLabelProvider();
    viewer.setLabelProvider(labelProvider);
    viewer.setContentProvider(new PecCommonLegendContentProvider(trace));

    PecCommonLegendViewerSorter columnSorter = createLegendSorter();
    createColumns(this.viewer, columnSorter);

    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    columnSorter.setSortColumn(COLUMN_SHORT_TITLE);
    viewer.setComparator(columnSorter);

    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent arg0) {
            if (copyAction == null)
                return;

            // when selection changes, the ability to copy may change
            copyAction.setEnabled(table.getSelectionCount() > 0);
            PIPageEditor.getActionBars().updateActionBars();
        }
    });

    viewer.addCheckStateListener(new ICheckStateListener() {

        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
         */
        public void checkStateChanged(CheckStateChangedEvent event) {
            PecCommonLegendElement el = (PecCommonLegendElement) event.getElement();
            graph.addOrRemoveSeries(el.getId(), event.getChecked());
        }
    });

    viewer.setInput(trace);
    viewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).create());
    addActions(viewer);
    viewer.getTable().addFocusListener(new PecCommonLegendFocusListener(viewer));
    addContextMenu(viewer);
    viewer.setAllChecked(true); //default

    PlatformUI.getWorkbench().getHelpSystem().setHelp(this, graph.getContextHelpId());
}

From source file:com.nokia.cdt.internal.debug.launch.ui.ExecutablesBlock.java

License:Open Source License

/**
 * Creates this block's control in the given control.
 * /*from w  w w .jav  a2s  .c  o m*/
 * @param ancestor
 *            containing control
 */
public void createControl(Composite comp) {
    fControl = comp;

    GridData data;

    Table table = new Table(comp, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    data = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1);
    data.horizontalIndent = 10;
    table.setLayoutData(data);

    table.setHeaderVisible(false);
    table.setLinesVisible(false);
    table.setToolTipText(Messages.getString("ExecutablesTab.TableToolTip")); //$NON-NLS-1$

    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    fExeFileList = new CheckboxTableViewer(table);
    fExeFileList.setLabelProvider(new ExeFilesLabelProvider());
    fExeFileList.setContentProvider(new ArrayContentProvider());

    // listen to checks
    fExeFileList.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            ExeFileToDebug file = (ExeFileToDebug) e.getElement();
            if (file == fMainExecutable) {
                fExeFileList.setChecked(file, true);
            } else {
                file.setEnabled(e.getChecked());
            }
            if (fExeFileList.getCheckedElements().length == 0)
                fExeFileList.setChecked(fExeFiles.get(0), true);
            fLaunchTab.dataChanged();
        }
    });
    // listen to double clicks
    fExeFileList.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent e) {
            IStructuredSelection selection = (IStructuredSelection) e.getSelection();
            for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
                ExeFileToDebug file = (ExeFileToDebug) iterator.next();
                if (file != fMainExecutable) {
                    fExeFileList.setChecked(file, !fExeFileList.getChecked(file));
                }
            }
            if (fExeFileList.getCheckedElements().length == 0)
                fExeFileList.setChecked(fExeFiles.get(0), true);
            fLaunchTab.dataChanged();
        }
    });

    fExeFileList.setComparator(new ViewerComparator());
}

From source file:com.nokia.cdt.internal.debug.launch.ui.FilesBlock.java

License:Open Source License

/**
 * Creates this block's control in the given control.
 * //from   w  w  w . j av a 2 s.  co  m
 * @param ancestor containing control
 */
public void createControl(Composite ancestor) {

    Composite parent = new Composite(ancestor, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    parent.setLayout(layout);
    Font font = ancestor.getFont();
    parent.setFont(font);
    fControl = parent;

    GridData data;

    Table table = new Table(parent, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    data = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(data);
    table.setFont(font);

    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);

    TableColumn column1 = new TableColumn(table, SWT.NULL);
    column1.setText(Messages.getString("FileTransferTab.2")); //$NON-NLS-1$
    column1.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            sortByEnabled();
        }
    });

    TableColumn column2 = new TableColumn(table, SWT.NULL);
    column2.setText(Messages.getString("FileTransferTab.3")); //$NON-NLS-1$
    column2.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            sortByHostPath();
        }
    });

    TableColumn column3 = new TableColumn(table, SWT.NULL);
    column3.setText(Messages.getString("FileTransferTab.4")); //$NON-NLS-1$
    column3.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            sortByTargetPath();
        }
    });

    fFileList = new CheckboxTableViewer(table);
    fFileList.setLabelProvider(new FilesLabelProvider());
    fFileList.setContentProvider(new FilesContentProvider());

    fFileList.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent evt) {
            enableButtons();
        }
    });

    fFileList.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent e) {
            if (!fFileList.getSelection().isEmpty()) {
                editFile();
            }
        }
    });

    fFileList.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            FileToTransfer file = (FileToTransfer) e.getElement();
            file.setEnabled(e.getChecked());
            fLaunchTab.dataChanged();
        }
    });

    table.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent event) {
            if (event.character == SWT.DEL && event.stateMask == 0) {
                removeFiles();
            }
        }
    });

    Composite buttons = new Composite(parent, SWT.NULL);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);
    buttons.setFont(font);

    fAddButton = createPushButton(buttons, Messages.getString("FileTransferTab.5")); //$NON-NLS-1$
    fAddButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            addFile();
        }
    });

    fEditButton = createPushButton(buttons, Messages.getString("FileTransferTab.6")); //$NON-NLS-1$
    fEditButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            editFile();
        }
    });

    fRemoveButton = createPushButton(buttons, Messages.getString("FileTransferTab.7")); //$NON-NLS-1$
    fRemoveButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            removeFiles();
        }
    });

    fSelectAllButton = createPushButton(buttons, Messages.getString("FileTransferTab.10")); //$NON-NLS-1$
    fSelectAllButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            for (int i = 0; i < fFiles.size(); i++) {
                FileToTransfer file = (FileToTransfer) fFiles.get(i);
                file.setEnabled(true);
                fFileList.setChecked(file, true);
            }
            fLaunchTab.dataChanged();
        }
    });

    fDeSelectAllButton = createPushButton(buttons, Messages.getString("FileTransferTab.11")); //$NON-NLS-1$
    fDeSelectAllButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event evt) {
            for (int i = 0; i < fFiles.size(); i++) {
                FileToTransfer file = (FileToTransfer) fFiles.get(i);
                file.setEnabled(false);
                fFileList.setChecked(file, false);
            }
            fLaunchTab.dataChanged();
        }
    });

    configureTableResizing(parent, buttons, table, column1, column2, column3);

    enableButtons();
    fAddButton.setEnabled(true);
}

From source file:com.nokia.s60tools.memspy.ui.dialogs.SWMTCategoriesDialog.java

License:Open Source License

/**
 * Creates checkbox viewer component for showing available SWMT categories. 
 * @param parent Parent composite for the created composite.
 * @return New <code>CheckboxTableViewer</code> object instance.
 *//*w  ww .  j av  a2 s  . com*/
protected CheckboxTableViewer createCategoryCheckBoxTableViewer(Composite parent) {

    ArrayList<S60ToolsTableColumnData> columnDataArr = new ArrayList<S60ToolsTableColumnData>();

    //
    // NOTE: Column indices must start from zero (0) and
    // the columns must be added in ascending numeric
    // order.
    //
    columnDataArr.add(new S60ToolsTableColumnData("Category", //$NON-NLS-1$
            350, SWMTCategoryEntry.NAME_COLUMN_INDEX, SWMTCategoryEntryTableViewerSorter.CRITERIA_NAME));

    S60ToolsTableColumnData[] arr = columnDataArr.toArray(new S60ToolsTableColumnData[0]);

    S60ToolsTable tbl = S60ToolsTableFactory.createCheckboxTable(parent, arr);

    CheckboxTableViewer tblViewer = new CheckboxTableViewer(tbl.getTableInstance());
    tbl.setHostingViewer(tblViewer);

    return tblViewer;
}

From source file:com.nokia.s60tools.traceanalyser.ui.views.MainView.java

License:Open Source License

/**
 * Creates rule table//from  w ww  .  j a va 2s.  c o m
 */
private void createRuleTable() {
    Table tableRules = new Table(compositeRules, SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);

    tableRules.setLayoutData(new GridData(GridData.FILL_BOTH));
    tableRules.setLinesVisible(true);
    tableRules.setHeaderVisible(true);

    // Add selection listeners for each column after creating it
    tableRules.addSelectionListener(this);

    int parameter_column_length = 60;

    TableColumn tableColumn = new TableColumn(tableRules, SWT.NONE);
    tableColumn.setWidth(20);
    tableColumn.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            checkAllPressed();
        }
    });

    TableColumn tableColumn2 = new TableColumn(tableRules, SWT.NONE);
    tableColumn2.setWidth(150);
    tableColumn2.setText("Rule Name");

    tableColumn2.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.RULE_NAME));
        }
    });

    TableColumn tableColumn3 = new TableColumn(tableRules, SWT.NONE);
    tableColumn3.setWidth(parameter_column_length);
    tableColumn3.setText("Pass");

    tableColumn3.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.PASS));
        }
    });

    TableColumn tableColumn4 = new TableColumn(tableRules, SWT.NONE);
    tableColumn4.setWidth(parameter_column_length);
    tableColumn4.setText("Fail");
    tableColumn4.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.FAIL));
        }
    });

    TableColumn tableColumn5 = new TableColumn(tableRules, SWT.NONE);
    tableColumn5.setWidth(parameter_column_length);
    tableColumn5.setText("Pass %");
    tableColumn5.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.PASSPERCENT));
        }
    });

    TableColumn tableColumn6 = new TableColumn(tableRules, SWT.NONE);
    tableColumn6.setWidth(parameter_column_length);
    tableColumn6.setText("Min");
    tableColumn6.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.MIN));
        }
    });

    TableColumn tableColumn7 = new TableColumn(tableRules, SWT.NONE);
    tableColumn7.setWidth(parameter_column_length);
    tableColumn7.setText("Max");
    tableColumn7.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.MAX));
        }
    });

    TableColumn tableColumn8 = new TableColumn(tableRules, SWT.NONE);
    tableColumn8.setWidth(parameter_column_length);
    tableColumn8.setText("Avg");
    tableColumn8.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.AVG));
        }
    });

    TableColumn tableColumn9 = new TableColumn(tableRules, SWT.NONE);
    tableColumn9.setWidth(parameter_column_length);
    tableColumn9.setText("Med");
    tableColumn9.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            viewerRuleTable.setSorter(new RuleTableDataSorter(RuleTableDataSorter.MED));
        }
    });

    viewerRuleTable = new CheckboxTableViewer(tableRules);
    contentProviderRuleTable = new RuleTableContentProvider(engine);
    viewerRuleTable.setContentProvider(contentProviderRuleTable);
    viewerRuleTable.setLabelProvider(new RuleTableLabelProvider());
    /*viewerRuleTable.setComparator(new RuleTableDataSorter());
    viewerRuleTable.setSorter(new RuleTableDataSorter());*/
    viewerRuleTable.setInput(getViewSite());
    tableRules.addKeyListener(this);

}

From source file:com.nokia.sdt.symbian.ui.appeditor.LanguagesPage.java

License:Open Source License

protected void createFormContent(IManagedForm managedForm) {
    FormToolkit toolkit = managedForm.getToolkit();
    final ScrolledForm form = managedForm.getForm();
    form.setText(Messages.getString("LanguagesPage.2")); //$NON-NLS-1$
    Composite body = form.getBody();
    body.setLayout(new TableWrapLayout());
    toolkit.paintBordersFor(body);/*w  w  w.  ja v a2s  . co m*/
    String href = null;

    SymbianModelUtils.SDKType sdkType = SymbianModelUtils.getModelSDK(editorContext.getRootDataModel());
    switch (sdkType) {
    case S60:
        href = "/com.nokia.sdt.uidesigner.help/html/reference/app_editor/ref_languages.htm";//$NON-NLS-1$
        break;
    case UIQ:
        href = "/com.nokia.carbide.cpp.uiq.help/html/reference/app_editor/ref_languages.htm";//$NON-NLS-1$
        break;
    }

    FormUtilities.addHelpToolbarItem(form.getForm(), href, Messages.getString("LanguagesPage.4")); //$NON-NLS-1$

    Section includedLanguagesSection = toolkit.createSection(body, Section.DESCRIPTION | Section.TITLE_BAR);
    includedLanguagesSectionPart = new SectionPart(includedLanguagesSection);
    managedForm.addPart(includedLanguagesSectionPart);

    final TableWrapData tableWrapData_1 = new TableWrapData(TableWrapData.LEFT, TableWrapData.TOP);
    tableWrapData_1.heightHint = 294;
    tableWrapData_1.grabHorizontal = true;
    includedLanguagesSection.setLayoutData(tableWrapData_1);
    includedLanguagesSection.setDescription(Messages.getString("LanguagesPage.5")); //$NON-NLS-1$
    includedLanguagesSection.setText(Messages.getString("LanguagesPage.6")); //$NON-NLS-1$

    final Composite composite = toolkit.createComposite(includedLanguagesSection, SWT.NONE);
    toolkit.adapt(composite);
    composite.setLayout(new FormLayout());
    includedLanguagesSection.setClient(composite);
    toolkit.paintBordersFor(composite);

    final Table table = toolkit.createTable(composite, SWT.CHECK);
    final FormData formData = new FormData();
    formData.bottom = new FormAttachment(100, -9);
    formData.left = new FormAttachment(0, 7);
    formData.right = new FormAttachment(0, 230);
    formData.top = new FormAttachment(0, 6);
    table.setLayoutData(formData);
    table.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent e) {
            if (e.character == SWT.DEL) {
                removeLanguage();
            }
        }
    });

    viewer = new CheckboxTableViewer(table);
    viewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            SymbianLanguage language = (SymbianLanguage) event.getElement();
            if (viewer.getChecked(language)) {
                performSetDisplayLanguage(language);
            } else {
                // enforce radio-button-like behavior, keep one
                // item checked at all times.
                viewer.setChecked(language, true);
            }
        }
    });
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new LabelProvider());
    viewer.setSorter(new ViewerSorter() {
        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            SymbianLanguage l1 = (SymbianLanguage) e1;
            SymbianLanguage l2 = (SymbianLanguage) e2;
            return l1.code - l2.code;
        }
    });
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateButtons();
        }
    });

    final Composite composite_1 = toolkit.createComposite(composite, SWT.NONE);
    toolkit.adapt(composite_1);
    final RowLayout rowLayout_1 = new RowLayout(SWT.VERTICAL);
    rowLayout_1.justify = true;
    rowLayout_1.fill = true;
    composite_1.setLayout(rowLayout_1);
    final FormData formData_1 = new FormData();
    formData_1.bottom = new FormAttachment(0, 70);
    formData_1.top = new FormAttachment(0, 6);
    formData_1.right = new FormAttachment(0, 295);
    formData_1.left = new FormAttachment(table, 5, SWT.DEFAULT);
    composite_1.setLayoutData(formData_1);
    toolkit.paintBordersFor(composite_1);

    addButton = toolkit.createButton(composite_1, Messages.getString("LanguagesPage.8"), SWT.NONE); //$NON-NLS-1$
    addButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            addLanguages();
        }
    });

    removeButton = toolkit.createButton(composite_1, Messages.getString("LanguagesPage.removeButton.text"), //$NON-NLS-1$
            SWT.NONE);
    removeButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            removeLanguage();
        }
    });

    Section localizationFormatSection = toolkit.createSection(body, Section.DESCRIPTION | Section.TITLE_BAR);
    localizationFormatSectionPart = new SectionPart(localizationFormatSection);
    localizationFormatSection.setDescription(Messages.getString("LanguagesPage.10")); //$NON-NLS-1$
    final TableWrapData tableWrapData_2 = new TableWrapData(TableWrapData.FILL, TableWrapData.TOP);
    tableWrapData_2.heightHint = 89;
    tableWrapData_2.grabHorizontal = true;
    localizationFormatSection.setLayoutData(tableWrapData_2);
    localizationFormatSection.setText(Messages.getString("LanguagesPage.11")); //$NON-NLS-1$

    final Composite composite_2 = toolkit.createComposite(localizationFormatSection, SWT.NONE);
    final RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
    rowLayout.marginTop = 8;
    composite_2.setLayout(rowLayout);
    toolkit.paintBordersFor(composite_2);
    localizationFormatSection.setClient(composite_2);

    dotLocButton = toolkit.createButton(composite_2, Messages.getString("LanguagesPage.13"), SWT.RADIO); //$NON-NLS-1$
    dotLocButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (dotLocButton.getSelection()) {
                performSetLocalizationFormat(SymbianModelUtils.LocalizationFileFormat.LOC);
            }
        }
    });

    dotRlsButton = toolkit.createButton(composite_2, Messages.getString("LanguagesPage.12"), SWT.RADIO); //$NON-NLS-1$
    dotRlsButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            if (dotRlsButton.getSelection()) {
                performSetLocalizationFormat(SymbianModelUtils.LocalizationFileFormat.RLS);
            }
        }
    });

    refresh();
}

From source file:com.nokia.tools.variant.common.ui.wizards.dialogfields.CheckedListDialogField.java

License:Open Source License

protected TableViewer createTableViewer(Composite parent) {
    Table table = new Table(parent, SWT.CHECK + getListStyle());
    table.setFont(parent.getFont());/*from   w ww. j av  a2s  .c om*/
    CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
    tableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            doCheckStateChanged(e);
        }
    });
    return tableViewer;
}

From source file:com.rawpixil.eclipse.launchpad.internal.ui.component.dialog.AbstractCheckboxSelectionDialog.java

License:Open Source License

@Override
protected StructuredViewer createViewer(Composite parent) {
    //by default return a checkbox table viewer
    Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.CHECK);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 150;//from w ww .j  av  a 2  s .co m
    gd.widthHint = 250;
    table.setLayoutData(gd);
    return new CheckboxTableViewer(table);
}