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:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassDeleteDialog.java

License:Apache License

/**
 * Create contents of the dialog.//from w ww . j a v  a  2  s .com
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    container.getShell().setText(DELETE_OPERATION);

    final Button selectAllCheckButton = new Button(container, SWT.CHECK);
    GridData gd_btnCheckButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnCheckButton.widthHint = 190;
    selectAllCheckButton.setLayoutData(gd_btnCheckButton);
    selectAllCheckButton.setText(SELECT_ALL);
    selectAllCheckButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (selectAllCheckButton.getSelection()) {
                checkboxTableViewer.setAllChecked(true);
            } else {
                checkboxTableViewer.setAllChecked(false);
            }
        }
    });
    Composite composite = new Composite(container, SWT.NONE);
    GridData gd_composite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_composite.heightHint = 204;
    gd_composite.widthHint = 402;
    composite.setLayoutData(gd_composite);

    checkboxTableViewer = CheckboxTableViewer.newCheckList(composite,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
    table = checkboxTableViewer.getTable();
    table.setBounds(0, 0, 227, 204);
    checkboxTableViewer.setContentProvider(new TableContentProvider());

    for (MappingSheetRow mappingsheetRow : mappingSheetRowList) {
        if (mappingsheetRow.isActive()) {
            if (Constants.NORMALIZE.equalsIgnoreCase(component.getComponentName())
                    && !mappingsheetRow.isExpression())
                continue;
            operationIdList.add(mappingsheetRow.getOperationID());
        }
    }
    checkboxTableViewer.setInput(operationIdList);

    return container;
}

From source file:kr.simula.formula.ide.launcher.ui.FormulaCommonTab.java

License:Apache License

/**
 * Creates the favorites control//from   ww  w. j a  v a 2 s. com
 * 
 * @param parent
 *            the parent composite to add this one to
 * 
 */
private void createFavoritesComponent(Composite parent) {
    Group favComp = SWTUtil.createGroup(parent,
            LaunchConfigurationsMessages.CommonTab_Display_in_favorites_menu__10, 1, 1, GridData.FILL_BOTH);
    fFavoritesTable = CheckboxTableViewer.newCheckList(favComp,
            SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    Control table = fFavoritesTable.getControl();
    GridData gd = new GridData(GridData.FILL_BOTH);
    table.setLayoutData(gd);
    table.setFont(parent.getFont());
    fFavoritesTable.setContentProvider(new FavoritesContentProvider());
    fFavoritesTable.setLabelProvider(new FavoritesLabelProvider());
    fFavoritesTable.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateLaunchConfigurationDialog();
        }
    });
}

From source file:net.rim.ejde.internal.ui.wizards.imports.ProjectImportSelectionUI.java

License:Open Source License

