Search in sources :

Example 1 with CCombo

use of org.eclipse.swt.custom.CCombo in project dbeaver by serge-rider.

the class CComboContentAdapter method setControlContents.

@Override
public void setControlContents(Control control, String text, int cursorPosition) {
    ((CCombo) control).setText(text);
    ((CCombo) control).setSelection(new Point(cursorPosition, cursorPosition));
}
Also used : CCombo(org.eclipse.swt.custom.CCombo) Point(org.eclipse.swt.graphics.Point)

Example 2 with CCombo

use of org.eclipse.swt.custom.CCombo in project dbeaver by serge-rider.

the class CustomComboBoxCellEditor method createControl.

@Override
protected Control createControl(Composite parent) {
    CCombo comboBox = (CCombo) super.createControl(parent);
    //comboBox.setEditable((getStyle() & SWT.READ_ONLY) == 0);
    comboBox.setVisibleItemCount(15);
    comboBox.setFont(parent.getFont());
    comboBox.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    if ((getStyle() & SWT.READ_ONLY) == 0) {
        // Install proposal provider for editable combos
        proposalProvider = new SimpleContentProposalProvider(comboBox.getItems());
        proposalProvider.setFiltering(true);
        UIUtils.installContentProposal(comboBox, new CComboContentAdapter(), proposalProvider, true);
    }
    return comboBox;
}
Also used : SimpleContentProposalProvider(org.eclipse.jface.fieldassist.SimpleContentProposalProvider) CCombo(org.eclipse.swt.custom.CCombo)

Example 3 with CCombo

use of org.eclipse.swt.custom.CCombo in project translationstudio8 by heartsome.

the class DefaultAutoFilter method update.

/**
     * {@inheritDoc}
     */
public void update() {
    if (_combo == null) {
        _combo = new CCombo(_table, SWT.BORDER | SWT.READ_ONLY);
        _combo.addSelectionListener(this);
    }
    IColumn col = _column;
    Set<String> colFilterStrings = getColFilterStrings(col, MAX_AUTOFILTERLENGTH);
    String[] items = new String[colFilterStrings.size() + 3];
    int idx = 0;
    items[idx++] = TEXT_FILTER_ALL;
    items[idx++] = TEXT_FILTER_EMPTY;
    items[idx++] = TEXT_FILTER_NONEMPTY;
    for (String s : colFilterStrings) {
        items[idx++] = s;
    }
    _combo.setItems(items);
    _combo.select(0);
}
Also used : CCombo(org.eclipse.swt.custom.CCombo) IColumn(de.jaret.util.ui.table.model.IColumn)

Example 4 with CCombo

use of org.eclipse.swt.custom.CCombo in project translationstudio8 by heartsome.

the class JaretTablePrintDialog method createPrinterSelection.

private void createPrinterSelection(Composite parent) {
    Composite area = new Composite(parent, SWT.NULL);
    area.setLayout(new RowLayout());
    // area.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
    _printerCombo = new CCombo(area, SWT.BORDER | SWT.READ_ONLY);
    _printerCombo.setItems(_printers);
    _printerCombo.select(_pIdx);
    Button select = new Button(area, SWT.PUSH);
    select.setText("Configure");
    select.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            PrintDialog pd = new PrintDialog(Display.getCurrent().getActiveShell());
            PrinterData pdata = pd.open();
            if (pdata != null) {
                _printerData = pdata;
                select(_printerData);
            }
        }

        private void select(PrinterData printerData) {
            for (int i = 0; i < _pdatas.length; i++) {
                PrinterData pd = _pdatas[i];
                if (pd.name.equals(printerData.name)) {
                    _printerCombo.select(i);
                    break;
                }
            }
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
}
Also used : CCombo(org.eclipse.swt.custom.CCombo) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) PrintDialog(org.eclipse.swt.printing.PrintDialog) PrinterData(org.eclipse.swt.printing.PrinterData) RowLayout(org.eclipse.swt.layout.RowLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 5 with CCombo

use of org.eclipse.swt.custom.CCombo in project translationstudio8 by heartsome.

the class SampleIntegerAutoFilter method update.

public void update() {
    if (_combo == null) {
        _combo = new CCombo(_table, SWT.BORDER | SWT.READ_ONLY);
        _combo.addSelectionListener(this);
    }
    String[] items = new String[3];
    int idx = 0;
    items[idx++] = FILTER_ALL;
    items[idx++] = FILTER_LT50;
    items[idx++] = FILTER_GT50;
    _combo.setItems(items);
    _combo.select(0);
}
Also used : CCombo(org.eclipse.swt.custom.CCombo)

Aggregations

CCombo (org.eclipse.swt.custom.CCombo)83 Point (org.eclipse.swt.graphics.Point)55 IElementParameter (org.talend.core.model.process.IElementParameter)33 Control (org.eclipse.swt.widgets.Control)27 Node (org.talend.designer.core.ui.editor.nodes.Node)23 ArrayList (java.util.ArrayList)16 GC (org.eclipse.swt.graphics.GC)16 CLabel (org.eclipse.swt.custom.CLabel)15 FormAttachment (org.eclipse.swt.layout.FormAttachment)15 FormData (org.eclipse.swt.layout.FormData)15 List (java.util.List)12 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)12 FieldDecoration (org.eclipse.jface.fieldassist.FieldDecoration)12 INode (org.talend.core.model.process.INode)12 PropertyChangeCommand (org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand)12 Map (java.util.Map)10 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 HashMap (java.util.HashMap)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8