use of org.erlide.tracing.core.ProcessFlag in project erlide_eclipse by erlang.
the class ControlPanelView method createProcessesTable.
private Composite createProcessesTable(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout());
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
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;
processesTableViewer = new TableViewer(container, style);
processesTableViewer.setUseHashlookup(true);
// table
final Table table = processesTableViewer.getTable();
table.setLayoutData(gridData);
table.setHeaderVisible(true);
table.setLinesVisible(true);
// columns
final String[] columnProperties = new String[ProcessColumn.values().length + ProcessFlag.values().length];
// columns: process properties
for (final ProcessColumn column : ProcessColumn.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();
}
// columns: process flags
for (final ProcessFlag flag : ProcessFlag.values()) {
final TableColumn tableColumn = new TableColumn(table, SWT.CENTER, ProcessColumn.values().length + flag.ordinal());
tableColumn.setResizable(true);
tableColumn.setMoveable(false);
tableColumn.setWidth(60);
tableColumn.setText(flag.getName());
columnProperties[ProcessColumn.values().length + flag.ordinal()] = flag.name();
}
processesTableViewer.setColumnProperties(columnProperties);
// providers
processesTableViewer.setLabelProvider(new ProcessLabelProvider());
processesTableViewer.setContentProvider(new ProcessContentProvider());
// input
fillProcessesList(processesTableViewer);
processesTableViewer.setInput(TraceBackend.getInstance().getProcesses());
// editors
final CellEditor[] editors = new CellEditor[ProcessFlag.values().length + ProcessFlag.values().length];
editors[ProcessColumn.SELECTED.ordinal()] = new CheckboxCellEditor(table);
for (final ProcessFlag flag : ProcessFlag.values()) {
editors[ProcessColumn.values().length + flag.ordinal()] = new CheckboxCellEditor(table);
}
processesTableViewer.setCellEditors(editors);
processesTableViewer.setCellModifier(new ProcessCellModifier(processesTableViewer));
return container;
}
use of org.erlide.tracing.core.ProcessFlag in project erlide_eclipse by erlang.
the class ProcessLabelProvider method getColumnImage.
@Override
public Image getColumnImage(final Object element, final int columnIndex) {
final TracedProcess process = (TracedProcess) element;
if (ProcessColumn.SELECTED.ordinal() == columnIndex) {
// process columns
if (process.isSelected()) {
return Activator.getDefault().getImageRegistry().get(Images.CHECKED.toString());
}
return Activator.getDefault().getImageRegistry().get(Images.UNCHECKED.toString());
}
// flag columns
final ProcessFlag flag = ProcessFlag.getByIndex(columnIndex - ProcessColumn.values().length);
if (flag != null) {
if (process.hasFlag(flag)) {
return Activator.getDefault().getImageRegistry().get(Images.CHECKED.toString());
}
return Activator.getDefault().getImageRegistry().get(Images.UNCHECKED.toString());
}
return null;
}
use of org.erlide.tracing.core.ProcessFlag in project erlide_eclipse by erlang.
the class ControlPanelView method createProcessCheckBoxes.
private Composite createProcessCheckBoxes(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new RowLayout());
TraceBackend.getInstance().removeAllProcessFlag();
for (final ProcessFlag flag : ProcessFlag.values()) {
final Button button = new Button(container, SWT.CHECK);
button.setText(flag.getName());
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (button.getSelection()) {
TraceBackend.getInstance().addProcessFlag(flag);
} else {
TraceBackend.getInstance().removeProcessFlag(flag);
}
}
});
}
return container;
}
use of org.erlide.tracing.core.ProcessFlag in project erlide_eclipse by erlang.
the class ProcessCellModifier method modify.
@Override
public void modify(final Object element, final String property, final Object value) {
final TracedProcess process = (TracedProcess) ((TableItem) element).getData();
// processes column
try {
if (ProcessColumn.SELECTED.equals(ProcessColumn.valueOf(property))) {
process.setSelected((Boolean) value);
tableViewer.update(process, null);
}
return;
} catch (final Exception e) {
}
// flag column
final ProcessFlag flag = ProcessFlag.valueOf(property);
if ((Boolean) value) {
process.setFlag(flag);
} else {
process.unSetFlag(flag);
}
tableViewer.update(process, null);
}
Aggregations