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:com.nokia.carbide.cpp.internal.api.sdk.ui.SBSv2PlatformFilterComposite.java

License:Open Source License

public void createControls() {
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;//from w ww  .  ja v  a2  s .  com
    setLayout(gridLayout);

    GridData gd = new GridData(SWT.LEFT, SWT.LEFT, true, false);
    gd.widthHint = 200;
    gd.heightHint = 350;

    Label aliasBoxLabel = new Label(this, SWT.NONE);
    aliasBoxLabel.setText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupText"));
    aliasBoxLabel.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.PlatformsGroupToolTip"));

    Label variantBoxLabel = new Label(this, SWT.NONE);
    variantBoxLabel.setText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupText"));
    variantBoxLabel.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.ProductsGroupToolTip"));

    buildAliasTableViewer = CheckboxTableViewer.newCheckList(this, SWT.BORDER);
    buildAliasTableViewer.getTable().setLayoutData(gd);
    buildAliasTableViewer.setContentProvider(new ArrayContentProvider());
    buildAliasTableViewer.setLabelProvider(new LabelProvider());

    customVariantListViewer = new ListViewer(this);
    customVariantListViewer.getList().setLayoutData(gd);
    customVariantListViewer.setContentProvider(new ArrayContentProvider());
    customVariantListViewer.setLabelProvider(new LabelProvider());
    customVariantListViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            if (customVariantListViewer.getSelection() != null
                    && !customVariantListViewer.getSelection().isEmpty()) {
                removeVariantButton.setEnabled(true);
            } else {
                removeVariantButton.setEnabled(false);
            }
        }
    });

    refreshButton = new Button(this, SWT.NONE);
    refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$
    refreshButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonToolTip")); //$NON-NLS-1$

    refreshButton.addSelectionListener(new SelectionListener() {

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

        public void widgetSelected(SelectionEvent e) {
            refreshButton.setEnabled(false);
            refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonScanningText")); //$NON-NLS-1$

            //            for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){
            //               ((SBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER)).clearDataFromBuildCache();
            //            }
            SBSv2QueryUtils.removeAllCachedQueries();

            refreshLocalSBSCacheData();

            SBSv2QueryUtils.flushAllSBSv2Caches();
            refreshButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RefreshButtonText")); //$NON-NLS-1$
            refreshButton.setEnabled(true);
        }

    });

    Composite variantButtonsComposite = new Composite(this, SWT.NONE);
    gridLayout = new GridLayout();
    gridLayout.makeColumnsEqualWidth = true;
    gridLayout.numColumns = 2;
    variantButtonsComposite.setLayout(gridLayout);
    GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
    variantButtonsComposite.setLayoutData(gridData);

    addVariantButton = new Button(variantButtonsComposite, SWT.NONE);
    addVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonText")); //$NON-NLS-1$
    addVariantButton.setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.AddProductButtonToolTip")); //$NON-NLS-1$
    addVariantButton.setLayoutData(gridData);
    addVariantButton.addSelectionListener(new SelectionListener() {

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

        public void widgetSelected(SelectionEvent e) {
            if (aliasMap.size() == 0) {
                MessageDialog.openError(getShell(), "No build configurations found.",
                        "No build configurations (aliases) were found from any SDKs. Attempted 'sbs --query=aliases' but found no results.");
            } else if (productVariantList.size() == 0) {
                MessageDialog.openError(getShell(), "No products found.",
                        "No products were found from any SDKs. Attempted 'sbs --query=products' but found no results.");
            } else {
                String selectedAlias = "";
                ISelection selectedItem = buildAliasTableViewer.getSelection();

                StructuredSelection selection = (StructuredSelection) selectedItem;
                String stringSelection = (String) selection.getFirstElement();
                if (stringSelection != null) {
                    TableItem[] tableItems = buildAliasTableViewer.getTable().getItems();
                    for (TableItem item : tableItems) {
                        if (stringSelection.equals(item.getText())) {
                            selectedAlias = item.getText();
                            break;
                        }
                    }
                }
                AddSBSv2ProductVariant addVariantDlg = new AddSBSv2ProductVariant(getShell(), selectedAlias,
                        aliasMap, productVariantList);
                if (addVariantDlg.open() == TrayDialog.OK) {
                    if (customVariantListViewer.testFindItem(addVariantDlg.getUserCreatedVariant()) == null) {
                        // doesn't exist, add it. if it does exist just ignore it
                        List<String> variantList = (List<String>) customVariantListViewer.getInput();
                        variantList.add(addVariantDlg.getUserCreatedVariant());
                        customVariantListViewer.setInput(variantList);
                        customVariantListViewer.refresh();
                    }
                }
            }
        }

    });

    removeVariantButton = new Button(variantButtonsComposite, SWT.NONE);
    removeVariantButton.setText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonText")); //$NON-NLS-1$
    removeVariantButton
            .setToolTipText(Messages.getString("SBSv2PlatformFilterComposite.RemoveProductButtonToolTip")); //$NON-NLS-1$
    removeVariantButton.setLayoutData(gridData);
    removeVariantButton.setEnabled(false);
    removeVariantButton.addSelectionListener(new SelectionListener() {

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

        public void widgetSelected(SelectionEvent e) {
            ISelection selectedVariant = customVariantListViewer.getSelection();
            if (selectedVariant != null) {
                StructuredSelection selection = (StructuredSelection) selectedVariant;
                String stringSelection = (String) selection.getFirstElement();
                List<String> data = (List<String>) customVariantListViewer.getInput();
                data.remove(stringSelection);
                customVariantListViewer.setInput(data);
                customVariantListViewer.refresh(true);
                removeVariantButton.setEnabled(false);
            }
        }

    });

    initTable();
    addListeners();
}

