Search in sources :

Example 1 with EnhancedTableViewer

use of net.sf.eclipsecs.ui.util.table.EnhancedTableViewer in project eclipse-cs by checkstyle.

the class MarkerStatsView method createDetailView.

/**
 * Creates the table viewer for the detail view.
 *
 * @param parent
 *          the parent composite
 * @return the detail table viewer
 */
private EnhancedTableViewer createDetailView(Composite parent) {
    // le tableau
    EnhancedTableViewer detailViewer = new EnhancedTableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    detailViewer.getControl().setLayoutData(gridData);
    // setup the table columns
    Table table = detailViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    TableColumn severityCol = new TableColumn(table, SWT.CENTER, 0);
    severityCol.setWidth(20);
    severityCol.setResizable(false);
    TableColumn idCol = new TableColumn(table, SWT.LEFT, 1);
    idCol.setText(Messages.MarkerStatsView_fileColumn);
    idCol.setWidth(150);
    TableColumn folderCol = new TableColumn(table, SWT.LEFT, 2);
    folderCol.setText(Messages.MarkerStatsView_folderColumn);
    folderCol.setWidth(300);
    TableColumn countCol = new TableColumn(table, SWT.CENTER, 3);
    countCol.setText(Messages.MarkerStatsView_lineColumn);
    countCol.pack();
    TableColumn messageCol = new TableColumn(table, SWT.LEFT, 4);
    messageCol.setText(Messages.MarkerStatsView_messageColumn);
    messageCol.setWidth(300);
    // set the providers
    detailViewer.setContentProvider(new DetailContentProvider());
    DetailViewMultiProvider multiProvider = new DetailViewMultiProvider();
    detailViewer.setLabelProvider(multiProvider);
    detailViewer.setTableComparableProvider(multiProvider);
    detailViewer.setTableSettingsProvider(multiProvider);
    detailViewer.installEnhancements();
    // add selection listener to maintain action state
    detailViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateActions();
        }
    });
    // hooks the action to double click
    hookDoubleClickAction(mShowErrorAction, detailViewer);
    // and to the context menu too
    ArrayList<Object> actionList = new ArrayList<>(1);
    actionList.add(mDrillBackAction);
    actionList.add(mShowErrorAction);
    actionList.add(new Separator());
    actionList.add(mChartAction);
    hookContextMenu(actionList, detailViewer);
    return detailViewer;
}
Also used : Table(org.eclipse.swt.widgets.Table) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) EnhancedTableViewer(net.sf.eclipsecs.ui.util.table.EnhancedTableViewer) ArrayList(java.util.ArrayList) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) Separator(org.eclipse.jface.action.Separator)

Example 2 with EnhancedTableViewer

use of net.sf.eclipsecs.ui.util.table.EnhancedTableViewer in project eclipse-cs by checkstyle.

the class MarkerStatsView method createMasterView.

/**
 * Creates the table viewer for the master view.
 *
 * @param parent
 *          the parent composite
 * @return the master table viewer
 */
private EnhancedTableViewer createMasterView(Composite parent) {
    EnhancedTableViewer masterViewer = new EnhancedTableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    masterViewer.getControl().setLayoutData(gridData);
    // setup the table columns
    Table table = masterViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    TableColumn severityCol = new TableColumn(table, SWT.CENTER, 0);
    severityCol.setWidth(20);
    severityCol.setResizable(false);
    TableColumn idCol = new TableColumn(table, SWT.LEFT, 1);
    idCol.setText(Messages.MarkerStatsView_kindOfErrorColumn);
    idCol.setWidth(400);
    TableColumn countCol = new TableColumn(table, SWT.CENTER, 2);
    countCol.setText(Messages.MarkerStatsView_numberOfErrorsColumn);
    countCol.pack();
    // set the providers
    masterViewer.setContentProvider(new MasterContentProvider());
    MasterViewMultiProvider multiProvider = new MasterViewMultiProvider();
    masterViewer.setLabelProvider(multiProvider);
    masterViewer.setTableComparableProvider(multiProvider);
    masterViewer.setTableSettingsProvider(multiProvider);
    masterViewer.installEnhancements();
    // add selection listener to maintain action state
    masterViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateActions();
        }
    });
    // hooks the action to double click
    hookDoubleClickAction(mDrillDownAction, masterViewer);
    // and to the context menu too
    ArrayList<Object> actionList = new ArrayList<>(3);
    actionList.add(mDrillDownAction);
    actionList.add(new Separator());
    actionList.add(mChartAction);
    hookContextMenu(actionList, masterViewer);
    return masterViewer;
}
Also used : Table(org.eclipse.swt.widgets.Table) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) EnhancedTableViewer(net.sf.eclipsecs.ui.util.table.EnhancedTableViewer) ArrayList(java.util.ArrayList) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) Separator(org.eclipse.jface.action.Separator)

