Search in sources :

Example 1 with ColorCombo

use of org.talend.designer.scd.ui.ColorCombo in project tdi-studio-se by Talend.

the class TableEditorManager method setComboColor.

public void setComboColor(TableItem item, int column, Color color) {
    ColorCombo combo = (ColorCombo) getEditor(item, column).getEditor();
    combo.setTextBackground(color);
}
Also used : ColorCombo(org.talend.designer.scd.ui.ColorCombo)

Example 2 with ColorCombo

use of org.talend.designer.scd.ui.ColorCombo in project tdi-studio-se by Talend.

the class TableEditorManager method createComboEditor.

public TableEditor createComboEditor(Table table, String[] displayText, TableItem item, int column, int selectIndex, final IPropertySetter<Integer> accessor) {
    TableEditor editor = new TableEditor(table);
    final ColorCombo combo = new ColorCombo(table, SWT.READ_ONLY);
    for (String text : displayText) {
        combo.add(text);
    }
    if (accessor != null) {
        combo.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                accessor.set(combo.getSelectionIndex());
            }
        });
    }
    combo.select(selectIndex);
    editor.grabHorizontal = true;
    editor.setEditor(combo, item, column);
    editor.minimumWidth = combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    table.getColumn(column).setWidth(editor.minimumWidth);
    addEditor(item, column, editor);
    return editor;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableEditor(org.eclipse.swt.custom.TableEditor) ColorCombo(org.talend.designer.scd.ui.ColorCombo)

Aggregations

ColorCombo (org.talend.designer.scd.ui.ColorCombo)2 TableEditor (org.eclipse.swt.custom.TableEditor)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1