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.aptana.ide.editor.css.preferences.PreviewPreferencePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
 *//*from  w w w  .  j  a  v a  2 s  . c  o  m*/
protected Control createContents(Composite parent) {
    displayArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.makeColumnsEqualWidth = false;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 5;
    layout.horizontalSpacing = 0;
    displayArea.setLayout(layout);
    displayArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    useTempFiles = new Button(displayArea, SWT.CHECK);
    useTempFiles.setText(Messages.PreviewPreferencePage_UseTempFilesText);
    useTempFiles.setSelection(getPreferenceStore().getBoolean(IPreferenceConstants.USE_TEMP_FILES_FOR_PREVIEW));

    description = new Label(displayArea, SWT.WRAP);
    description.setText(Messages.PreviewPreferencePage_DescriptionText);
    browsers = new Group(displayArea, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    browsers.setLayout(gridLayout);
    browsers.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    browsers.setText(Messages.PreviewPreferencePage_BrowsersText);
    Table table = new Table(browsers, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
    table.setFont(parent.getFont());
    previewViewer = new CheckboxTableViewer(table);
    previewViewer.setContentProvider(new ArrayContentProvider());
    previewViewer.setLabelProvider(new LabelProvider());
    previewViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (Platform.getOS().equals(Platform.OS_MACOSX)) {
                if (previewViewer.getChecked("Firefox") && !previewViewer.getChecked("Safari")) //$NON-NLS-1$ //$NON-NLS-2$
                {
                    MessageDialog.openInformation(getShell(), Messages.PreviewPreferencePage_FirefoxIssueTitle,
                            Messages.PreviewPreferencePage_FireFoxIssueMessage);
                    previewViewer.setChecked("Firefox", false); //$NON-NLS-1$
                }
            }
        }

    });
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    addPreviewBrowsers();
    addCheckedBrowsers();

    Label templateDescription = new Label(displayArea, SWT.LEFT | SWT.WRAP);
    templateDescription.setText(Messages.PreviewPreferencePage_TemplateDescText);
    GridData tdData = new GridData(SWT.FILL, SWT.FILL, true, false);
    tdData.verticalIndent = 5;
    templateDescription.setLayoutData(tdData);

    boolean useTemplate = getPreferenceStore()
            .getBoolean(IPreferenceConstants.CSSEDITOR_BROWSER_USE_TEMPLATE_PREFERENCE);
    useCustomTemplate = new Button(displayArea, SWT.RADIO);
    useCustomTemplate.setText(Messages.PreviewPreferencePage_UseCustomTemplateText);
    useCustomTemplate.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            boolean template = useCustomTemplate.getSelection();
            defaultTemplate.setEnabled(template);
            globalUrlText.setEnabled(!template);
            browseButton.setEnabled(!template);
        }

    });
    useCustomTemplate.setSelection(useTemplate);
    Group template = new Group(displayArea, SWT.NONE);
    template.setText(Messages.PreviewPreferencePage_TemplateGroupTitle);
    GridLayout tLayout = new GridLayout(1, true);
    tLayout.marginHeight = 0;
    tLayout.marginWidth = 0;
    template.setLayout(tLayout);
    GridData tData = new GridData(GridData.FILL, GridData.FILL, true, false);
    tData.horizontalIndent = 13;
    template.setLayoutData(tData);
    defaultTemplate = new Text(template, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData dtData = new GridData(SWT.FILL, SWT.FILL, true, true);
    dtData.heightHint = 225;
    dtData.widthHint = 500;
    defaultTemplate.setText(
            getPreferenceStore().getString(IPreferenceConstants.CSSEDITOR_BROWSER_TEMPLATE_PREFERENCE));
    defaultTemplate.setLayoutData(dtData);
    defaultTemplate.setEnabled(useTemplate);

    useUrl = new Button(displayArea, SWT.RADIO);
    useUrl.setText(Messages.PreviewPreferencePage_UseUrlText);
    useUrl.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            boolean url = useUrl.getSelection();
            defaultTemplate.setEnabled(!url);
            globalUrlText.setEnabled(url);
            browseButton.setEnabled(url);
        }

    });
    useUrl.setSelection(!useTemplate);
    Composite globalUrl = new Composite(displayArea, SWT.NONE);
    GridLayout guLayout = new GridLayout(3, false);
    guLayout.marginHeight = 0;
    guLayout.marginWidth = 0;
    guLayout.marginBottom = 10;
    globalUrl.setLayout(guLayout);
    GridData gData = new GridData(GridData.FILL, GridData.FILL, true, false);
    gData.horizontalIndent = 15;
    globalUrl.setLayoutData(gData);
    globalUrlLabel = new Label(globalUrl, SWT.LEFT);
    globalUrlLabel.setText(Messages.PreviewPreferencePage_UrlLabel);
    globalUrlText = new Text(globalUrl, SWT.SINGLE | SWT.BORDER);
    globalUrlText.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
    globalUrlText
            .setText(getPreferenceStore().getString(IPreferenceConstants.CSSEDITOR_BROWSER_URL_PREFERENCE));
    globalUrlText.setEnabled(!useTemplate);
    browseButton = new Button(globalUrl, SWT.PUSH);
    browseButton.setText(Messages.PreviewPreferencePage_BrowseText);
    browseButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(browseButton.getShell(), SWT.OPEN);
            String file = dialog.open();
            if (file != null) {
                globalUrlText.setText(file);
            }
        }

    });
    browseButton.setEnabled(!useTemplate);
    return displayArea;
}