Example 3 with EnhancedTableViewer

use of net.sf.eclipsecs.ui.util.table.EnhancedTableViewer in project eclipse-cs by checkstyle.

the class CheckConfigurationWorkingSetEditor method createConfigTable.

/**
 * Creates the table viewer to show the existing check configurations.
 *
 * @param parent
 *          the parent composite
 * @return the table control
 */
private Control createConfigTable(Composite parent) {
    Table table = new Table(parent, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    TableColumn column1 = new TableColumn(table, SWT.NULL);
    column1.setText(Messages.CheckstylePreferencePage_colCheckConfig);
    tableLayout.addColumnData(new ColumnWeightData(40));
    TableColumn column2 = new TableColumn(table, SWT.NULL);
    column2.setText(Messages.CheckstylePreferencePage_colLocation);
    tableLayout.addColumnData(new ColumnWeightData(30));
    TableColumn column3 = new TableColumn(table, SWT.NULL);
    column3.setText(Messages.CheckstylePreferencePage_colType);
    tableLayout.addColumnData(new ColumnWeightData(30));
    if (mWorkingSet instanceof GlobalCheckConfigurationWorkingSet) {
        TableColumn column4 = new TableColumn(table, SWT.NULL);
        column4.setText(Messages.CheckstylePreferencePage_colDefault);
        tableLayout.addColumnData(new ColumnWeightData(12));
    }
    mViewer = new EnhancedTableViewer(table);
    ConfigurationLabelProvider multiProvider = new ConfigurationLabelProvider();
    mViewer.setLabelProvider(multiProvider);
    mViewer.setTableComparableProvider(multiProvider);
    mViewer.setTableSettingsProvider(multiProvider);
    mViewer.installEnhancements();
    mViewer.setContentProvider(new ArrayContentProvider());
    mViewer.setInput(mWorkingSet.getWorkingCopies());
    mViewer.addDoubleClickListener(mController);
    mViewer.addSelectionChangedListener(mController);
    return table;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) GlobalCheckConfigurationWorkingSet(net.sf.eclipsecs.core.config.GlobalCheckConfigurationWorkingSet) Table(org.eclipse.swt.widgets.Table) EnhancedTableViewer(net.sf.eclipsecs.ui.util.table.EnhancedTableViewer) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 4 with EnhancedTableViewer

use of net.sf.eclipsecs.ui.util.table.EnhancedTableViewer in project eclipse-cs by checkstyle.

the class ResolvablePropertiesDialog method createDialogArea.

/**
 * Creates the dialogs main contents.
 *
 * @param parent
 *          the parent composite
 */
@Override
protected Control createDialogArea(Composite parent) {
    // set the logo
    this.setTitleImage(CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.PLUGIN_LOGO));
    this.setTitle(Messages.ResolvablePropertiesDialog_titleMessageArea);
    this.setMessage(Messages.ResolvablePropertiesDialog_msgAdditionalProperties);
    Composite composite = (Composite) super.createDialogArea(parent);
    Composite contents = new Composite(composite, SWT.NULL);
    contents.setLayout(new GridLayout(2, false));
    GridData fd = new GridData(GridData.FILL_BOTH);
    contents.setLayoutData(fd);
    Table table = new Table(contents, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout tableLayout = new TableLayout();
    table.setLayout(tableLayout);
    TableColumn column1 = new TableColumn(table, SWT.NULL);
    column1.setText(Messages.ResolvablePropertiesDialog_colName);
    tableLayout.addColumnData(new ColumnWeightData(50));
    TableColumn column2 = new TableColumn(table, SWT.NULL);
    column2.setText(Messages.ResolvablePropertiesDialog_colValue);
    tableLayout.addColumnData(new ColumnWeightData(50));
    mTableViewer = new EnhancedTableViewer(table);
    PropertiesLabelProvider multiProvider = new PropertiesLabelProvider();
    mTableViewer.setLabelProvider(multiProvider);
    mTableViewer.setTableComparableProvider(multiProvider);
    mTableViewer.setTableSettingsProvider(multiProvider);
    mTableViewer.installEnhancements();
    mTableViewer.setContentProvider(new ArrayContentProvider());
    mTableViewer.addDoubleClickListener(mController);
    mTableViewer.getTable().addKeyListener(mController);
    Composite buttonBar = new Composite(contents, SWT.NULL);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonBar.setLayout(layout);
    GridData gd = new GridData();
    gd.verticalAlignment = GridData.BEGINNING;
    buttonBar.setLayoutData(gd);
    mBtnAdd = new Button(buttonBar, SWT.PUSH);
    mBtnAdd.setText(Messages.ResolvablePropertiesDialog_btnAdd);
    mBtnAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mBtnAdd.addSelectionListener(mController);
    mBtnEdit = new Button(buttonBar, SWT.PUSH);
    mBtnEdit.setText(Messages.ResolvablePropertiesDialog_btnEdit);
    mBtnEdit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mBtnEdit.addSelectionListener(mController);
    mBtnRemove = new Button(buttonBar, SWT.PUSH);
    mBtnRemove.setText(Messages.ResolvablePropertiesDialog_btnRemove);
    mBtnRemove.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mBtnRemove.addSelectionListener(mController);
    return composite;
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) EnhancedTableViewer(net.sf.eclipsecs.ui.util.table.EnhancedTableViewer) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableLayout(org.eclipse.jface.viewers.TableLayout) TableColumn(org.eclipse.swt.widgets.TableColumn)

Example 5 with EnhancedTableViewer

use of net.sf.eclipsecs.ui.util.table.EnhancedTableViewer in project eclipse-cs by checkstyle.

the class GraphStatsView method createDetailView.

/**
 * Creates the table viewer for the detail view.
 *
 * @param parent
 *          the parent composite
 * @return the detail table viewer
 */
private EnhancedTableViewer createDetailView(Composite parent) {
    // le tableau
    EnhancedTableViewer detailViewer = new EnhancedTableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    detailViewer.getControl().setLayoutData(gridData);
    // setup the table columns
    Table table = detailViewer.getTable();
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    TableColumn severityCol = new TableColumn(table, SWT.CENTER, 0);
    severityCol.setWidth(20);
    severityCol.setResizable(false);
    TableColumn idCol = new TableColumn(table, SWT.LEFT, 1);
    idCol.setText(Messages.MarkerStatsView_fileColumn);
    idCol.setWidth(150);
    TableColumn folderCol = new TableColumn(table, SWT.LEFT, 2);
    folderCol.setText(Messages.MarkerStatsView_folderColumn);
    folderCol.setWidth(300);
    TableColumn countCol = new TableColumn(table, SWT.CENTER, 3);
    countCol.setText(Messages.MarkerStatsView_lineColumn);
    countCol.pack();
    TableColumn messageCol = new TableColumn(table, SWT.LEFT, 4);
    messageCol.setText(Messages.MarkerStatsView_messageColumn);
    messageCol.setWidth(300);
    // set the providers
    detailViewer.setContentProvider(new DetailContentProvider());
    DetailViewMultiProvider multiProvider = new DetailViewMultiProvider();
    detailViewer.setLabelProvider(multiProvider);
    detailViewer.setTableComparableProvider(multiProvider);
    detailViewer.setTableSettingsProvider(multiProvider);
    detailViewer.installEnhancements();
    // add selection listener to maintain action state
    detailViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateActions();
        }
    });
    // hooks the action to double click
    hookDoubleClickAction(mShowErrorAction, detailViewer);
    // and to the context menu too
    ArrayList<Object> actionList = new ArrayList<>(3);
    actionList.add(mDrillBackAction);
    actionList.add(mShowErrorAction);
    actionList.add(new Separator());
    hookContextMenu(actionList, detailViewer);
    return detailViewer;
}
Also used : Table(org.eclipse.swt.widgets.Table) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) EnhancedTableViewer(net.sf.eclipsecs.ui.util.table.EnhancedTableViewer) ArrayList(java.util.ArrayList) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) GridData(org.eclipse.swt.layout.GridData) Separator(org.eclipse.jface.action.Separator)

Aggregations

EnhancedTableViewer (net.sf.eclipsecs.ui.util.table.EnhancedTableViewer)5 Table (org.eclipse.swt.widgets.Table)5 TableColumn (org.eclipse.swt.widgets.TableColumn)5 GridData (org.eclipse.swt.layout.GridData)4 ArrayList (java.util.ArrayList)3 Separator (org.eclipse.jface.action.Separator)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)2 TableLayout (org.eclipse.jface.viewers.TableLayout)2 GlobalCheckConfigurationWorkingSet (net.sf.eclipsecs.core.config.GlobalCheckConfigurationWorkingSet)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1