Search in sources :

Example 6 with DialogErrorForCellEditorListener

use of org.talend.commons.ui.swt.tableviewer.celleditor.DialogErrorForCellEditorListener in project tdi-studio-se by Talend.

the class JSONFileOutputMetadataEmfTableEditorView method configureNameColumn.

protected void configureNameColumn(TableViewerCreator<MetadataColumn> tableViewerCreator) {
    TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
    column.setId(ID_COLUMN_NAME);
    //$NON-NLS-1$
    column.setTitle("Schema List");
    column.setWidth(100);
    column.setToolTipHeader("Column");
    column.setBeanPropertyAccessors(getLabelAccessor());
    final Image imageKey = ImageProvider.getImage(EImage.KEY_ICON);
    final Image imageEmpty = org.talend.commons.ui.runtime.image.ImageProvider.getImage(EImage.EMPTY);
    final TextCellEditor cellEditor = new TextCellEditor(tableViewerCreator.getTable());
    column.setCellEditor(cellEditor);
    cellEditor.addListener(new DialogErrorForCellEditorListener(cellEditor, column) {

        @Override
        public void newValidValueTyped(int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state) {
        }

        @Override
        public String validateValue(String newValue, int beanPosition) {
            return validateColumnName(newValue, beanPosition);
        }
    });
    column.setImageProvider(new IColumnImageProvider() {

        public Image getImage(Object element) {
            if (getKeyAccesor().get((MetadataColumn) element)) {
                return imageKey;
            } else {
                return imageEmpty;
            }
        }
    });
    column.setWeight(25);
    column.setModifiable(!isReadOnly());
    column.setMinimumWidth(20);
// nameColumn = column;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) IColumnImageProvider(org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnImageProvider) CELL_EDITOR_STATE(org.talend.commons.ui.swt.tableviewer.TableViewerCreator.CELL_EDITOR_STATE) DialogErrorForCellEditorListener(org.talend.commons.ui.swt.tableviewer.celleditor.DialogErrorForCellEditorListener) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn) EImage(org.talend.commons.ui.runtime.image.EImage) Image(org.eclipse.swt.graphics.Image)

Aggregations

CELL_EDITOR_STATE (org.talend.commons.ui.swt.tableviewer.TableViewerCreator.CELL_EDITOR_STATE)6 TableViewerCreatorColumn (org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)6 DialogErrorForCellEditorListener (org.talend.commons.ui.swt.tableviewer.celleditor.DialogErrorForCellEditorListener)6 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)5 CellEditorValueAdapter (org.talend.commons.ui.runtime.swt.tableviewer.behavior.CellEditorValueAdapter)3 TextCellEditorWithProposal (org.talend.commons.ui.swt.proposal.TextCellEditorWithProposal)3 CellEditor (org.eclipse.jface.viewers.CellEditor)2 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)2 Image (org.eclipse.swt.graphics.Image)2 EImage (org.talend.commons.ui.runtime.image.EImage)2 IColumnImageProvider (org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnImageProvider)2 CheckboxTableEditorContent (org.talend.commons.ui.swt.tableviewer.tableeditor.CheckboxTableEditorContent)2 CCombo (org.eclipse.swt.custom.CCombo)1 Color (org.eclipse.swt.graphics.Color)1 CheckColumnSelectionListener (org.talend.commons.ui.runtime.swt.tableviewer.behavior.CheckColumnSelectionListener)1 ColumnCellModifier (org.talend.commons.ui.runtime.swt.tableviewer.behavior.ColumnCellModifier)1 IColumnColorProvider (org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnColorProvider)1 IColumnLabelProvider (org.talend.commons.ui.runtime.swt.tableviewer.behavior.IColumnLabelProvider)1 ExtendedTextCellEditor (org.talend.commons.ui.runtime.swt.tableviewer.celleditor.ExtendedTextCellEditor)1 ModifiedObjectInfo (org.talend.commons.ui.runtime.swt.tableviewer.data.ModifiedObjectInfo)1