Search in sources :

Example 1 with ComboBoxViewerCellEditor

use of org.eclipse.jface.viewers.ComboBoxViewerCellEditor in project hale by halestudio.

the class TaskStatusEditingSupport method getCellEditor.

/**
 * @see EditingSupport#getCellEditor(Object)
 */
@Override
protected CellEditor getCellEditor(Object element) {
    ComboBoxViewerCellEditor editor = new ComboBoxViewerCellEditor((Composite) getViewer().getControl(), SWT.READ_ONLY);
    editor.setContentProvider(ArrayContentProvider.getInstance());
    editor.setLabelProvider(new LabelProvider());
    // editor.setInput(new Object[] { TaskStatus.NEW, TaskStatus.ACTIVE, TaskStatus.COMPLETED,
    // TaskStatus.IGNORED });
    // TODO Make this depend on the task type
    editor.setInput(new Object[] { TaskStatus.NEW, TaskStatus.COMPLETED });
    return editor;
}
Also used : LabelProvider(org.eclipse.jface.viewers.LabelProvider) ComboBoxViewerCellEditor(org.eclipse.jface.viewers.ComboBoxViewerCellEditor)

Example 2 with ComboBoxViewerCellEditor

use of org.eclipse.jface.viewers.ComboBoxViewerCellEditor in project tbd-studio-se by Talend.

the class RelationshipTableView method createComboBoxCellEditor.

private ComboBoxViewerCellEditor createComboBoxCellEditor(Table table) {
    ComboBoxViewerCellEditor cellEditor = new ComboBoxViewerCellEditor(table);
    cellEditor.setContenProvider(new IStructuredContentProvider() {

        @Override
        public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
        }

        @Override
        public void dispose() {
        }

        @Override
        public Object[] getElements(Object arg0) {
            return (String[]) arg0;
        }
    });
    cellEditor.setLabelProvider(new LabelProvider() {

        @Override
        public String getText(Object element) {
            return (String) element;
        }
    });
    cellEditor.setInput(Relationship.Direction.getNames());
    cellEditor.setValue(Relationship.Direction.OUTGOING.getName());
    return cellEditor;
}
Also used : IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) Viewer(org.eclipse.jface.viewers.Viewer) LabelProvider(org.eclipse.jface.viewers.LabelProvider) ComboBoxViewerCellEditor(org.eclipse.jface.viewers.ComboBoxViewerCellEditor)

Aggregations

ComboBoxViewerCellEditor (org.eclipse.jface.viewers.ComboBoxViewerCellEditor)2 LabelProvider (org.eclipse.jface.viewers.LabelProvider)2 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)1 Viewer (org.eclipse.jface.viewers.Viewer)1