From source file:com.nokia.carbide.cpp.internal.codescanner.ui.CSRulesTabPage.java

License:Open Source License

/**
 * Create contents of this tab page.//from  ww w .  j  a v  a  2 s.c  o m
 * @param parent - the parent composite
 */
public CSRulesTabPage(Composite parent) {
    super(parent, SWT.NONE);
    defaultConfigSettings = CSPlugin.getConfigManager().getDefaultConfig();
    rules = new ArrayList<CSRule>();

    this.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    this.setLayout(gridLayout);

    // table for CodeScanner rules
    tableGroup = new Group(this, SWT.NONE);
    final GridData tableGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    tableGridData.heightHint = 250;
    tableGridData.widthHint = 200;
    tableGroup.setText(Messages.getString("RulesTabPage.RulesTableMessage"));
    tableGroup.setLayoutData(tableGridData);
    tableGroup.setLayout(new GridLayout());

    rulesTableViewer = CheckboxTableViewer.newCheckList(tableGroup,
            SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    rulesTableViewer.setLabelProvider(new CSRulesLabelProvider());
    rulesTableViewer.setContentProvider(new ArrayContentProvider());
    rulesSorter = new CSRulesSorter();
    rulesTableViewer.setSorter(rulesSorter);
    rulesTableViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            CSRule rule = (CSRule) event.getElement();
            rule.setEnabled(event.getChecked());
        }
    });
    rulesTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            handleEdit();
        }
    });

    Table rulesTable = rulesTableViewer.getTable();
    rulesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    rulesTable.setHeaderVisible(true);
    rulesTable.setLinesVisible(true);

    // create the columns of the table
    TableColumn tableColumn1 = new TableColumn(rulesTable, SWT.LEFT);
    tableColumn1.setText(Messages.getString("RulesTabPage.RulesTableRulesLabel"));
    tableColumn1.setWidth(170);
    tableColumn1.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            rulesSorter.setSortingType(CSRulesSorter.SORT_BY_RULE);
            rulesSorter.sort(rulesTableViewer, rules.toArray());
            rulesTableViewer.setInput(rules.toArray());
            setCheckedElements();
        }
    });

    TableColumn tableColumn2 = new TableColumn(rulesTable, SWT.LEFT);
    tableColumn2.setText(Messages.getString("RulesTabPage.RulesTableCategoriesLabel"));
    tableColumn2.setWidth(80);
    tableColumn2.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            rulesSorter.setSortingType(CSRulesSorter.SORT_BY_CATEGORY);
            rulesSorter.sort(rulesTableViewer, rules.toArray());
            rulesTableViewer.setInput(rules.toArray());
            setCheckedElements();
        }
    });

    TableColumn tableColumn3 = new TableColumn(rulesTable, SWT.LEFT);
    tableColumn3.setText(Messages.getString("RulesTabPage.RulesTableSeveritiesLabel"));
    tableColumn3.setWidth(65);
    tableColumn3.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            rulesSorter.setSortingType(CSRulesSorter.SORT_BY_SEVERITY);
            rulesSorter.sort(rulesTableViewer, rules.toArray());
            rulesTableViewer.setInput(rules.toArray());
            setCheckedElements();
        }
    });

    // various buttons for manipulating the rules
    Composite composite = new Composite(this, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    final GridLayout buttonGridLayout = new GridLayout();
    buttonGridLayout.makeColumnsEqualWidth = true;
    composite.setLayout(buttonGridLayout);
    final GridData buttonsGridData = new GridData(SWT.NONE, SWT.NONE, true, false);
    buttonsGridData.widthHint = 80;

    editButton = new Button(composite, SWT.NONE);
    editButton.setLayoutData(buttonsGridData);
    editButton.setText(Messages.getString("RulesTabPage.EditRuleLabel"));
    editButton.setToolTipText(Messages.getString("RulesTabPage.EditRuleMessage"));
    editButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleEdit();
        }
    });
    editButton.setEnabled(false);

    enableAllButton = new Button(composite, SWT.NONE);
    enableAllButton.setLayoutData(buttonsGridData);
    enableAllButton.setText(Messages.getString("RulesTabPage.EnableAllRulesLabel"));
    enableAllButton.setToolTipText(Messages.getString("RulesTabPage.EnableAllRulesMessage"));
    enableAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleEnableAll();
        }
    });

    disableAllButton = new Button(composite, SWT.NONE);
    disableAllButton.setLayoutData(buttonsGridData);
    disableAllButton.setText(Messages.getString("RulesTabPage.DisableAllRulesLabel"));
    disableAllButton.setToolTipText(Messages.getString("RulesTabPage.DisableAllRulesMessage"));
    disableAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            handleDisableAll();
        }
    });

    // enable the Edit and Details buttons only when a single rule is selected
    rulesTable.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent arg0) {
            boolean enable = (rulesTableViewer.getTable().getSelectionCount() == 1);
            editButton.setEnabled(enable);
            handleDetails();
        }
    });

    // label to display detail info of a selected rule
    Group detailsGroup = new Group(this, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.heightHint = 60;
    gridData.widthHint = 200;
    detailsGroup.setText(Messages.getString("RulesTabPage.DetailsLabel"));
    detailsGroup.setLayoutData(gridData);
    detailsGroup.setLayout(new GridLayout());

    detailsLabel = new Label(detailsGroup, SWT.WRAP);
    gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    gridData.heightHint = 55;
    gridData.widthHint = 200;
    detailsLabel.setLayoutData(gridData);
    detailsLabel.setText("");
}

