Search in sources :

Example 1 with TracePatternContentProvider

use of org.erlide.tracing.core.mvc.view.TracePatternContentProvider in project erlide_eclipse by erlang.

the class ControlPanelView method createFunctionsTable.

private void createFunctionsTable(final Composite parent) {
    final int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
    final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.grabExcessVerticalSpace = true;
    functionsTableViewer = new TableViewer(parent, style);
    functionsTableViewer.setUseHashlookup(true);
    // table
    final Table table = functionsTableViewer.getTable();
    table.setLayoutData(gridData);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    // columns
    final String[] columnProperties = new String[TracePatternColumn.values().length];
    for (final TracePatternColumn column : TracePatternColumn.values()) {
        final TableColumn tableColumn = new TableColumn(table, SWT.LEFT, column.ordinal());
        tableColumn.setResizable(true);
        tableColumn.setMoveable(false);
        tableColumn.setWidth(column.getWidth());
        tableColumn.setText(column.getName());
        columnProperties[column.ordinal()] = column.name();
    }
    functionsTableViewer.setColumnProperties(columnProperties);
    // providers
    functionsTableViewer.setLabelProvider(new TracePatternLabelProvider());
    functionsTableViewer.setContentProvider(new TracePatternContentProvider());
    // input
    functionsTableViewer.setInput(TraceBackend.getInstance());
    // editors
    final CellEditor[] editors = new CellEditor[TracePatternColumn.values().length];
    editors[TracePatternColumn.ENABLED.ordinal()] = new CheckboxCellEditor(table);
    editors[TracePatternColumn.LOCAL.ordinal()] = new CheckboxCellEditor(table);
    editors[TracePatternColumn.MODULE_NAME.ordinal()] = new TextCellEditor(table);
    editors[TracePatternColumn.FUNCTION_NAME.ordinal()] = new TextCellEditor(table);
    editors[TracePatternColumn.ARITY.ordinal()] = new TextCellEditor(table);
    editors[TracePatternColumn.MATCH_SPEC.ordinal()] = new MatchSpecCellEditor(table);
    functionsTableViewer.setCellEditors(editors);
    functionsTableViewer.setCellModifier(new TracePatternCellModifier(functionsTableViewer));
}
Also used : TracePatternColumn(org.erlide.tracing.core.mvc.view.TracePatternColumn) Table(org.eclipse.swt.widgets.Table) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) MatchSpecCellEditor(org.erlide.tracing.core.mvc.view.MatchSpecCellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableColumn(org.eclipse.swt.widgets.TableColumn) TracePatternContentProvider(org.erlide.tracing.core.mvc.view.TracePatternContentProvider) GridData(org.eclipse.swt.layout.GridData) TracePatternLabelProvider(org.erlide.tracing.core.mvc.view.TracePatternLabelProvider) MatchSpecCellEditor(org.erlide.tracing.core.mvc.view.MatchSpecCellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer) TracePatternCellModifier(org.erlide.tracing.core.mvc.controller.TracePatternCellModifier)

Aggregations

CellEditor (org.eclipse.jface.viewers.CellEditor)1 CheckboxCellEditor (org.eclipse.jface.viewers.CheckboxCellEditor)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)1 GridData (org.eclipse.swt.layout.GridData)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 TracePatternCellModifier (org.erlide.tracing.core.mvc.controller.TracePatternCellModifier)1 MatchSpecCellEditor (org.erlide.tracing.core.mvc.view.MatchSpecCellEditor)1 TracePatternColumn (org.erlide.tracing.core.mvc.view.TracePatternColumn)1 TracePatternContentProvider (org.erlide.tracing.core.mvc.view.TracePatternContentProvider)1 TracePatternLabelProvider (org.erlide.tracing.core.mvc.view.TracePatternLabelProvider)1