public void creatContent() {
    // workspace location entry field
    Composite pathComp = new Composite(_parent, SWT.NONE);
    pathComp.setLayout(new GridLayout(3, false));
    pathComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (_allowBrowseJDW) {
        String importLocationLabel = Messages.GenericSelectionPage_WORKSPACE_LABEL;
        Label projectContentsLabel = new Label(pathComp, SWT.NONE);
        projectContentsLabel.setText(importLocationLabel); //$NON-NLS-1$*/
        projectContentsLabel.setLayoutData(new GridData(SWT.BEGINNING));
        // jdw path text
        _importPathField = new Text(pathComp, SWT.BORDER);
        _importPathField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        _importPathField.setText(""); //$NON-NLS-1$
        _importPathField.addKeyListener(new KeyAdapter() {
            @Override//w  w w .  j ava  2 s  .c  o m
            public void keyPressed(KeyEvent e) {
                if ((e.keyCode == SWT.CR) || (e.keyCode == SWT.KEYPAD_CR)) {
                    _log.debug("\"Entry\" was pressed");
                    String workspaceFileToImport = _importPathField.getText();
                    loadWorkspace(new Path(workspaceFileToImport));
                }
            }
        });
        _importPathField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                String workspaceFilePath = _importPathField.getText();
                loadWorkspace(new Path(workspaceFilePath));
            }
        });
        // browse button
        _browseButton = new Button(pathComp, SWT.PUSH);
        GridData data = new GridData(GridData.END);
        data.widthHint = BUTTON_DEFAULT_WIDTH;
        _browseButton.setLayoutData(data);
        _browseButton.setText(Messages.IConstants_BROWSE_BUTTON_TITLE); //$NON-NLS-1$
        _browseButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                FileDialog dialog = new FileDialog(_importPathField.getShell());
                String[] filters = new String[] { "*.jdw" };
                String[] filterNames = new String[] { Messages.BLACKBERRY_WORKSPACE_FILTER_NAME };
                dialog.setFilterExtensions(filters);
                dialog.setFilterNames(filterNames);
                String workspaceFileToImport = dialog.open();
                if (null != workspaceFileToImport) {
                    _importPathField.setText(workspaceFileToImport);
                    loadWorkspace(new Path(workspaceFileToImport));
                }
            }
        });
    }
    Composite comp = new Composite(_parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(3, false);
    comp.setLayout(gridLayout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 250;
    comp.setLayoutData(gd);
    // projects label
    Label projectsLabel = new Label(comp, SWT.NONE);
    projectsLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 3, 1));
    projectsLabel.setText(Messages.GenericSelectionPage_PROJECT_TABLE_TITLE);
    // projects table
    _tableViewer = CheckboxTableViewer.newCheckList(comp,
            SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK | SWT.BORDER);
    _tableViewer.setContentProvider(new ArrayContentProvider());
    _tableViewer.setLabelProvider(new ProjectTableLabelProvider());
    _tableViewer.addCheckStateListener(new CheckStateListenerImpl());
    Table table = _tableViewer.getTable();
    table.addKeyListener(new KeyListenerImpl());
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
    TableColumn projectIconColumn, projectNameColumn;
    projectIconColumn = new TableColumn(table, SWT.NONE);
    projectIconColumn.setText("Project Icon"); //$NON-NLS-1$
    projectIconColumn.setWidth(80);
    projectNameColumn = new TableColumn(table, SWT.NONE);
    projectNameColumn.setText("Project Name"); //$NON-NLS-1$
    projectNameColumn.setWidth(450);
    // select / de-select project buttons
    _selectAllButton = new Button(comp, SWT.PUSH);
    _selectAllButton.setText("Select All"); //$NON-NLS-1$
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.widthHint = BUTTON_DEFAULT_WIDTH;
    _selectAllButton.setLayoutData(gridData);
    _deselectAllButton = new Button(comp, SWT.PUSH);
    //_deselectAllButton.setText( _resources.getString( "Wizard.GenericSelectionPage.DeselectAll" ) ); //$NON-NLS-1$
    _deselectAllButton.setText("Deselect All"); //$NON-NLS-1$
    GridData gridData2 = new GridData(SWT.FILL, SWT.TOP, false, false);
    gridData2.widthHint = BUTTON_DEFAULT_WIDTH;
    _deselectAllButton.setLayoutData(gridData2);
    _selectAllButton.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org .eclipse .swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            Table table = _tableViewer.getTable();
            for (TableItem item : table.getItems()) {
                if (!item.getGrayed()) {
                    item.setChecked(true);
                }
            }
            table.redraw();
            _callback.setMessage(IConstants.EMPTY_STRING, IMessageProvider.NONE);
            _callback.setComplete(table.getItems().length > 0); // donot
        }
    });
    _deselectAllButton.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org .eclipse .swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            Table table = _tableViewer.getTable();
            for (TableItem item : table.getItems()) {
                if (!item.getGrayed()) {
                    item.setChecked(false);
                }
            }
            _callback.setMessage(Messages.GenericSelectionPage_NO_PROJECT_SELECTED_ERROR_MSG,
                    IMessageProvider.ERROR);
            _callback.setComplete(false);
        }
    });
    // the copy project checkbox
    _copyButton = new Button(comp, SWT.CHECK);
    _copyButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 3, 1));
    _copyButton.setText(Messages.GenericSelectionPage_COPY_MODEL_LABEL);
    // by default we suggest users to use copy model
    _copyButton.setSelection(true);
    // if it is sample import wizard, we only allow copy import
    _copyButton.setEnabled(_allowBrowseJDW);
    _copyButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            fireImportTypeChangeEvent(e);

        }

    });
    // the select dependency project checkbox
    _selectDependencyButton = new Button(comp, SWT.CHECK);
    _selectDependencyButton.setText("Automatically select dependent projects");
    // by default we suggest users to use copy model
    _selectDependencyButton.setSelection(true);
}

From source file:net.sf.eclipsecs.ui.config.widgets.ConfigPropertyWidgetMultiCheck.java

License:Open Source License

/**
 * {@inheritDoc}// w  w  w.j  a va 2s  .  c o  m
 */