From source file:com.nokia.carbide.cpp.internal.news.reader.ui.NewsPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    final Composite content = new Composite(parent, SWT.NONE);
    final GridLayout contentGridLayout = new GridLayout();
    contentGridLayout.numColumns = 2;/*w  ww .ja v  a2s.  c om*/
    content.setLayout(contentGridLayout);
    content.setLayoutData(new GridData(GridData.FILL_BOTH));

    launchCtrlButton = new Button(content, SWT.CHECK);
    launchCtrlButton.setText(Messages.Preferences_LaunchCtrlLabel);
    launchCtrlButton.setToolTipText(Messages.Preferences_LaunchCtrlMessage);

    // filler
    new Label(content, SWT.NONE);

    final Group newsFeedsGroup = new Group(content, SWT.NONE);
    newsFeedsGroup.setLayout(new GridLayout());
    final GridData channelsGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    channelsGridData.heightHint = 100;
    channelsGridData.widthHint = 200;
    newsFeedsGroup.setLayoutData(channelsGridData);
    newsFeedsGroup.setText(Messages.Preferences_NewsFeedsGroupLabel);

    newsFeedsTableViewer = CheckboxTableViewer.newCheckList(newsFeedsGroup, SWT.BORDER);
    newsFeedsTableViewer.setLabelProvider(new NewsPreferenceLabelProvider());
    newsFeedsTableViewer.setContentProvider(new ArrayContentProvider());
    getNewsFeeds();
    newsFeedsTableViewer.setInput(newsFeeds);
    getNewsFeedsSubscriptionStatus();
    final Table table = newsFeedsTableViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    table.setToolTipText(Messages.Preferences_NewsFeedsTableMessage);

    final Composite buttonsComposite = new Composite(content, SWT.NONE);
    final GridLayout buttonsGridLayout = new GridLayout();
    buttonsGridLayout.makeColumnsEqualWidth = true;
    buttonsComposite.setLayout(buttonsGridLayout);
    buttonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    final GridData buttonsGridData = new GridData(SWT.NONE, SWT.NONE, true, false);
    buttonsGridData.widthHint = 80;

    selectAllButton = new Button(buttonsComposite, SWT.NONE);
    selectAllButton.setText(Messages.Preferences_SelectAllLabel);
    selectAllButton.setToolTipText(Messages.Preferences_SelectAllMessage);
    selectAllButton.setLayoutData(buttonsGridData);
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            handleSelectAll();
        }
    });

    clearAllButton = new Button(buttonsComposite, SWT.NONE);
    clearAllButton.setText(Messages.Preferences_ClearAllLabel);
    clearAllButton.setToolTipText(Messages.Preferences_ClearAllMessage);
    clearAllButton.setLayoutData(buttonsGridData);
    clearAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            handleClearAll();
        }
    });

    final Group feedUpdateGroup = new Group(content, SWT.NONE);
    feedUpdateGroup.setLayout(new GridLayout());
    final GridData feedUpdateGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    feedUpdateGridData.heightHint = 70;
    feedUpdateGridData.widthHint = 200;
    feedUpdateGroup.setLayoutData(feedUpdateGridData);
    feedUpdateGroup.setText(Messages.Preferences_UpdateIntervalLabel);
    feedUpdateGroup.setToolTipText(Messages.Preferences_UpdateIntervalMessage);

    update06hrButton = new Button(feedUpdateGroup, SWT.RADIO);
    update06hrButton.setText(Messages.Preferences_Update06HourLabel);
    update12hrButton = new Button(feedUpdateGroup, SWT.RADIO);
    update12hrButton.setText(Messages.Preferences_Update12HourLabel);
    update24hrButton = new Button(feedUpdateGroup, SWT.RADIO);
    update24hrButton.setText(Messages.Preferences_Update24HourLabel);

    getStoredPreferenceValues();
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, NewsUIHelpIDs.NEWSREADER_PREFERENCE_PAGE);
    return content;
}

From source file:com.nokia.carbide.cpp.internal.pi.wizards.ui.PluginSelectionGroup.java

License:Open Source License