From source file:com.aptana.ide.editors.preferences.ProblemsPreferencePage.java

License:Open Source License

private void createValidatorPreferenceControls(Composite parent) {
    // create controls for validators

    Composite displayArea = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//from  w  w w.ja  v a 2 s.c  o  m
    layout.makeColumnsEqualWidth = false;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 10;
    layout.horizontalSpacing = 0;
    displayArea.setLayout(layout);
    GridData data = new GridData(GridData.FILL, GridData.FILL, true, true);
    displayArea.setLayoutData(data);

    Group validators = new Group(displayArea, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    validators.setLayout(gridLayout);
    validators.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    validators.setText(CodeAssistMessages.ProblemsPreferencePage_Validators);
    Table table = new Table(validators, SWT.CHECK | SWT.BORDER);
    table.setFont(parent.getFont());
    table.setLayoutData(new GridData(GridData.FILL_BOTH));

    _validatorViewer = new CheckboxTableViewer(table);
    _validatorViewer.setContentProvider(new ArrayContentProvider());
    _validatorViewer.setLabelProvider(new LabelProvider());
    data = new GridData(GridData.FILL, GridData.FILL, true, true);
    data.heightHint = 100;
    data.widthHint = 140;
    table.setLayoutData(data);

    addvalidators();

    String stored_validators = this.getPreferenceStore().getString(IPreferenceConstants.VALIDATORS_LIST);
    restoreCheckedValidators(stored_validators);

}

From source file:com.aptana.ide.editors.preferences.UserAgentPreferencePage.java

License:Open Source License

/**
 * @param parent//ww w  . j a v a  2 s .  com
 */
private void createCategoryArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 200;
    composite.setLayoutData(data);
    Label label = new Label(composite, SWT.NONE);
    label.setFont(parent.getFont());
    label.setText(StringUtils.makeFormLabel("User Agents")); //$NON-NLS-1$
    Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
    table.setFont(parent.getFont());
    table.addSelectionListener(new SelectionAdapter() {

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        public void widgetSelected(SelectionEvent e) {
        }
    });
    categoryViewer = new CheckboxTableViewer(table);
    categoryViewer.getControl().setFont(parent.getFont());
    categoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    categoryViewer.setContentProvider(new CategoryContentProvider());
    CategoryLabelProvider categoryLabelProvider = new CategoryLabelProvider(true);
    categoryViewer.setLabelProvider(categoryLabelProvider);
    categoryViewer.setSorter(new ViewerSorter());

    categoryViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
         */
        public void selectionChanged(SelectionChangedEvent event) {
        }
    });
    categoryViewer.setInput(UnifiedContentAssistProcessor.getDefaultUserAgents());
    categoryViewer.setCheckedElements(getEnabledCategories());
}

From source file:com.aptana.php.debug.ui.launching.LaunchConfigurationsSelectionDialog.java

License:Open Source License

protected StructuredViewer createViewer(Composite parent) {
    // by default return a checkbox table viewer
    Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.CHECK);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    return new CheckboxTableViewer(table);
}

From source file:com.aptana.ui.preferences.TroubleshootingPreferencePage.java

License:Open Source License

/**
 * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
 * types of preferences. Each field editor knows how to save and restore itself.
 *///from w  w w  . ja va  2s . c  om
public void createFieldEditors() {
    Composite appearanceComposite = getFieldEditorParent();

    Composite group = AptanaPreferencePage.createGroup(appearanceComposite,
            Messages.TroubleshootingPreferencePage_LBL_DebuggingOutputLevel);

    Composite debugComp = new Composite(group, SWT.NONE);
    debugComp.setLayout(GridLayoutFactory.fillDefaults().margins(0, 5).numColumns(2).create());
    debugComp.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    Label levelLabel = new Label(debugComp, SWT.NONE);
    levelLabel.setText(Messages.TroubleshootingPreferencePage_LBL_DebugLevel);
    levelLabel.setLayoutData(GridDataFactory.swtDefaults().create());

    debugCombo = new Combo(debugComp, SWT.READ_ONLY);
    debugCombo.setItems(new String[] { Messages.TroubleshootingPreferencePage_Level_Errors,
            Messages.TroubleshootingPreferencePage_Level_Warnings,
            Messages.TroubleshootingPreferencePage_Level_All });
    debugCombo.select(StatusLevel
            .valueOf(getPreferenceStore().getString(ICorePreferenceConstants.PREF_DEBUG_LEVEL)).ordinal());

    final Label currentValue = new Label(debugComp, SWT.LEFT);
    currentValue.setText(getValueLabel(debugCombo.getSelectionIndex()));
    currentValue.setFont(SWTUtils.getDefaultSmallFont());
    currentValue.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).grab(true, true).create());

    debugCombo.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        public void widgetSelected(SelectionEvent e) {
            currentValue.setText(getValueLabel(debugCombo.getSelectionIndex()));
        }
    });

    BooleanFieldEditor showHiddenProcesses = new BooleanFieldEditor(
            ICorePreferenceConstants.PREF_SHOW_SYSTEM_JOBS,
            Messages.TroubleshootingPreferencePage_ShowHiddenProcesses, SWT.DEFAULT, group);
    addField(showHiddenProcesses);

    toggleComponents = new BooleanFieldEditor(ICorePreferenceConstants.PREF_ENABLE_COMPONENT_DEBUGGING,
            Messages.TroubleshootingPreferencePage_DebugSpecificComponents, SWT.DEFAULT, group);
    addField(toggleComponents);

    Composite composite = new Composite(group, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 5).create());
    composite.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).hint(400, 300).grab(true, true).create());

    Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
    table.setFont(group.getFont());

    categoryViewer = new CheckboxTableViewer(table);
    categoryViewer.getControl().setFont(group.getFont());
    categoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    categoryViewer.setContentProvider(ArrayContentProvider.getInstance());
    categoryViewer.setLabelProvider(new ColumnLabelProvider());
    categoryViewer.setComparator(new ViewerComparator());

    Map<String, String> tItems = EclipseUtil.getTraceableItems();
    Set<String> keys = tItems.keySet();
    String[] items = keys.toArray(new String[keys.size()]);
    Arrays.sort(items);

    categoryViewer.setInput(items);
    categoryViewer.setCheckedElements(EclipseUtil.getCurrentDebuggableComponents());
    categoryViewer.getTable().setEnabled(false);

    if (getPreferenceStore().getBoolean(ICorePreferenceConstants.PREF_ENABLE_COMPONENT_DEBUGGING)) {
        categoryViewer.getTable().setEnabled(true);
    }

    Composite buttonComp = new Composite(composite, SWT.NONE);
    buttonComp.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    buttonComp.setLayoutData(GridDataFactory.fillDefaults().create());

    Button selectAllButton = new Button(buttonComp, SWT.BORDER);
    selectAllButton.setText(Messages.TroubleshootingPreferencePage_SelectAll);
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            categoryViewer.setAllChecked(true);
        }
    });

    Button selectNoneButton = new Button(buttonComp, SWT.BORDER);
    selectNoneButton.setText(Messages.TroubleshootingPreferencePage_SelectNone);
    selectNoneButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            categoryViewer.setAllChecked(false);
        }
    });
}

