Search in sources :

Example 1 with NodeCellModifier

use of org.erlide.tracing.core.mvc.controller.NodeCellModifier in project erlide_eclipse by erlang.

the class ControlPanelView method createNodesTable.

private void createNodesTable(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;
    nodesTableViewer = new TableViewer(parent, style);
    nodesTableViewer.setUseHashlookup(true);
    // table
    final Table table = nodesTableViewer.getTable();
    table.setLayoutData(gridData);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    // columns
    final String[] columnProperties = new String[TracePatternColumn.values().length];
    for (final NodeColumn column : NodeColumn.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();
    }
    nodesTableViewer.setColumnProperties(columnProperties);
    // providers
    nodesTableViewer.setLabelProvider(new NodeLabelProvider());
    nodesTableViewer.setContentProvider(new NodeContentProvider());
    // input
    nodesTableViewer.setInput(TraceBackend.getInstance());
    // editors
    final CellEditor[] editors = new CellEditor[TracePatternColumn.values().length];
    editors[NodeColumn.ENABLED.ordinal()] = new CheckboxCellEditor(table);
    editors[NodeColumn.NODE_NAME.ordinal()] = new TextCellEditor(table);
    editors[NodeColumn.COOKIE.ordinal()] = new TextCellEditor(table);
    nodesTableViewer.setCellEditors(editors);
    nodesTableViewer.setCellModifier(new NodeCellModifier(nodesTableViewer));
}
Also used : Table(org.eclipse.swt.widgets.Table) NodeColumn(org.erlide.tracing.core.mvc.view.NodeColumn) 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) NodeLabelProvider(org.erlide.tracing.core.mvc.view.NodeLabelProvider) TableColumn(org.eclipse.swt.widgets.TableColumn) NodeContentProvider(org.erlide.tracing.core.mvc.view.NodeContentProvider) GridData(org.eclipse.swt.layout.GridData) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer) NodeCellModifier(org.erlide.tracing.core.mvc.controller.NodeCellModifier)

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 NodeCellModifier (org.erlide.tracing.core.mvc.controller.NodeCellModifier)1 MatchSpecCellEditor (org.erlide.tracing.core.mvc.view.MatchSpecCellEditor)1 NodeColumn (org.erlide.tracing.core.mvc.view.NodeColumn)1 NodeContentProvider (org.erlide.tracing.core.mvc.view.NodeContentProvider)1 NodeLabelProvider (org.erlide.tracing.core.mvc.view.NodeLabelProvider)1