public void createContent() {
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;/*from w  w  w .  j ava 2  s. c o  m*/
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;

    this.setLayout(gridLayout);

    this.setLayoutData(new GridData(GridData.FILL_BOTH));

    tableTitleLabel = new Label(this, SWT.NONE);
    final Composite tablePanel = new Composite(this, SWT.NONE);
    final GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
    tablePanel.setLayout(gridLayout);
    tablePanel.setLayoutData(layoutData);
    if (profilerActivator) {
        tableTitleLabel.setText(Messages.getString("TraceSelectionGroup.profilerActivatorTitle")); //$NON-NLS-1$
    } else {
        tableTitleLabel.setText(Messages.getString("TraceSelectionGroup.groupTitle")); //$NON-NLS-1$
    }
    viewerTraceSelection = CheckboxTableViewer.newCheckList(tablePanel, SWT.BORDER | SWT.FULL_SELECTION);
    viewerTraceSelection.setContentProvider(new IStructuredContentProvider() {

        public Object[] getElements(Object inputElement) {
            if (inputElement instanceof List<?>) {
                return ((List<?>) inputElement).toArray();
            }
            return new Object[0];
        }

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

    });
    viewerTraceSelection.setSorter(new ViewerSorter() {

        @Override
        public int compare(Viewer viewer, Object e1, Object e2) {
            if (profilerDataPlugins == null) {
                return 0;
            }
            ITrace trace1 = (ITrace) e1;
            ITrace trace2 = (ITrace) e2;
            int returnCode = 0;
            if (trace1.isMandatory() == true && trace2.isMandatory() == true) {
                returnCode = trace1.getTraceTitle().compareTo(trace2.getTraceTitle());
            } else if (trace1.isMandatory() == true && trace2.isMandatory() == false) {
                returnCode = -1;
            } else if (trace1.isMandatory() == false && trace2.isMandatory() == true) {
                returnCode = 1;
            } else {
                returnCode = trace1.getTraceTitle().compareTo(trace2.getTraceTitle());
            }
            return returnCode;
        }

    });

    Table table = viewerTraceSelection.getTable();
    table.setLinesVisible(true);
    addActions();

    ColumnViewerToolTipSupport.enableFor(viewerTraceSelection, ToolTip.NO_RECREATE);

    TableViewerColumn column = new TableViewerColumn(viewerTraceSelection, SWT.NONE);
    column.setLabelProvider(new ColumnLabelProvider() {
        @Override
        public String getText(final Object element) {
            if (element instanceof ITrace) {
                return ((ITrace) element).getTraceTitle();
            }
            return element.toString();
        }

        @Override
        public String getToolTipText(Object element) {
            StringBuilder sb = new StringBuilder(((ITrace) element).getTraceDescription());
            if (((ITrace) element).getTraceId() == 1) {
                sb.append(Messages.getString("TraceSelectionGroup.mandatory")); //$NON-NLS-1$
            }
            return sb.toString();
        }

        @Override
        public Color getForeground(Object element) {
            if (((ITrace) element).getTraceId() == 1) {
                return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
            }
            return null;
        }

        @Override
        public Point getToolTipShift(Object object) {
            return new Point(5, 5);
        }

        @Override
        public int getToolTipTimeDisplayed(Object object) {
            return 5000;
        }
    });

    if (profilerActivator) {
        column.getColumn().setText(Messages.getString("TraceSelectionGroup.profilerActivatorTableColumn")); //$NON-NLS-1$
    } else {
        column.getColumn().setText(Messages.getString("TraceSelectionGroup.piView")); //$NON-NLS-1$
    }

    TableColumnLayout tableColumnLayout = new TableColumnLayout();
    tablePanel.setLayout(tableColumnLayout);
    tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(1));// column weight 1 to fill the whole
    // table width

    viewerTraceSelection.setAllChecked(true);
    viewerTraceSelection.addCheckStateListener(new ICheckStateListener() {

        /*
         * (non-Javadoc)
         * 
         * @see
         * org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged
         * (org.eclipse.jface.viewers.CheckStateChangedEvent)
         */
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (event.getChecked() == false && viewerTraceSelection.getGrayed(event.getElement())) {
                // mandatory view; don't allow to deselect it
                viewerTraceSelection.setChecked(event.getElement(), true);
            } else {
                ITrace plugin = (ITrace) event.getElement();
                profilerDataPlugins.setChecked(plugin, event.getChecked());
            }
        }
    });
}

From source file:com.nokia.carbide.cpp.internal.project.ui.mmpEditor.dialogs.CapabilitiesDialog.java

License:Open Source License

/**
 * Create contents of the dialog/*from   w w  w.  j a  va 2s .  co m*/
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);

    capabilitiesViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER);
    capabilitiesViewer.setContentProvider(new ArrayContentProvider());
    capabilitiesViewer.setSorter(new ViewerSorter());
    capabilitiesViewer.setLabelProvider(new LabelProvider());
    capabilitiesViewer.setInput(getCapabilities());
    Table table = capabilitiesViewer.getTable();
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    if (checkedCapabilities != null) {
        capabilitiesViewer.setCheckedElements(checkedCapabilities);
    }
    return container;
}

From source file:com.nokia.carbide.cpp.internal.sdk.ui.SDKPreferencePage.java

License:Open Source License