From source file:com.buglabs.dragonfly.ui.wizards.bugProject.BUGModuleServiceBindingPage.java

License:Open Source License

public void createControl(Composite parent) {
    try {//w ww  . j  a  v a  2s  .  com
        Composite mainComposite = new Composite(parent, SWT.NONE);
        GridLayout layout = new GridLayout(1, false);
        mainComposite.setLayout(layout);
        mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

        Composite msComp = new Composite(mainComposite, SWT.None);
        msComp.setLayout(new GridLayout(2, false));
        msComp.setLayoutData(new GridData(GridData.FILL_BOTH));

        final TableViewer moduleViewer = new TableViewer(msComp, SWT.BORDER | SWT.V_SCROLL);
        moduleViewer.getTable().setLayoutData(getModuleViewerLayoutData());
        moduleViewer.setContentProvider(new BUGStaticServiceContentProvider());
        moduleViewer.setLabelProvider(new BUGStaticServiceLabelProvider());
        //Load the bug module model from static data provided in the plugin.
        moduleModel = BUGModule.load(getModuleModel());
        moduleViewer.setInput(moduleModel);

        Composite rComp = new Composite(msComp, SWT.None);
        rComp.setLayout(UIUtils.StripGridLayoutMargins(new GridLayout()));
        rComp.setLayoutData(new GridData(GridData.FILL_BOTH));

        serviceViewer = new CheckboxTableViewer(createServiceTable(rComp));
        serviceViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
        serviceViewer.setContentProvider(new BUGServiceContentProvider());
        serviceViewer.setLabelProvider(new BUGServiceLabelProvider());
        serviceViewer.setInput(null);
        serviceViewer.addCheckStateListener(new ICheckStateListener() {

            public void checkStateChanged(CheckStateChangedEvent event) {
                BUGModuleService bms = (BUGModuleService) ((IStructuredSelection) serviceViewer.getSelection())
                        .getFirstElement();
                if (bms != null) {
                    bms.setSelected(event.getChecked());
                }
                updateModel();
            }
        });

        final Text serviceDescText = new Text(rComp, SWT.MULTI | SWT.WRAP);
        serviceDescText.setLayoutData(getDescriptionLabelLayoutData());
        serviceDescText.setBackground(
                PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW));

        moduleViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                BUGModule bm = (BUGModule) ((IStructuredSelection) moduleViewer.getSelection())
                        .getFirstElement();
                serviceViewer.setInput(bm);
                serviceDescText.setText(bm.getDescription());
                for (BUGModuleService bms : bm.getServices()) {
                    if (bms.isSelected())
                        serviceViewer.setChecked(bms, true);
                }
            }
        });

        serviceViewer.addSelectionChangedListener(new ISelectionChangedListener() {

            public void selectionChanged(SelectionChangedEvent event) {
                BUGModuleService bms = (BUGModuleService) ((IStructuredSelection) serviceViewer.getSelection())
                        .getFirstElement();
                if (bms != null) {
                    if (bms.getDescription() == null) {
                        serviceDescText.setText("");
                    } else {
                        serviceDescText.setText(bms.getDescription());
                    }
                } else {
                    serviceDescText.setText("");
                }
            }
        });

        setControl(mainComposite);
    } catch (IOException e) {
        UIUtils.handleVisualError("Failed to load module data.", e);
    }
}

From source file:com.buglabs.dragonfly.ui.wizards.bugProject.OSGiServiceBindingPage.java

License:Open Source License

/**
 * Draws the section where you can filter services or select a service based
 * on your selection above//from w  ww  . j a va  2 s  .co m
 * 
 * @param mainComposite
 */