protected Control getValueWidget(Composite parent) {

    if (mTable == null) {

        mTranslateTokens = CheckstyleUIPluginPrefs.getBoolean(CheckstyleUIPluginPrefs.PREF_TRANSLATE_TOKENS);
        mSortTokens = CheckstyleUIPluginPrefs.getBoolean(CheckstyleUIPluginPrefs.PREF_SORT_TOKENS);

        IEclipsePreferences instanceScope = new InstanceScope().getNode(CheckstyleUIPlugin.PLUGIN_ID);
        instanceScope.addPreferenceChangeListener(this);

        mTable = CheckboxTableViewer.newCheckList(parent, SWT.V_SCROLL | SWT.BORDER);
        mTable.setContentProvider(new ArrayContentProvider());
        mTable.setLabelProvider(new TokenLabelProvider());

        installSorter(mSortTokens);

        mTable.setInput(mTokens);
        mTable.setCheckedElements(getInitialValues().toArray());

        GridData gd = new GridData(GridData.FILL_BOTH);
        gd.heightHint = 150;
        mTable.getControl().setLayoutData(gd);

        // deregister the listener on widget dipose
        mTable.getControl().addDisposeListener(new DisposeListener() {

            public void widgetDisposed(DisposeEvent e) {
                IEclipsePreferences prefStore = new InstanceScope().getNode(CheckstyleUIPlugin.PLUGIN_ID);
                prefStore.removePreferenceChangeListener(ConfigPropertyWidgetMultiCheck.this);
            }
        });
    }

    return mTable.getControl();
}

From source file:net.sf.eclipsecs.ui.properties.CheckstylePropertyPage.java

License:Open Source License

/**
 * Creates the filter area./*w ww  . j av a 2  s  .c o m*/
 * 
 * @param container
 *            the container to add the filter area
 */
private Control createFilterArea(Composite container) {

    FormData fd = new FormData();

    // group composite containing the filter settings
    Group filterArea = new Group(container, SWT.NULL);
    filterArea.setText(Messages.CheckstylePropertyPage_titleFilterGroup);

    filterArea.setLayout(new FormLayout());

    this.mFilterList = CheckboxTableViewer.newCheckList(filterArea, SWT.BORDER);
    this.mBtnEditFilter = new Button(filterArea, SWT.PUSH);

    fd.left = new FormAttachment(0, 3);
    fd.top = new FormAttachment(0, 3);
    fd.right = new FormAttachment(this.mBtnEditFilter, -3, SWT.LEFT);
    fd.bottom = new FormAttachment(60, -3);
    this.mFilterList.getTable().setLayoutData(fd);

    this.mFilterList.setLabelProvider(new LabelProvider() {

        public String getText(Object element) {

            StringBuffer buf = new StringBuffer();

            if (element instanceof IFilter) {

                IFilter filter = (IFilter) element;

                buf.append(filter.getName());
                if (filter.getPresentableFilterData() != null) {
                    buf.append(": ").append(filter.getPresentableFilterData()); //$NON-NLS-1$
                }
            } else {
                buf.append(super.getText(element));
            }

            return buf.toString();
        }
    });
    this.mFilterList.setContentProvider(new ArrayContentProvider());
    this.mFilterList.addSelectionChangedListener(this.mPageController);
    this.mFilterList.addDoubleClickListener(this.mPageController);
    this.mFilterList.addCheckStateListener(this.mPageController);

    this.mBtnEditFilter.setText(Messages.CheckstylePropertyPage_btnChangeFilter);
    this.mBtnEditFilter.addSelectionListener(this.mPageController);

    fd = new FormData();
    fd.top = new FormAttachment(0, 3);
    fd.right = new FormAttachment(100, -3);
    this.mBtnEditFilter.setLayoutData(fd);

    // Description
    Label lblDesc = new Label(filterArea, SWT.LEFT);
    lblDesc.setText(Messages.CheckstylePropertyPage_lblDescription);
    fd = new FormData();
    fd.left = new FormAttachment(0, 3);
    fd.top = new FormAttachment(this.mFilterList.getTable(), 3, SWT.BOTTOM);
    fd.right = new FormAttachment(100, -3);
    lblDesc.setLayoutData(fd);

    this.mTxtFilterDescription = new Text(filterArea,
            SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.VERTICAL);
    fd = new FormData();
    fd.left = new FormAttachment(0, 3);
    fd.top = new FormAttachment(lblDesc, 3, SWT.BOTTOM);
    fd.right = new FormAttachment(100, -3);
    fd.bottom = new FormAttachment(100, -3);
    this.mTxtFilterDescription.setLayoutData(fd);

    // intialize filter list
    List<IFilter> filterDefs = mProjectConfig.getFilters();
    this.mFilterList.setInput(filterDefs);

    // set the checked state
    for (int i = 0; i < filterDefs.size(); i++) {
        IFilter filter = filterDefs.get(i);
        this.mFilterList.setChecked(filter, filter.isEnabled());
    }

    // set the readonly state
    for (int i = 0; i < filterDefs.size(); i++) {
        IFilter filter = filterDefs.get(i);
        this.mFilterList.setGrayed(filter, filter.isReadonly());
    }

    this.mBtnEditFilter.setEnabled(false);

    return filterArea;
}