@Override
public Control createContents(Composite parent) {
    IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore();

    // Set up colors used in this preference page
    Shell shell = parent.getShell();//from w w  w  .  j av a2s  . c om
    black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK);
    gray = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
    red = shell.getDisplay().getSystemColor(SWT.COLOR_RED);
    white = shell.getDisplay().getSystemColor(SWT.COLOR_WHITE);

    Composite content = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    content.setLayout(gridLayout);

    // SDK table
    sdkListTableViewer = CheckboxTableViewer.newCheckList(content,
            SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    createSDKTable();

    // Buttons composite
    Composite composite1 = new Composite(content, SWT.NONE);
    gridLayout = new GridLayout();
    gridLayout.makeColumnsEqualWidth = true;
    composite1.setLayout(gridLayout);
    GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
    composite1.setLayoutData(gridData);

    // Add button
    addButton = new Button(composite1, SWT.NONE);
    addButton.setLayoutData(gridData);
    addButton.setText(Messages.getString("SDKPreferencePage.Add_Button_Label")); //$NON-NLS-1$
    addButton.setToolTipText(Messages.getString("SDKPreferencePage.Add_Button_ToolTip")); //$NON-NLS-1$
    addButtonListener(addButton);

    // Delete button
    deleteButton = new Button(composite1, SWT.NONE);
    deleteButton.setLayoutData(gridData);
    deleteButton.setText(Messages.getString("SDKPreferencePage.Delete_Button_Label")); //$NON-NLS-1$
    deleteButton.setToolTipText(Messages.getString("SDKPreferencePage.Delete_Button_ToolTip")); //$NON-NLS-1$
    addButtonListener(deleteButton);

    // Properties button
    propertiesButton = new Button(composite1, SWT.NONE);
    propertiesButton.setLayoutData(gridData);
    propertiesButton.setText(Messages.getString("SDKPreferencePage.Properties_Button_Label")); //$NON-NLS-1$
    propertiesButton.setToolTipText(Messages.getString("SDKPreferencePage.Properties_Button_ToolTip")); //$NON-NLS-1$
    addButtonListener(propertiesButton);

    // Status and Rescan composite
    Composite composite2 = new Composite(content, SWT.NONE);
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.widthHint = 350;
    gridData.heightHint = 50;
    composite2.setLayoutData(gridData);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    composite2.setLayout(gridLayout);

    // IStatus icon label
    iconLabel = new Label(composite2, SWT.NONE);
    // IStatus text label
    statusLabel = new Label(composite2, SWT.WRAP);
    gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
    gridData.verticalSpan = 2;
    statusLabel.setLayoutData(gridData);

    new Label(content, SWT.WRAP); // filler

    // Scan for installable features in SDKs button
    scanPluginsButton = new Button(content, SWT.CHECK);
    scanPluginsButton.setToolTipText(Messages.getString("SDKPreferencePage.scanPlugins_ButtonToolTip")); //$NON-NLS-1$
    scanPluginsButton.setText(Messages.getString("SDKPreferencePage.scanPlugins_Button_Label")); //$NON-NLS-1$
    scanPluginsButton.setSelection(prefsStore.getBoolean(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS));
    addButtonListener(scanPluginsButton);

    new Label(content, SWT.WRAP); // filler

    // Rescan button
    rescanButton = new Button(content, SWT.NONE);
    rescanButton.setToolTipText(Messages.getString("SDKPreferencePage.Rescan_Button_ToolTip")); //$NON-NLS-1$
    rescanButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$
    addButtonListener(rescanButton);

    // Populate SDK table
    addSDKComponentTableItems();
    selectSDKEntry(0);

    return content;
}

From source file:com.nokia.carbide.cpp.pi.address.AddrBinaryTable.java

License:Open Source License

public void createTableViewer(int drawMode) {
    if (this.parent == null)
        return;//from   ww  w  .j a v  a  2  s.  com

    // Binary table:
    //      checkbox + colored or white background
    //     percent load
    //     binary name
    //      binary path
    //      sample count

    // Check the drawMode
    switch (drawMode) {
    case Defines.BINARIES:
    case Defines.THREADS_FUNCTIONS_BINARIES:
    case Defines.THREADS_BINARIES:
    case Defines.FUNCTIONS_THREADS_BINARIES:
    case Defines.FUNCTIONS_BINARIES:
    case Defines.THREADS_BINARIES_FUNCTIONS:
    case Defines.BINARIES_THREADS:
    case Defines.BINARIES_THREADS_FUNCTIONS:
    case Defines.BINARIES_FUNCTIONS:
    case Defines.BINARIES_FUNCTIONS_THREADS:
    case Defines.FUNCTIONS_BINARIES_THREADS: {
        break;
    }
    default:
        // no binary table in this draw mode
        return;
    }

    // create the table viewer
    this.tableViewer = CheckboxTableViewer.newCheckList(this.parent,
            SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    // add the check state handler, label provider and content provider
    tableViewer.addCheckStateListener(new SharedCheckHandler());
    tableViewer.setLabelProvider(new shownBinariesLabelProvider());
    tableViewer.setContentProvider(new shownBinariesContentProvider());
    tableViewer.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();
        }
    });

    createDefaultActions();

    // make sure the table viewer has a sorter
    if (this.sorter == null)
        this.sorter = new GppTableSorter();

    this.table = tableViewer.getTable();
    this.table.setRedraw(false);

    // give the table a heading for use in copying and exported
    this.table.setData(Messages.getString("AddrBinaryTable.binaries")); //$NON-NLS-1$

    // create the columns
    TableColumn column;

    // data associated with the TableViewer will note which columns contain hex values
    // Keep this in the order in which columns have been created
    boolean[] isHex = { false, false, false, false, false };
    this.table.setData("isHex", isHex); //$NON-NLS-1$

    // select/deselect column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_SHOW);
    column.setWidth(COLUMN_WIDTH_SHOW);
    column.setData(Integer.valueOf(COLUMN_ID_SHOW));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // percent load column
    column = new TableColumn(table, SWT.RIGHT);
    column.setText(COLUMN_HEAD_PERCENT_LOAD);
    column.setWidth(COLUMN_WIDTH_PERCENT_LOAD);
    column.setData(Integer.valueOf(COLUMN_ID_PERCENT_LOAD));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // binary name column
    column = new TableColumn(table, SWT.LEFT);
    column.setText(COLUMN_HEAD_BINARY);
    column.setWidth(COLUMN_WIDTH_BINARY_NAME);
    column.setData(Integer.valueOf(COLUMN_ID_BINARY));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // path column
    column = new TableColumn(table, SWT.LEFT);
    column.setText(COLUMN_HEAD_PATH);
    column.setWidth(COLUMN_WIDTH_PATH);
    column.setData(Integer.valueOf(COLUMN_ID_PATH));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // sample count column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_SAMPLE_COUNT);
    column.setWidth(COLUMN_WIDTH_SAMPLE_COUNT);
    column.setData(Integer.valueOf(COLUMN_ID_SAMPLE_COUNT));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // listen for mouse clicks: to select a row, pop up a menu, etc.
    table.addMouseListener(new TableMouseListener());

    // listen for key sequences such as Ctrl-A and Ctrl-C
    table.addKeyListener(new TableKeyListener());

    table.addFocusListener(new AddrTableFocusListener());

    // add form data in case later we add a sash to the right
    FormData viewerData = new FormData();
    viewerData.top = new FormAttachment(0);
    viewerData.bottom = new FormAttachment(100);
    viewerData.left = new FormAttachment(0);
    viewerData.right = new FormAttachment(100);
    table.setLayoutData(viewerData);
    table.setLayout(new FormLayout());

    // make sure the table viewer has a sorter
    if (this.sorter == null)
        this.sorter = new GppTableSorter();

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