private void createServicesSection(final Composite mainComposite) {
    // set up
    Composite servicesComposite = new Composite(mainComposite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    servicesComposite.setLayout(layout);

    // box that surrounds this section
    Group compServices = new Group(servicesComposite, SWT.NONE);
    compServices.setText(REQUIRED_SERVICES_TITLE);
    GridData gdServices = new GridData(GridData.FILL_BOTH);
    gdServices.horizontalSpan = 2;
    gdServices.heightHint = SERVICES_GROUP_HEIGHT_HINT;
    gdServices.widthHint = SERVICES_GROUP_WIDTH_HINT;
    gdServices.grabExcessHorizontalSpace = true;
    compServices.setLayoutData(gdServices);
    compServices.setLayout(new GridLayout(3, false));

    GridData gdFillH = new GridData(GridData.FILL_HORIZONTAL);
    servicesComposite.setLayoutData(gdFillH);
    GridData gdFillBoth = GridDataFactory.createFrom(gdFillH).create();
    gdFillBoth.horizontalSpan = layout.numColumns;

    Label instructionsLabel = new Label(compServices, SWT.WRAP);
    instructionsLabel.setLayoutData(gdFillBoth);
    instructionsLabel.setText(SVCS_INSTRUCTIONS_TEXT);

    // text box for services filtering
    Text txtFilter = new Text(compServices, SWT.BORDER);
    txtFilter.setLayoutData(gdFillBoth);
    txtFilter.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String filter = ((Text) e.widget).getText();
            filter = filter.replaceAll("\\*", ".*");
            serviceFilter.setPattern("(?i).*" + filter + ".*",
                    Arrays.asList(dependencyViewer.getCheckedElements()));
            dependencyViewer.refresh();
        }
    });

    // table with list of services to choose from
    Table modulesTable = new Table(compServices, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION);
    modulesTable.setHeaderVisible(true);
    modulesTable.setLinesVisible(true);
    TableColumn col1 = new TableColumn(modulesTable, SWT.NONE);
    col1.setText(NAME_LABEL);
    TableColumn col2 = new TableColumn(modulesTable, SWT.NONE);
    col2.setText(PACKAGE_LABEL);
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(new ColumnWeightData(90));
    tableLayout.addColumnData(new ColumnWeightData(120));
    modulesTable.setLayout(tableLayout);

    // viewer for handling service dependency selection
    dependencyViewer = new CheckboxTableViewer(modulesTable);
    GridData viewerData = new GridData(GridData.FILL_BOTH);
    viewerData.horizontalSpan = layout.numColumns;
    viewerData.heightHint = DEPENDENCY_VIEWER_HEIGHT_HINT;
    dependencyViewer.getControl().setLayoutData(viewerData);
    dependencyViewer.setContentProvider(new ModulesContentProvider());
    dependencyViewer.setLabelProvider(new ModulesLabelProvider());
    dependencyViewer.setSorter(new ViewerSorter());
    dependencyViewer.addFilter(serviceFilter);

    dependencyViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            // return if null event
            if (event == null)
                return;
            ISelection selection = event.getSelection();

            // return if not IStructuredSelection
            if (!(selection instanceof IStructuredSelection))
                return;
            String selectedService = (String) ((IStructuredSelection) selection).getFirstElement();

            openServicePropertySelectorDialog(mainComposite.getShell(), selectedService, false);
        }
    });

    dependencyViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (event == null)
                return;
            String selectedService = (String) event.getElement();
            if (selectedService == null)
                return;

            // update the services list w/ new checked item
            updateModel();
        }
    });

    dependencyViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            // return if null event
            if (event == null)
                return;
            ISelection selection = event.getSelection();

            // return if not IStructuredSelection
            if (!(selection instanceof IStructuredSelection))
                return;
            String selectedService = (String) ((IStructuredSelection) selection).getFirstElement();

            // return if selectedService is null
            if (selectedService == null)
                return;

            String descr = Activator.getServiceDescription(selectedService.trim());
            serviceDescriptionArea.setText(descr);
        }
    });

    Composite buttonComposite = new Composite(compServices, SWT.NONE);
    GridData buttonData = new GridData(GridData.FILL_VERTICAL);
    buttonData.verticalSpan = 3;
    buttonComposite.setLayoutData(buttonData);
    RowLayout buttonLayout = new RowLayout(SWT.VERTICAL);
    buttonLayout.fill = true;
    //buttonLayout.pack = false;
    buttonComposite.setLayout(buttonLayout);

    Button btnSelectAll = new Button(buttonComposite, SWT.PUSH);
    btnSelectAll.setText(SELECT_ALL_LABEL);
    btnSelectAll.setToolTipText(SELECT_ALL_TOOLTIP);
    btnSelectAll.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {/*unused here*/
        }

        public void widgetSelected(SelectionEvent e) {
            dependencyViewer.setAllChecked(true);
            updateModel();
        }
    });

    Button btnDeselectAll = new Button(buttonComposite, SWT.PUSH);
    btnDeselectAll.setText(DESELECT_ALL_LABEL);
    btnDeselectAll.setToolTipText(DESELECT_ALL_TOOLTIP);
    btnDeselectAll.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {/*unused here*/
        }

        public void widgetSelected(SelectionEvent e) {
            dependencyViewer.setAllChecked(false);
            updateModel();
        }
    });

    // refresh services button
    refreshServiceDefintions = new Button(buttonComposite, SWT.PUSH);
    refreshServiceDefintions.setText(REFRESH_SERVICES_LABEL);
    refreshServiceDefintions.setToolTipText(REFRESH_SERVICES_TOOLTIP);
    refreshServiceDefintions.setEnabled(false);
    refreshServiceDefintions.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {/*unused here*/
        }

        public void widgetSelected(SelectionEvent e) {
            final BugConnection connection = (BugConnection) ((StructuredSelection) bugsViewer.getSelection())
                    .getFirstElement();

            // if no connection, show error and return
            if (connection == null) {
                UIUtils.giveVisualInformation("Please select target BUG to refresh");
                return;
            }

            // warn user things are going to get cleared
            if (!reloadListDialog(mainComposite.getShell()))
                return;

            // clear pinfo's selections
            clearSelections();

            // must be connection, kick off job
            launchRefreshServicesJob(connection);
        }
    });

    // set up service description area
    serviceDescriptionArea = new Text(compServices, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    GridData descData = new GridData(GridData.FILL_BOTH);
    descData.heightHint = SERVICE_DESCRIPTION_AREA_HEIGHT;
    descData.horizontalSpan = 2;
    serviceDescriptionArea.setLayoutData(descData);
    serviceDescriptionArea.setEditable(false);
    serviceDescriptionArea.setForeground(compServices.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
    serviceDescriptionArea.setText(SERVICE_DESCRIPTION_LABEL);

}

From source file:com.ecfeed.ui.editor.CheckboxTableViewerSection.java

License:Open Source License

@Override
protected StructuredViewer createViewer(Composite parent, int style) {
    Table table = createTable(parent, style);
    table.setLayoutData(viewerLayoutData());
    return new CheckboxTableViewer(table);
}

From source file:com.ge.research.sadl.ui.preferences.SadlReasonerPreferencePage.java

License:Open Source License

/**
 * Create the preference options.//from  w ww .j a v a  2  s .  com
 * 
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 * @return org.eclipse.swt.widgets.Control
 */
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
    layout.verticalSpacing = convertVerticalDLUsToPixels(3);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    composite.setLayoutData(data);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(Messages.preferenceReasonerDescription);
    data = new GridData(SWT.FILL, SWT.NONE, false, false);
    data.horizontalSpan = 2;
    data.widthHint = 275;
    label.setLayoutData(data);

    label = new Label(composite, SWT.NONE);
    label.setText(Messages.reasonerList);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    table = new Table(composite,
            SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    table.setLayoutData(data);
    table.setHeaderVisible(false);
    table.setLinesVisible(false);

    TableLayout tableLayout = new TableLayout();
    new TableColumn(table, SWT.NONE);
    tableLayout.addColumnData(new ColumnWeightData(100));
    table.setLayout(tableLayout);

    tableViewer = new CheckboxTableViewer(table);
    tableViewer.setContentProvider(new ReasonerContentProvider());
    tableViewer.setLabelProvider(new ReasonerTableLabelProvider());
    tableViewer.setInput("root");

    // un-check all other elements that might be checked and leave only the
    // element checked to remain checked since one can only chose one
    // reasoner at a time to be current.
    tableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultReasoner(e.getElement());
            checkedReasoner = (IReasoner) e.getElement();
            translators = getAvailableTranslatorsForReasoner(checkedReasoner);
            if (translatorTableViewer != null) {
                translatorTableViewer.refresh(true, false);
            }
            // if no other reasoners are checked, don't allow the single one
            // currently checked to become unchecked, and lose a current
            // reasoner. That is, don't permit un-checking if no other item
            // is checked which is supposed to be the case.
            Object[] obj = tableViewer.getCheckedElements();
            if (obj.length == 0)
                tableViewer.setChecked(e.getElement(), true);
        }
    });

    // set a default, checked reasoner based on the current reasoner. If there
    // is not a current reasoner, but the first item exists, use that instead.
    // This will work currently until workbench shutdown, because current
    // reasoner is not yet persisted.
    String reasonerName = null;
    try {
        reasonerName = configurationManager.getReasonerClassName();
    } catch (ConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    checkedReasoner = null;
    tableViewer.setAllChecked(true);
    Object[] obj = tableViewer.getCheckedElements();
    for (int i = 0; i < obj.length; i++) {
        if (reasonerName != null && ((IReasoner) obj[i]).getClass().getName().equals(reasonerName)) {
            checkedReasoner = (IReasoner) obj[i];
            break;
        }
    }
    tableViewer.setAllChecked(false);
    if (checkedReasoner != null)
        tableViewer.setChecked(checkedReasoner, true);
    else {
        Object o = tableViewer.getElementAt(0);
        if (o != null) {
            tableViewer.setChecked(o, true);
            checkedReasoner = (IReasoner) o;
        }
    }
    translators = getAvailableTranslatorsForReasoner(checkedReasoner);

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sele = ((IStructuredSelection) tableViewer.getSelection());
            boolean sel = sele.getFirstElement() != null && (sele.getFirstElement() instanceof IReasoner);
            edit.setEnabled(sel);
        }
    });

    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection sel = ((IStructuredSelection) tableViewer.getSelection());
            Object firstElem = sel.getFirstElement();
            if (firstElem != null && (firstElem instanceof IReasoner)) {
                IReasoner r = (IReasoner) sel.getFirstElement();
                String rc = r.getConfigurationCategory();
                Map<String, ConfigurationOption> config = r.getReasonerConfigurationOptions();
                ReasonerConfigurationDialog dialog = new ReasonerConfigurationDialog(getShell(), rc, config,
                        configurationManager);
                int dialogReturnButton = dialog.open();
            }
        }
    });

    Composite buttonComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(3);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    buttonComp.setLayout(layout);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);

    edit = createButton(buttonComp, Messages.edit);
    edit.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection sel = ((IStructuredSelection) tableViewer.getSelection());
            IReasoner r = (IReasoner) sel.getFirstElement();
            String rc = r.getConfigurationCategory();
            Map<String, ConfigurationOption> config = r.getReasonerConfigurationOptions();
            // addTestingOptions(config);
            ReasonerConfigurationDialog dialog = new ReasonerConfigurationDialog(getShell(), rc, config,
                    configurationManager);
            if (config == null) {
                // display appropriate message?
            }
            int dialogReturnButton = dialog.open();
        }
    });
    tableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultReasoner(e.getElement());
            checkedReasoner = (IReasoner) e.getElement();
            translators = getAvailableTranslatorsForReasoner(checkedReasoner);
            if (translatorTableViewer != null) {
                translatorTableViewer.refresh(true, false);
            }
        }
    });

    IStructuredSelection sele = ((IStructuredSelection) tableViewer.getSelection());
    boolean sel = sele.getFirstElement() != null && (sele.getFirstElement() instanceof IReasoner);
    edit.setEnabled(sel);

    // Translator code starts here
    label = new Label(composite, SWT.NONE);
    label.setText(Messages.translatorList);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    translatorTable = new Table(composite,
            SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    translatorTable.setLayoutData(data);
    translatorTable.setHeaderVisible(false);
    translatorTable.setLinesVisible(false);

    TableLayout translatorTableLayout = new TableLayout();
    new TableColumn(translatorTable, SWT.NONE);
    translatorTableLayout.addColumnData(new ColumnWeightData(100));
    translatorTable.setLayout(translatorTableLayout);

    translatorTableViewer = new CheckboxTableViewer(translatorTable);
    translatorTableViewer.setContentProvider(new TranslatorContentProvider());
    translatorTableViewer.setLabelProvider(new TranslatorTableLabelProvider());
    translatorTableViewer.setInput("root");

    // un-check all other elements that might be checked and leave only the
    // element checked to remain checked since one can only chose one
    // translator at a time to be current.
    translatorTableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultTranslator(e.getElement());
            checkedTranslator = (ITranslator) e.getElement();
            // if no other translators are checked, don't allow the single one
            // currently checked to become unchecked, and lose a current
            // translator. That is, don't permit un-checking if no other item
            // is checked which is supposed to be the case.
            Object[] obj = translatorTableViewer.getCheckedElements();
            if (obj.length == 0)
                translatorTableViewer.setChecked(e.getElement(), true);
        }
    });

    // set a default, checked translator based on the current reasoner. If there
    // is not a current reasoner, but the first item exists, use that instead.
    // This will work currently until workbench shutdown, because current
    // reasoner is not yet persisted.
    String translatorName = null;
    try {
        translatorName = configurationManager.getTranslatorClassName();
    } catch (ConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    checkedTranslator = null;
    translatorTableViewer.setAllChecked(true);
    obj = translatorTableViewer.getCheckedElements();
    for (int i = 0; i < obj.length; i++) {
        if (translatorName != null && ((ITranslator) obj[i]).getClass().getName().equals(translatorName)) {
            checkedTranslator = (ITranslator) obj[i];
            break;
        }
    }
    translatorTableViewer.setAllChecked(false);
    if (checkedTranslator != null)
        translatorTableViewer.setChecked(checkedTranslator, true);
    else {
        Object o = translatorTableViewer.getElementAt(0);
        if (o != null) {
            translatorTableViewer.setChecked(o, true);
            checkedTranslator = (ITranslator) o;
        }
    }

    translatorTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sele = ((IStructuredSelection) translatorTableViewer.getSelection());
            boolean sel = sele.getFirstElement() != null && (sele.getFirstElement() instanceof ITranslator);
            editTranslator.setEnabled(sel);
        }
    });

    translatorTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection sel = ((IStructuredSelection) translatorTableViewer.getSelection());
            Object firstElem = sel.getFirstElement();
            if (firstElem != null && (firstElem instanceof ITranslator)) {
                ITranslator t = (ITranslator) sel.getFirstElement();
                String tc = t.getConfigurationCategory();
                Map<String, ConfigurationOption> config = t.getTranslatorConfigurationOptions();
                TranslatorConfigurationDialog dialog = new TranslatorConfigurationDialog(getShell(), t,
                        configurationManager);
                int dialogReturnButton = dialog.open();
            }
        }
    });

    Composite buttonCompTrans = new Composite(composite, SWT.NONE);
    GridLayout translatorEditBtnLayout = new GridLayout();
    translatorEditBtnLayout.horizontalSpacing = 0;
    translatorEditBtnLayout.verticalSpacing = convertVerticalDLUsToPixels(3);
    translatorEditBtnLayout.marginWidth = 0;
    translatorEditBtnLayout.marginHeight = 0;
    translatorEditBtnLayout.numColumns = 1;
    buttonCompTrans.setLayout(translatorEditBtnLayout);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    buttonCompTrans.setLayoutData(data);

    editTranslator = createButton(buttonCompTrans, Messages.edit);
    editTranslator.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection sel = ((IStructuredSelection) translatorTableViewer.getSelection());
            ITranslator t = (ITranslator) sel.getFirstElement();
            String tc = t.getConfigurationCategory();
            Map<String, ConfigurationOption> config = t.getTranslatorConfigurationOptions();
            // addTestingOptions(config);
            TranslatorConfigurationDialog dialog = new TranslatorConfigurationDialog(getShell(), t,
                    configurationManager);
            int dialogReturnButton = dialog.open();
        }
    });
    translatorTableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultTranslator(e.getElement());
            checkedTranslator = (ITranslator) e.getElement();
        }
    });

    IStructuredSelection selet = ((IStructuredSelection) translatorTableViewer.getSelection());
    boolean selt = selet.getFirstElement() != null && (selet.getFirstElement() instanceof ITranslator);
    editTranslator.setEnabled(selt);
    translatorTableViewer.refresh(true, false);

    // Translator code ends here
    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:com.ge.research.sadl.ui.properties.SadlReasonerPreferencePage.java