From source file:net.sf.guavaeclipse.dialog.GenericDialogBox.java

License:Apache License

@Override
protected Control createDialogArea(Composite parent) {
    try {//  w  ww  . ja  va 2s  . c o  m
        Composite composite = (Composite) super.createDialogArea(parent);
        initializeDialogUnits(composite);
        createMessageArea(composite);
        listViewer = CheckboxTableViewer.newCheckList(composite, 2048);
        GridData data = new GridData(1808);
        data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
        data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
        listViewer.getTable().setLayoutData(data);
        listViewer.setLabelProvider(labelProvider);
        listViewer.setContentProvider(contentProvider);
        addTypeCombo(composite);
        addSelectionButtons(composite);
        initializeViewer();
        if (getInitialElementSelections().isEmpty()) {
            checkInitialSelections();
        }
        applyDialogFont(composite);
        return composite;
    } catch (JavaModelException e) {
        e.printStackTrace();
    }
    return parent;
}

From source file:net.sf.logsaw.ui.propertyPages.ColumnsPropertyPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite root = new Composite(parent, SWT.NONE);
    root.setLayout(new GridLayout(2, false));

    tableViewer = CheckboxTableViewer.newCheckList(root,
            SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    tableViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
         *///from  w  w  w . j a  v  a  2s. co m
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            boolean moveUp = false;
            boolean moveDown = false;
            if (!sel.isEmpty()) {
                // Update enabled state of moveUp/moveDown buttons
                int idx = model.indexOf(sel.getFirstElement());
                moveUp = idx > 0;
                moveDown = idx < model.size() - 1;
            }
            moveUpButton.setEnabled(moveUp);
            moveDownButton.setEnabled(moveDown);
        }
    });

    // Setup data binding
    ILogResource log = (ILogResource) getElement().getAdapter(ILogResource.class);
    model = new WritableList(log.getDialect().getFieldProvider().getAllFields(), ALogEntryField.class);
    ViewerSupport.bind(tableViewer, model, PojoProperties.values(new String[] { "label" })); //$NON-NLS-1$

    Composite buttonArea = new Composite(root, SWT.NONE);
    buttonArea.setLayout(new GridLayout());
    GridData gridData = new GridData();
    gridData.verticalAlignment = SWT.BEGINNING;
    buttonArea.setLayoutData(gridData);

    Button selectAllButton = new Button(buttonArea, SWT.PUSH);
    selectAllButton.setText(Messages.ColumnsPropertyPage_label_selectAll);
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            tableViewer.setAllChecked(true);
        }
    });
    selectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));

    Button deselectAllButton = new Button(buttonArea, SWT.PUSH);
    deselectAllButton.setText(Messages.ColumnsPropertyPage_label_deselectAll);
    deselectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            tableViewer.setAllChecked(false);
        }
    });
    deselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));

    moveUpButton = new Button(buttonArea, SWT.PUSH);
    moveUpButton.setText(Messages.ColumnsPropertyPage_label_moveUp);
    moveUpButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection sel = (IStructuredSelection) tableViewer.getSelection();
            int idx = model.indexOf(sel.getFirstElement());
            model.move(idx, idx - 1);
        }
    });
    moveUpButton.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));

    moveDownButton = new Button(buttonArea, SWT.PUSH);
    moveDownButton.setText(Messages.ColumnsPropertyPage_label_moveDown);
    moveDownButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection sel = (IStructuredSelection) tableViewer.getSelection();
            int idx = model.indexOf(sel.getFirstElement());
            model.move(idx, idx + 1);
        }
    });
    moveDownButton.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));

    tableViewer.setSelection(StructuredSelection.EMPTY);
    loadOrderAndCheckState();

    return root;
}

From source file:net.sf.sveditor.ui.prop_pages.PluginLibPrefsPage.java

License:Open Source License