From source file:com.nokia.carbide.cpp.pi.address.AddrFunctionTable.java

License:Open Source License

public void createTableViewer(int drawMode) {
    if (this.parent == null)
        return;// ww  w .j  ava 2 s .  co  m

    // Function table:
    //      checkbox + colored or white background
    //     percent load
    //     function name
    //      function start address
    //      binary containing function
    //      path of binary containing function
    //      sample count

    // Check the drawMode, and use it to decide whether or not to show a color column
    // or the number of samples
    switch (drawMode) {
    case Defines.FUNCTIONS:
    case Defines.THREADS_BINARIES_FUNCTIONS:
    case Defines.BINARIES_FUNCTIONS:
    case Defines.THREADS_FUNCTIONS:
    case Defines.BINARIES_THREADS_FUNCTIONS:
    case Defines.THREADS_FUNCTIONS_BINARIES:
    case Defines.BINARIES_FUNCTIONS_THREADS:
    case Defines.FUNCTIONS_THREADS:
    case Defines.FUNCTIONS_THREADS_BINARIES:
    case Defines.FUNCTIONS_BINARIES:
    case Defines.FUNCTIONS_BINARIES_THREADS: {
        break;
    }
    default:
        // no function table in this draw mode
        return;
    }

    // create the table viewer
    this.tableViewer = CheckboxTableViewer.newCheckList(this.parent,
            SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    // add the check state handler, label provider and content provider
    tableViewer.addCheckStateListener(new SharedCheckHandler());
    tableViewer.setLabelProvider(new shownFunctionsLabelProvider());
    tableViewer.setContentProvider(new shownFunctionsContentProvider());
    tableViewer.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();
        }
    });

    createDefaultActions();

    // make sure the table viewer has a sorter
    if (this.sorter == null)
        this.sorter = new GppTableSorter();

    this.table = tableViewer.getTable();
    this.table.setRedraw(false);

    // give the table a heading for use in copying and exported
    this.table.setData(Messages.getString("AddrFunctionTable.functions")); //$NON-NLS-1$

    // create the columns
    TableColumn column;

    // data associated with the TableViewer will note which columns contain hex values
    // Keep this in the order in which columns have been created
    boolean[] isHex = { false, false, false, true, false, false, false };
    this.table.setData("isHex", isHex); //$NON-NLS-1$

    // select/deselect column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_SHOW);
    column.setWidth(COLUMN_WIDTH_SHOW);
    column.setData(Integer.valueOf(COLUMN_ID_SHOW));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // percent load column
    column = new TableColumn(table, SWT.RIGHT);
    column.setText(COLUMN_HEAD_PERCENT_LOAD);
    column.setWidth(COLUMN_WIDTH_PERCENT_LOAD);
    column.setData(Integer.valueOf(COLUMN_ID_PERCENT_LOAD));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // function name column
    column = new TableColumn(table, SWT.LEFT);
    column.setText(COLUMN_HEAD_FUNCTION);
    column.setWidth(COLUMN_WIDTH_FUNCTION_NAME);
    column.setData(Integer.valueOf(COLUMN_ID_FUNCTION));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // function start address column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_START_ADDR);
    column.setWidth(COLUMN_WIDTH_START_ADDRESS);
    column.setData(Integer.valueOf(COLUMN_ID_START_ADDR));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // binary containing function column
    column = new TableColumn(table, SWT.LEFT);
    column.setText(COLUMN_HEAD_IN_BINARY);
    column.setWidth(COLUMN_WIDTH_IN_BINARY);
    column.setData(Integer.valueOf(COLUMN_ID_IN_BINARY));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // path to binary containing function column
    column = new TableColumn(table, SWT.LEFT);
    column.setText(COLUMN_HEAD_IN_BINARY_PATH);
    column.setWidth(COLUMN_WIDTH_IN_BINARY_PATH);
    column.setData(Integer.valueOf(COLUMN_ID_IN_BINARY_PATH));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // sample count column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_SAMPLE_COUNT);
    column.setWidth(COLUMN_WIDTH_SAMPLE_COUNT);
    column.setData(Integer.valueOf(COLUMN_ID_SAMPLE_COUNT));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // listen for mouse clicks: to select a row, pop up a menu, etc.
    table.addMouseListener(new TableMouseListener());

    // listen for key sequences such as Ctrl-A and Ctrl-C
    table.addKeyListener(new TableKeyListener());

    table.addFocusListener(new AddrTableFocusListener());

    // add form data in case later we add a sash to the right
    FormData viewerData = new FormData();
    viewerData.top = new FormAttachment(0);
    viewerData.bottom = new FormAttachment(100);
    viewerData.left = new FormAttachment(0);
    viewerData.right = new FormAttachment(100);
    table.setLayoutData(viewerData);
    table.setLayout(new FormLayout());

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