License:Open Source License

/**
 * Create the preference options.//from ww  w .j av  a  2 s  .c  o  m
 * 
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 * @return org.eclipse.swt.widgets.Control
 */
protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
    layout.verticalSpacing = convertVerticalDLUsToPixels(3);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
    composite.setLayoutData(data);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(Messages.preferenceReasonerDescription);
    data = new GridData(SWT.FILL, SWT.NONE, false, false);
    data.horizontalSpan = 2;
    data.widthHint = 275;
    label.setLayoutData(data);

    label = new Label(composite, SWT.NONE);
    label.setText(Messages.reasonerList);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    table = new Table(composite,
            SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    table.setLayoutData(data);
    table.setHeaderVisible(false);
    table.setLinesVisible(false);

    TableLayout tableLayout = new TableLayout();
    new TableColumn(table, SWT.NONE);
    tableLayout.addColumnData(new ColumnWeightData(100));
    table.setLayout(tableLayout);

    tableViewer = new CheckboxTableViewer(table);
    tableViewer.setContentProvider(new ReasonerContentProvider());
    tableViewer.setLabelProvider(new ReasonerTableLabelProvider());
    tableViewer.setInput("root");

    // un-check all other elements that might be checked and leave only the
    // element checked to remain checked since one can only chose one
    // reasoner at a time to be current.
    tableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultReasoner(e.getElement());
            checkedReasoner = (IReasoner) e.getElement();
            translators = getAvailableTranslatorsForReasoner(checkedReasoner);
            if (translatorTableViewer != null) {
                translatorTableViewer.refresh(true, false);
            }
            // if no other reasoners are checked, don't allow the single one
            // currently checked to become unchecked, and lose a current
            // reasoner. That is, don't permit un-checking if no other item
            // is checked which is supposed to be the case.
            Object[] obj = tableViewer.getCheckedElements();
            if (obj.length == 0)
                tableViewer.setChecked(e.getElement(), true);
        }
    });

    // set a default, checked reasoner based on the current reasoner. If there
    // is not a current reasoner, but the first item exists, use that instead.
    // This will work currently until workbench shutdown, because current
    // reasoner is not yet persisted.
    String reasonerName = null;
    try {
        reasonerName = configurationManager.getReasonerClassName();
    } catch (ConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    checkedReasoner = null;
    tableViewer.setAllChecked(true);
    Object[] obj = tableViewer.getCheckedElements();
    for (int i = 0; i < obj.length; i++) {
        if (reasonerName != null && ((IReasoner) obj[i]).getClass().getName().equals(reasonerName)) {
            checkedReasoner = (IReasoner) obj[i];
            break;
        }
    }
    tableViewer.setAllChecked(false);
    if (checkedReasoner != null)
        tableViewer.setChecked(checkedReasoner, true);
    else {
        Object o = tableViewer.getElementAt(0);
        if (o != null) {
            tableViewer.setChecked(o, true);
            checkedReasoner = (IReasoner) o;
        }
    }
    translators = getAvailableTranslatorsForReasoner(checkedReasoner);

    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sele = ((IStructuredSelection) tableViewer.getSelection());
            boolean sel = sele.getFirstElement() != null && (sele.getFirstElement() instanceof IReasoner);
            edit.setEnabled(sel);
        }
    });

    tableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection sel = ((IStructuredSelection) tableViewer.getSelection());
            Object firstElem = sel.getFirstElement();
            if (firstElem != null && (firstElem instanceof IReasoner)) {
                IReasoner r = (IReasoner) sel.getFirstElement();
                String rc = r.getConfigurationCategory();
                Map<String, ConfigurationOption> config = r.getReasonerConfigurationOptions();
                ReasonerConfigurationDialog dialog = new ReasonerConfigurationDialog(getShell(), rc, config,
                        configurationManager);
                int dialogReturnButton = dialog.open();
            }
        }
    });

    Composite buttonComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(3);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    buttonComp.setLayout(layout);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);

    edit = createButton(buttonComp, Messages.edit);
    edit.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection sel = ((IStructuredSelection) tableViewer.getSelection());
            IReasoner r = (IReasoner) sel.getFirstElement();
            String rc = r.getConfigurationCategory();
            Map<String, ConfigurationOption> config = r.getReasonerConfigurationOptions();
            // addTestingOptions(config);
            ReasonerConfigurationDialog dialog = new ReasonerConfigurationDialog(getShell(), rc, config,
                    configurationManager);
            int dialogReturnButton = dialog.open();
        }
    });
    tableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultReasoner(e.getElement());
            checkedReasoner = (IReasoner) e.getElement();
            translators = getAvailableTranslatorsForReasoner(checkedReasoner);
            if (translatorTableViewer != null) {
                translatorTableViewer.refresh(true, false);
            }
        }
    });

    IStructuredSelection sele = ((IStructuredSelection) tableViewer.getSelection());
    boolean sel = sele.getFirstElement() != null && (sele.getFirstElement() instanceof IReasoner);
    edit.setEnabled(sel);

    // Translator code starts here
    label = new Label(composite, SWT.NONE);
    label.setText(Messages.translatorList);
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    translatorTable = new Table(composite,
            SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    translatorTable.setLayoutData(data);
    translatorTable.setHeaderVisible(false);
    translatorTable.setLinesVisible(false);

    TableLayout translatorTableLayout = new TableLayout();
    new TableColumn(translatorTable, SWT.NONE);
    translatorTableLayout.addColumnData(new ColumnWeightData(100));
    translatorTable.setLayout(translatorTableLayout);

    translatorTableViewer = new CheckboxTableViewer(translatorTable);
    translatorTableViewer.setContentProvider(new TranslatorContentProvider());
    translatorTableViewer.setLabelProvider(new TranslatorTableLabelProvider());
    translatorTableViewer.setInput("root");

    // un-check all other elements that might be checked and leave only the
    // element checked to remain checked since one can only chose one
    // translator at a time to be current.
    translatorTableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultTranslator(e.getElement());
            checkedTranslator = (ITranslator) e.getElement();
            // if no other translators are checked, don't allow the single one
            // currently checked to become unchecked, and lose a current
            // translator. That is, don't permit un-checking if no other item
            // is checked which is supposed to be the case.
            Object[] obj = translatorTableViewer.getCheckedElements();
            if (obj.length == 0)
                translatorTableViewer.setChecked(e.getElement(), true);
        }
    });

    // set a default, checked translator based on the current reasoner. If there
    // is not a current reasoner, but the first item exists, use that instead.
    // This will work currently until workbench shutdown, because current
    // reasoner is not yet persisted.
    String translatorName = null;
    try {
        translatorName = configurationManager.getTranslatorClassName();
    } catch (ConfigurationException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    checkedTranslator = null;
    translatorTableViewer.setAllChecked(true);
    obj = translatorTableViewer.getCheckedElements();
    for (int i = 0; i < obj.length; i++) {
        if (translatorName != null && ((ITranslator) obj[i]).getClass().getName().equals(translatorName)) {
            checkedTranslator = (ITranslator) obj[i];
            break;
        }
    }
    translatorTableViewer.setAllChecked(false);
    if (checkedTranslator != null)
        translatorTableViewer.setChecked(checkedTranslator, true);
    else {
        Object o = translatorTableViewer.getElementAt(0);
        if (o != null) {
            translatorTableViewer.setChecked(o, true);
            checkedTranslator = (ITranslator) o;
        }
    }

    translatorTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection sele = ((IStructuredSelection) translatorTableViewer.getSelection());
            boolean sel = sele.getFirstElement() != null && (sele.getFirstElement() instanceof ITranslator);
            editTranslator.setEnabled(sel);
        }
    });

    translatorTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection sel = ((IStructuredSelection) translatorTableViewer.getSelection());
            Object firstElem = sel.getFirstElement();
            if (firstElem != null && (firstElem instanceof ITranslator)) {
                ITranslator t = (ITranslator) sel.getFirstElement();
                String tc = t.getConfigurationCategory();
                Map<String, ConfigurationOption> config = t.getTranslatorConfigurationOptions();
                TranslatorConfigurationDialog dialog = new TranslatorConfigurationDialog(getShell(), t,
                        configurationManager);
                int dialogReturnButton = dialog.open();
            }
        }
    });

    Composite buttonCompTrans = new Composite(composite, SWT.NONE);
    GridLayout translatorEditBtnLayout = new GridLayout();
    translatorEditBtnLayout.horizontalSpacing = 0;
    translatorEditBtnLayout.verticalSpacing = convertVerticalDLUsToPixels(3);
    translatorEditBtnLayout.marginWidth = 0;
    translatorEditBtnLayout.marginHeight = 0;
    translatorEditBtnLayout.numColumns = 1;
    buttonCompTrans.setLayout(translatorEditBtnLayout);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    buttonCompTrans.setLayoutData(data);

    editTranslator = createButton(buttonCompTrans, Messages.edit);
    editTranslator.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection sel = ((IStructuredSelection) translatorTableViewer.getSelection());
            ITranslator t = (ITranslator) sel.getFirstElement();
            String tc = t.getConfigurationCategory();
            Map<String, ConfigurationOption> config = t.getTranslatorConfigurationOptions();
            // addTestingOptions(config);
            TranslatorConfigurationDialog dialog = new TranslatorConfigurationDialog(getShell(), t,
                    configurationManager);
            int dialogReturnButton = dialog.open();
        }
    });
    translatorTableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent e) {
            checkNewDefaultTranslator(e.getElement());
            checkedTranslator = (ITranslator) e.getElement();
        }
    });

    IStructuredSelection selet = ((IStructuredSelection) translatorTableViewer.getSelection());
    boolean selt = selet.getFirstElement() != null && (selet.getFirstElement() instanceof ITranslator);
    editTranslator.setEnabled(selt);
    translatorTableViewer.refresh(true, false);

    // Translator code ends here
    Dialog.applyDialogFont(composite);

    return composite;
}