public Control createContents(Composite parent) {
    Composite frame = new Composite(parent, SWT.NONE);
    frame.setLayout(new GridLayout(1, true));

    fPluginLibViewer = CheckboxTableViewer.newCheckList(frame, SWT.NONE);
    fPluginLibViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    fPluginLibViewer.setContentProvider(this);
    fPluginLibViewer.setLabelProvider(this);
    fPluginLibViewer.setInput(fPluginLibs);

    for (SVDBPluginLibDescriptor lib : fPluginLibs) {
        int sel = -1;
        for (int i = 0; i < fProjectWrapper.getPluginPaths().size(); i++) {
            SVDBPath p = fProjectWrapper.getPluginPaths().get(i);

            if (p.getPath().equals(lib.getId())) {
                sel = i;//from  w ww  . ja  va  2  s.  com
                break;
            }
        }

        if (!fPluginLibViewer.setChecked(lib, (sel != -1))) {
            System.out.println("Failed to set checked state");
        }
    }
    return frame;
}

From source file:net.sourceforge.eclipsetrader.yahoo.internal.updater.ui.ListSourcePage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite content = new Composite(parent, SWT.NONE);
    content.setLayout(new GridLayout(1, false));
    setControl(content);/*  w ww  .j  a  v  a2 s  .  c o  m*/

    viewer = CheckboxTableViewer.newCheckList(content, SWT.FULL_SELECTION | SWT.BORDER);
    viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return ((Job) element).getName();
        }
    });
    viewer.setComparator(new ViewerComparator() {
        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            return ((Job) e1).getName().compareTo(((Job) e2).getName());
        }
    });
    viewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            setPageComplete(isPageComplete());
        }
    });

    List<AbstractListUpdateJob> input = new ArrayList<AbstractListUpdateJob>();
    input.add(new USListUpdateJob());
    input.add(new GermanyListUpdateJob());
    input.add(new FrenchListUpdateJob());
    viewer.setInput(input);
}

From source file:net.sourceforge.tagsea.core.ui.internal.waypoints.WaypointFilteringDialog.java

License:Open Source License

/**
 * @param page//  ww w. ja  v  a 2  s .  c  o m
 */
private void createTableArea(Composite page) {
    Group area = new Group(page, SWT.FLAT);
    area.setText("Visible Types");
    area.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    area.setLayout(new GridLayout(2, false));
    typeViewer = CheckboxTableViewer.newCheckList(area, SWT.FLAT | SWT.BORDER);
    typeViewer.setContentProvider(new ArrayContentProvider());
    typeViewer.setLabelProvider(new ITableLabelProvider() {
        public Image getColumnImage(Object element, int columnIndex) {
            return null;
        }

        public String getColumnText(Object element, int columnIndex) {
            if (element instanceof AbstractWaypointDelegate) {
                return ((AbstractWaypointDelegate) element).getName();
            }
            return "";
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void dispose() {
        }

        public boolean isLabelProperty(Object element, String property) {
            return true;
        }

        public void removeListener(ILabelProviderListener listener) {
        }

    });
    typeViewer.setInput(TagSEAPlugin.getDefault().getWaypointDelegates());
    typeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof IStructuredSelection) {
                IStructuredSelection ss = (IStructuredSelection) event.getSelection();
                if (ss.size() == 1) {
                    selectedDelegate = (AbstractWaypointDelegate) ss.getFirstElement();
                    dirtyTypeSet.add(selectedDelegate.getType());
                    Control filterControl = filterControlMap.get(selectedDelegate.getType());
                    if (filterControl != null) {
                        ((StackLayout) advancedArea.getLayout()).topControl = filterControl;
                    } else {
                        ((StackLayout) advancedArea.getLayout()).topControl = defaultControl;
                    }
                } else {
                    ((StackLayout) advancedArea.getLayout()).topControl = noSelectionControl;
                }
            }
            advancedArea.layout();
        }

    });
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.horizontalSpan = 2;
    typeViewer.getControl().setLayoutData(data);
    Button selectAllButton = new Button(area, SWT.PUSH);
    selectAllButton.setText("Check All");
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            typeViewer.setAllChecked(true);
        }
    });
    data = new GridData(SWT.END, SWT.END, false, false);
    data.horizontalAlignment = SWT.END;
    selectAllButton.setLayoutData(data);

    Button selectNoneButton = new Button(area, SWT.PUSH);
    data = new GridData(SWT.END, SWT.END, false, false);
    data.horizontalAlignment = SWT.END;
    selectNoneButton.setLayoutData(data);
    selectNoneButton.setText("Check None");
    selectNoneButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            typeViewer.setAllChecked(false);
        }
    });
    initializeTable();

}