From source file:com.nokia.carbide.cpp.pi.address.AddrThreadTable.java

License:Open Source License

public void createTableViewer(int drawMode) {
    if (this.parent == null)
        return;/*w  w  w  . ja  va2 s . c om*/

    // Thread table:
    //      checkbox + colored or white background
    //     percent load
    //     thread name
    //      sample count
    //      priority (optional)

    // Check the drawMode, and use it to decide whether or not to show a color column
    // or the number of samples
    switch (drawMode) {
    case Defines.THREADS:
    case Defines.BINARIES_THREADS:
    case Defines.BINARIES_FUNCTIONS_THREADS:
    case Defines.FUNCTIONS_THREADS:
    case Defines.FUNCTIONS_BINARIES_THREADS:
    case Defines.THREADS_FUNCTIONS:
    case Defines.THREADS_FUNCTIONS_BINARIES:
    case Defines.THREADS_BINARIES:
    case Defines.THREADS_BINARIES_FUNCTIONS:
    case Defines.BINARIES_THREADS_FUNCTIONS:
    case Defines.FUNCTIONS_THREADS_BINARIES: {
        break;
    }
    default:
        // no thread table in this draw mode
        return;
    }

    // create the table viewer
    this.tableViewer = CheckboxTableViewer.newCheckList(this.parent,
            SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

    // add the check state handler, label provider and content provider
    tableViewer.addCheckStateListener(new SharedCheckHandler());
    tableViewer.setLabelProvider(new ShownThreadsLabelProvider());
    tableViewer.setContentProvider(new ShownThreadsContentProvider());
    tableViewer.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();
        }
    });

    createDefaultActions();

    // make sure the table viewer has a sorter
    if (this.sorter == null)
        this.sorter = new GppTableSorter();

    this.table = tableViewer.getTable();
    this.table.setRedraw(false);

    // give the table a heading for use in copying and exported
    this.table.setData(Messages.getString("AddrThreadTable.threads")); //$NON-NLS-1$

    // create the columns
    TableColumn column;

    // data associated with the TableViewer will note which columns contain hex values
    // Keep this in the order in which columns have been created
    // Includes the priority column
    boolean[] isHex = { false, false, false, false, false };
    this.table.setData("isHex", isHex); //$NON-NLS-1$

    // select/deselect column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_SHOW);
    column.setWidth(COLUMN_WIDTH_SHOW);
    column.setData(Integer.valueOf(COLUMN_ID_SHOW));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // percent load column
    column = new TableColumn(table, SWT.RIGHT);
    column.setText(COLUMN_HEAD_PERCENT_LOAD);
    column.setWidth(COLUMN_WIDTH_PERCENT_LOAD);
    column.setData(Integer.valueOf(COLUMN_ID_PERCENT_LOAD));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // thread name column
    column = new TableColumn(table, SWT.LEFT);
    column.setText(COLUMN_HEAD_THREAD);
    column.setWidth(COLUMN_WIDTH_THREAD_NAME);
    column.setData(Integer.valueOf(COLUMN_ID_THREAD));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // sample count column
    column = new TableColumn(table, SWT.CENTER);
    column.setText(COLUMN_HEAD_SAMPLE_COUNT);
    column.setWidth(COLUMN_WIDTH_SAMPLE_COUNT);
    column.setData(Integer.valueOf(COLUMN_ID_SAMPLE_COUNT));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // priority column
    if (priorityAdded)
        this.addPriorityColumn();

    // listen for mouse clicks: to select a row, pop up a menu, etc.
    table.addMouseListener(new TableMouseListener());

    // listen for key sequences such as Ctrl-A and Ctrl-C
    table.addKeyListener(new TableKeyListener());

    table.addFocusListener(new AddrTableFocusListener());

    // add form data in case later we add a sash to the right
    FormData viewerData = new FormData();
    viewerData.top = new FormAttachment(0);
    viewerData.bottom = new FormAttachment(100);
    viewerData.left = new FormAttachment(0);
    viewerData.right = new FormAttachment(100);
    table.setLayoutData(viewerData);
    table.setLayout(new FormLayout());

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

From source file:com.nokia.carbide.cpp.pi.graphicsmemory.GraphicsMemoryProcessTable.java

License:Open Source License

public GraphicsMemoryProcessTable(GraphicsMemoryTraceGraph myGraph, Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;/*from  w  ww.  j  av a 2s  .  c om*/
    gl.marginWidth = 0;
    gl.marginLeft = 0;
    gl.marginRight = 0;
    composite.setLayout(gl);
    this.myGraph = myGraph;
    this.parent = composite;

    Label label = new Label(composite, SWT.CENTER);
    label.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    label.setFont(PIPageEditor.helvetica_8);
    label.setText(Messages.getString("GraphicsMemoryProcessTable.title")); //$NON-NLS-1$

    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    this.tableViewer = CheckboxTableViewer.newCheckList(composite,
            SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    this.table = this.tableViewer.getTable();
    this.table.setLayoutData(new GridData(GridData.FILL_BOTH));

    // add the check state handler, label provider and content provider
    this.tableViewer.addCheckStateListener(new CheckHandler());
    this.tableViewer.setLabelProvider(new SharedLabelProvider(this.table));
    this.tableViewer.setContentProvider(new MemoryTableContentProvider());
    this.tableViewer.setSorter(new SharedSorter());

    // give the table a heading for possible use in copying and exported
    this.table.setData(Messages.getString("GraphicsMemoryProcessTable.memory")); //$NON-NLS-1$

    // create the columns
    TableColumn column;

    // data associated with the TableViewer will note which columns contain
    // hex values
    // Keep this in the order in which columns have been created
    boolean[] isHex = { false, false, false, false };
    this.table.setData("isHex", isHex); //$NON-NLS-1$

    // select/deselect column
    column = new TableColumn(this.table, SWT.CENTER);
    column.setText(COLUMN_HEAD_GRAPHICS_MEMORY_NAME);
    column.setWidth(COLUMN_WIDTH_GRAPHICS_MEMORY_NAME);
    column.setData(Integer.valueOf(COLUMN_ID_GRAPHICS_MEMORY_NAME));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    column = new TableColumn(tableViewer.getTable(), SWT.RIGHT);
    column.setText(COLUMN_HEAD_GRAPHICS_MEMORY_PRIVATE);
    column.setWidth(COLUMN_WIDTH_GRAPHICS_MEMORY_PRIVATE);
    column.setData(Integer.valueOf(COLUMN_ID_GRAPHICS_MEMORY_PRIVATE));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    column = new TableColumn(tableViewer.getTable(), SWT.RIGHT);
    column.setText(COLUMN_HEAD_GRAPHICS_MEMORY_SHARED);
    column.setWidth(COLUMN_WIDTH_GRAPHICS_MEMORY_SHARED);
    column.setData(Integer.valueOf(COLUMN_ID_GRAPHICS_MEMORY_SHARED));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    column = new TableColumn(tableViewer.getTable(), SWT.RIGHT);
    column.setText(COLUMN_HEAD_MEMORY_TOTAL);
    column.setWidth(COLUMN_WIDTH_MEMORY_TOTAL);
    column.setData(Integer.valueOf(COLUMN_ID_GRAPHICS_MEMORY_TOTAL));
    column.setMoveable(true);
    column.setResizable(true);
    column.addSelectionListener(new ColumnSelectionHandler());

    // initially, all rows are checked
    this.tableViewer.setAllChecked(true);

    this.table.addMouseListener(new TableMouseListener());
    this.table.setHeaderVisible(true);
    this.table.setLinesVisible(true);
    this.table.setRedraw(true);

    updateItemData(true);
    ((SharedSorter) tableViewer.getSorter()).doSort(COLUMN_ID_GRAPHICS_MEMORY_NAME);

    // initially, all rows are checked
    this.tableViewer.setAllChecked(true);

    createDefaultActions();

    // listen for key sequences such as Ctrl-A and Ctrl-C
    table.addKeyListener(new TableKeyListener());

    table.addFocusListener(new FocusListener() {
        IAction oldSelectAllAction = null;
        IAction oldCopyAction = null;

        public void focusGained(org.eclipse.swt.events.FocusEvent arg0) {
            IActionBars bars = PIPageEditor.getActionBars();

            oldSelectAllAction = PIPageEditor.getActionBars()
                    .getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
            oldCopyAction = PIPageEditor.getActionBars().getGlobalActionHandler(ActionFactory.COPY.getId());

            bars.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction);
            bars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllAction);

            copyAction.setEnabled(table.getSelectionCount() > 0);
            selectAllAction.setEnabled(table.getItemCount() > 0);
            bars.updateActionBars();

            // add to the Edit menu
            IMenuManager editMenuManager = bars.getMenuManager().findMenuUsingPath(IIDEActionConstants.M_EDIT);

            if (editMenuManager instanceof SubMenuManager) {
                IContributionManager editManager = ((SubMenuManager) editMenuManager).getParent();
                ActionContributionItem item;

                editMenuManager.remove("PICopyTable"); //$NON-NLS-1$
                copyTableAction.setEnabled(table.getItemCount() > 0);
                item = new ActionContributionItem(copyTableAction);
                item.setVisible(true);
                editManager.prependToGroup(IIDEActionConstants.CUT_EXT, item);
            }

            // add to the File menu
            IMenuManager fileMenuManager = bars.getMenuManager().findMenuUsingPath(IIDEActionConstants.M_FILE);

            if (fileMenuManager instanceof SubMenuManager) {
                IContributionManager fileManager = ((SubMenuManager) fileMenuManager).getParent();
                ActionContributionItem item;

                fileMenuManager.remove("PISaveTable"); //$NON-NLS-1$
                saveTableAction.setEnabled(table.getItemCount() > 0);
                item = new ActionContributionItem(saveTableAction);
                item.setVisible(true);
                fileManager.insertAfter("saveAll", item); //$NON-NLS-1$
            }
        }

        public void focusLost(org.eclipse.swt.events.FocusEvent arg0) {
            IActionBars bars = PIPageEditor.getActionBars();
            bars.setGlobalActionHandler(ActionFactory.COPY.getId(), oldCopyAction);
            bars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), oldSelectAllAction);
            bars.updateActionBars();

            SubMenuManager editMenuManager = (SubMenuManager) PIPageEditor.getMenuManager()
                    .find(IIDEActionConstants.M_EDIT);
            editMenuManager.remove("PICopyTable"); //$NON-NLS-1$
            editMenuManager.update();

            SubMenuManager fileMenuManager = (SubMenuManager) PIPageEditor.getMenuManager()
                    .find(IIDEActionConstants.M_FILE);
            fileMenuManager.remove("PISaveTable"); //$NON-NLS-1$
            fileMenuManager.update();
        }
    });

    tableViewer.refresh();
    table.redraw();
}