Search in sources :

Example 1 with CellEditor

use of org.eclipse.jface.viewers.CellEditor in project tdi-studio-se by Talend.

the class UIManager method changeSchemasDetailView.

/**
     * 
     * cLi Comment method "refreshSchemasDetailView".
     * 
     * refresh schema details view by different provider.
     */
public void changeSchemasDetailView(final TreeViewer schemaDetailsViewer, boolean model) {
    if (schemaDetailsViewer == null || schemaDetailsViewer.getTree().isDisposed()) {
        return;
    }
    final Tree tree = schemaDetailsViewer.getTree();
    // removed all columns
    final TreeColumn[] columns = tree.getColumns();
    for (TreeColumn col : columns) {
        col.dispose();
    }
    if (columnTreeEditor != null) {
        columnTreeEditor.dispose();
        final Control editor = columnTreeEditor.getEditor();
        if (editor != null && !editor.isDisposed()) {
            editor.setVisible(false);
            editor.dispose();
        }
        columnTreeEditor = null;
    }
    if (columnMouseListener != null) {
        tree.removeMouseListener(columnMouseListener);
        columnMouseListener = null;
    }
    SchemaDetailsProvider provider = null;
    if (model) {
        // is properties model
        provider = new SchemaDetailsPropertiesProvider(this);
        List<String> columnProperties = new ArrayList<String>();
        List<CellEditor> cellEidors = new ArrayList<CellEditor>();
        for (EPropertyName pName : EPropertyName.values()) {
            columnProperties.add(pName.name());
            TreeColumn pColumn = new TreeColumn(tree, SWT.NONE);
            pColumn.setWidth(100);
            pColumn.setText(pName.getName());
            final CellEditor cellEditor;
            switch(pName) {
                case NAME:
                case LENGTH:
                case TAGLEVEL:
                // case CARD:
                case PATTERN:
                    cellEditor = new SchemaDetailsTextCellEditor(schemaDetailsViewer, pName);
                    break;
                case KEY:
                    pColumn.setToolTipText("Only one column can be set as key.");
                    cellEditor = new SchemaDetailsCheckBoxCellEditor(tree);
                    break;
                // break;
                case TYPE:
                    cellEditor = new ComboBoxCellEditor(tree, MultiSchemasUtil.getTalendTypeLabel(), SWT.READ_ONLY);
                    break;
                default:
                    cellEditor = null;
            }
            if (cellEditor != null) {
                cellEidors.add(cellEditor);
            }
        }
        schemaDetailsViewer.setColumnProperties(columnProperties.toArray(new String[0]));
        schemaDetailsViewer.setCellEditors(cellEidors.toArray(new CellEditor[0]));
        schemaDetailsViewer.setCellModifier(new SchemaDetailsPropertiesCellModifier(schemaDetailsViewer, this));
        // set sorter
        TreeColumn sorterColumn = tree.getColumn(0);
        sorterColumn.addListener(SWT.Selection, new SchemaDetailsViewerSorterListener(schemaDetailsViewer));
        tree.setSortColumn(sorterColumn);
        tree.setSortDirection(SWT.UP);
        schemaDetailsViewer.setSorter(new SchemaDetailsViewerSorter(schemaDetailsViewer, sorterColumn, tree.getSortDirection() == SWT.UP));
    } else {
        // is column model
        provider = new SchemaDetailsColumnsProvider(this);
        // first columm is fixed.
        TreeColumn propertyColumn = new TreeColumn(tree, SWT.NONE);
        propertyColumn.setWidth(80);
        propertyColumn.setResizable(false);
        //
        columnTreeEditor = new TreeEditor(tree);
        columnTreeEditor.horizontalAlignment = SWT.LEFT;
        columnTreeEditor.grabHorizontal = true;
        columnMouseListener = new SchemaDetailsColumnMouseAdapter(schemaDetailsViewer, columnTreeEditor, this);
        tree.addMouseListener(columnMouseListener);
    }
    schemaDetailsViewer.setContentProvider(provider);
    schemaDetailsViewer.setLabelProvider(provider);
//
}
Also used : SchemaDetailsTextCellEditor(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsTextCellEditor) SchemaDetailsPropertiesCellModifier(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsPropertiesCellModifier) SchemaDetailsColumnsProvider(org.talend.designer.filemultischemas.ui.provider.column.SchemaDetailsColumnsProvider) SchemaDetailsPropertiesProvider(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsPropertiesProvider) TreeEditor(org.eclipse.swt.custom.TreeEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) SchemaDetailsTextCellEditor(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsTextCellEditor) SchemaDetailsCheckBoxCellEditor(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsCheckBoxCellEditor) ArrayList(java.util.ArrayList) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) SchemaDetailsViewerSorterListener(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsViewerSorterListener) SchemaDetailsColumnMouseAdapter(org.talend.designer.filemultischemas.ui.provider.column.SchemaDetailsColumnMouseAdapter) SchemaDetailsCheckBoxCellEditor(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsCheckBoxCellEditor) Control(org.eclipse.swt.widgets.Control) SchemaDetailsViewerSorter(org.talend.designer.filemultischemas.ui.provider.property.SchemaDetailsViewerSorter) EPropertyName(org.talend.designer.filemultischemas.data.EPropertyName) TreeColumn(org.eclipse.swt.widgets.TreeColumn) Tree(org.eclipse.swt.widgets.Tree) SchemaDetailsProvider(org.talend.designer.filemultischemas.ui.provider.SchemaDetailsProvider)

Example 2 with CellEditor

use of org.eclipse.jface.viewers.CellEditor in project tdi-studio-se by Talend.

the class MultiSchemasUI method createHeaderSashForm.

private void createHeaderSashForm(Composite headerComposite) {
    GridLayout layout;
    headerSashForm = new SashForm(headerComposite, SWT.NONE);
    headerSashForm.setLayout(new FillLayout());
    headerSashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    headerSashForm.setSashWidth(ExternalMultiSchemasUIProperties.SASHFORM_WIDTH);
    //
    multiSchemasFilePreview = new MultiSchemasShadowProcessPreview(this, headerSashForm);
    multiSchemasFilePreview.newTablePreview();
    Composite struComp = new Composite(headerSashForm, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    struComp.setLayout(layout);
    headerSashForm.setWeights(ExternalMultiSchemasUIProperties.getHeaderSashformWeights());
    //
    fetchBtn = new Button(struComp, SWT.PUSH);
    fetchBtn.setText(ExternalMultiSchemasUIProperties.FETCH_LABEL);
    fetchBtn.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    //
    schemaTreeViewer = new TreeViewer(struComp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    Tree tree = schemaTreeViewer.getTree();
    tree.setLayoutData(new GridData(GridData.FILL_BOTH));
    tree.setHeaderVisible(true);
    tree.setLinesVisible(true);
    schemaTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
    // SchemasTreeDnD dnd = new SchemasTreeDnD(schemaTreeViewer);
    // dnd.addDragAndDrop();
    schemaTreeViewer.setContentProvider(new SchemasTreeContentProvider());
    schemaTreeViewer.setLabelProvider(new SchemasTreeLabelProvider());
    // schemaTreeViewer.setSorter(new ViewerSorter() {
    //
    // @SuppressWarnings("unchecked")
    // @Override
    // public int compare(Viewer viewer, Object e1, Object e2) {
    // if (e1 instanceof SchemasKeyData && e2 instanceof SchemasKeyData) {
    // return getComparator().compare(((SchemasKeyData) e1).getKeyName(), ((SchemasKeyData) e2).getKeyName());
    // }
    // return super.compare(viewer, e1, e2);
    // }
    //
    // });
    TreeColumn column = new TreeColumn(tree, SWT.LEFT);
    column.setWidth(55);
    //$NON-NLS-1$
    column.setText("Schema");
    column.setResizable(true);
    column = new TreeColumn(tree, SWT.LEFT);
    column.setWidth(100);
    //$NON-NLS-1$
    column.setText("Record");
    column.setResizable(true);
    column = new TreeColumn(tree, SWT.LEFT);
    column.setWidth(20);
    //$NON-NLS-1$
    column.setText("Separator");
    column.setResizable(true);
    schemaTreeViewer.setColumnProperties(new String[] { ExternalMultiSchemasUIProperties.COLUMN_KEY, ExternalMultiSchemasUIProperties.COLUMN_RECORD, ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR });
    // hywang for 10263
    int columnCount = schemaTreeViewer.getTree().getColumnCount();
    CellEditor[] editors = new CellEditor[columnCount];
    for (int i = 0; i < columnCount; i++) {
        editors[i] = new TextCellEditor(schemaTreeViewer.getTree());
    }
    schemaTreeViewer.setCellEditors(editors);
    schemaTreeViewer.setCellModifier(new ICellModifier() {

        public void modify(Object element, String property, Object value) {
            if (element != null) {
                if (element instanceof TreeItem) {
                    TreeItem item = (TreeItem) element;
                    if (item.getData() != null) {
                        if (item.getData() instanceof SchemasKeyData) {
                            SchemasKeyData key = (SchemasKeyData) item.getData();
                            if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_KEY)) {
                                final boolean flag = checkKeyValue(key.getUniqueRecord(), value.toString());
                                if (flag) {
                                    key.setUniqueRecord(value.toString());
                                }
                            }
                            if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_RECORD)) {
                                key.setRecordType(value.toString());
                            }
                            if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR)) {
                                key.setSeparator(value.toString());
                            }
                        // Object input = schemaTreeViewer.getInput();
                        // SchemasKeyData in = (SchemasKeyData) input;
                        // if (in.getChildren().contains(key)) {
                        // in.getChildren().remove(in.getChildren().indexOf(key));
                        // List<MultiMetadataColumn> colums = multiSchemaManager.createPropertiesColumns(key);
                        // key.setMetadataColumns(colums);
                        // in.getChildren().add(key);
                        // }
                        }
                        schemaTreeViewer.refresh();
                    }
                }
            }
        }

        public Object getValue(Object element, String property) {
            String record = "";
            if (element != null) {
                if (element instanceof SchemasKeyData) {
                    SchemasKeyData key = (SchemasKeyData) element;
                    if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_KEY)) {
                        record = key.getUniqueRecord();
                    }
                    if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_RECORD)) {
                        record = key.getRecordType();
                    }
                    if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR)) {
                        record = key.getSeparator();
                    }
                }
            }
            return record;
        }

        public boolean canModify(Object element, String property) {
            return true;
        }
    });
    Composite operateTreeComposite = new Composite(struComp, SWT.NONE);
    operateTreeComposite.setLayout(new GridLayout(3, false));
    operateTreeComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    addRow = new Button(operateTreeComposite, SWT.NONE);
    addRow.setText("Add");
    removeRow = new Button(operateTreeComposite, SWT.NONE);
    removeRow.setText("Remove");
    removeRow.setEnabled(false);
    editSchema = new Button(operateTreeComposite, SWT.NONE);
    editSchema.setText("Edit Columns");
    editSchema.setEnabled(false);
    Composite operation = new Composite(struComp, SWT.NONE);
    operation.setLayout(new GridLayout(2, false));
    operation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    leftBtn = new Button(operation, SWT.PUSH);
    leftBtn.setToolTipText("Left");
    leftBtn.setImage(ImageProvider.getImage(EImage.LEFT_ICON));
    leftBtn.setEnabled(false);
    rightBtn = new Button(operation, SWT.PUSH);
    rightBtn.setToolTipText("Right");
    rightBtn.setImage(ImageProvider.getImage(EImage.RIGHT_ICON));
    rightBtn.setEnabled(false);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) CommandStackForComposite(org.talend.commons.ui.command.CommandStackForComposite) TreeItem(org.eclipse.swt.widgets.TreeItem) AbstractTreeViewer(org.eclipse.jface.viewers.AbstractTreeViewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CellEditor(org.eclipse.jface.viewers.CellEditor) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) FillLayout(org.eclipse.swt.layout.FillLayout) SchemasTreeLabelProvider(org.talend.designer.filemultischemas.ui.provider.SchemasTreeLabelProvider) Point(org.eclipse.swt.graphics.Point) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) SchemasTreeContentProvider(org.talend.designer.filemultischemas.ui.provider.SchemasTreeContentProvider) TreeColumn(org.eclipse.swt.widgets.TreeColumn) GridData(org.eclipse.swt.layout.GridData) ICellModifier(org.eclipse.jface.viewers.ICellModifier) Tree(org.eclipse.swt.widgets.Tree) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) MultiSchemasShadowProcessPreview(org.talend.designer.filemultischemas.ui.preview.MultiSchemasShadowProcessPreview) SchemasKeyData(org.talend.designer.filemultischemas.data.SchemasKeyData)

Example 3 with CellEditor

use of org.eclipse.jface.viewers.CellEditor in project tdi-studio-se by Talend.

the class ExtractionLoopWithJSONXPathEditorView method createColumns.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.commons.ui.swt.advanced.macrotable.AbstractExtendedTableViewer#createColumns(org.talend.commons.ui
     * .swt.tableviewer.TableViewerCreator, org.eclipse.swt.widgets.Table)
     */
@Override
protected void createColumns(TableViewerCreator<JSONXPathLoopDescriptor> tableViewerCreator, final Table table) {
    CellEditorValueAdapter intValueAdapter = new CellEditorValueAdapter() {

        @Override
        public Object getOriginalTypedValue(final CellEditor cellEditor, Object value) {
            try {
                return new Integer(value.toString());
            } catch (Exception ex) {
                return null;
            }
        }

        @Override
        public Object getCellEditorTypedValue(final CellEditor cellEditor, Object value) {
            if (value != null) {
                return String.valueOf(value);
            }
            //$NON-NLS-1$
            return "";
        }
    };
    // //////////////////////////////////////////////////////////////////////////////////////
    // column for mouse selection
    TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle("");
    //$NON-NLS-1$
    column.setDefaultInternalValue("");
    column.setWidth(15);
    // //////////////////////////////////////////////////////////////////////////////////////
    // X Path Query
    column = new TableViewerCreatorColumn(tableViewerCreator);
    xPathColumn = column;
    column.setTitle("Absolute path expression");
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<JSONXPathLoopDescriptor, String>() {

        @Override
        public String get(JSONXPathLoopDescriptor bean) {
            return bean.getAbsoluteXPathQuery();
        }

        @Override
        public void set(JSONXPathLoopDescriptor bean, String value) {
            String currentFlag = ConvertJSONString.getCurrentFlag();
            bean.setAbsoluteXPathQuery(value);
            bean.setFlag(currentFlag);
        }
    });
    xPathCellEditor = new TextCellEditorWithProposal(tableViewerCreator.getTable(), SWT.NONE, column);
    column.setCellEditor(xPathCellEditor);
    xPathCellEditor.addListener(new DialogErrorForCellEditorListener(xPathCellEditor, column) {

        @Override
        public void newValidValueTyped(int itemIndex, Object previousValue, Object newValue, CELL_EDITOR_STATE state) {
            if (state == CELL_EDITOR_STATE.APPLYING) {
            // linker.onXPathValueChanged(table, newValue.toString(), itemIndex);
            }
        }

        @Override
        public String validateValue(String newValue, int beanPosition) {
            return linker.validateXPathExpression(newValue);
        }
    });
    column.setModifiable(true);
    column.setWeight(30);
    column.setMinimumWidth(50);
    //$NON-NLS-1$
    column.setDefaultInternalValue("");
    // //////////////////////////////////////////////////////////////////////////////////////
    // //////////////////////////////////////////////////////////////////////////////////////
    // Loop limit
    column = new TableViewerCreatorColumn(tableViewerCreator);
    column.setTitle("Loop limit");
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<JSONXPathLoopDescriptor, Integer>() {

        @Override
        public Integer get(JSONXPathLoopDescriptor bean) {
            return bean.getLimitBoucle();
        }

        @Override
        public void set(JSONXPathLoopDescriptor bean, Integer value) {
            if (value != null) {
                bean.setLimitBoucle(value.intValue());
            } else {
                bean.setLimitBoucle(0);
            }
        }
    });
    column.setModifiable(true);
    column.setWidth(59);
    column.setCellEditor(new TextCellEditor(table), intValueAdapter);
}
Also used : JSONXPathLoopDescriptor(org.talend.repository.model.json.JSONXPathLoopDescriptor) TextCellEditorWithProposal(org.talend.commons.ui.swt.proposal.TextCellEditorWithProposal) CELL_EDITOR_STATE(org.talend.commons.ui.swt.tableviewer.TableViewerCreator.CELL_EDITOR_STATE) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) DialogErrorForCellEditorListener(org.talend.commons.ui.swt.tableviewer.celleditor.DialogErrorForCellEditorListener) CellEditorValueAdapter(org.talend.commons.ui.runtime.swt.tableviewer.behavior.CellEditorValueAdapter) ConvertJSONString(org.talend.repository.json.util.ConvertJSONString) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Example 4 with CellEditor

use of org.eclipse.jface.viewers.CellEditor in project tdi-studio-se by Talend.

the class TableByRowController method updateColumnList.

private void updateColumnList(IElementParameter param) {
    if (elem instanceof Node) {
        ColumnListController.updateColumnList((Node) elem, null);
    } else if (elem instanceof Connection) {
        ColumnListController.updateColumnList(((Connection) elem).getSource(), null);
    }
    TableViewerCreator tableViewerCreator = (TableViewerCreator) hashCurControls.get(param.getName());
    Object[] itemsValue = param.getListItemsValue();
    if (tableViewerCreator != null && itemsValue != null) {
        List colList = tableViewerCreator.getColumns();
        for (int j = 0; j < itemsValue.length; j++) {
            if (itemsValue[j] instanceof IElementParameter) {
                IElementParameter tmpParam = (IElementParameter) itemsValue[j];
                if (tmpParam.getFieldType() == EParameterFieldType.COLUMN_LIST || tmpParam.getFieldType() == EParameterFieldType.PREV_COLUMN_LIST || tmpParam.getFieldType() == EParameterFieldType.LOOKUP_COLUMN_LIST) {
                    if ((j + 1) >= colList.size()) {
                        break;
                    }
                    TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) colList.get(j + 1);
                    CellEditor cellEditor = column.getCellEditor();
                    String[] oldItems = null;
                    if (cellEditor instanceof ComboBoxCellEditor) {
                        CCombo combo = (CCombo) cellEditor.getControl();
                        oldItems = combo.getItems();
                        combo.setItems(tmpParam.getListItemsDisplayName());
                    }
                    List<Map<String, Object>> paramValues = (List<Map<String, Object>>) param.getValue();
                    String[] items = param.getListItemsDisplayCodeName();
                    for (int currentIndex = 0; currentIndex < paramValues.size(); currentIndex++) {
                        Map<String, Object> currentLine = paramValues.get(currentIndex);
                        Object o = currentLine.get(items[j]);
                        if (o instanceof Integer) {
                            Integer nb = (Integer) o;
                            if ((nb >= oldItems.length) || (nb == -1)) {
                                nb = new Integer(tmpParam.getIndexOfItemFromList((String) tmpParam.getDefaultClosedListValue()));
                                currentLine.put(items[j], nb);
                            } else {
                                nb = new Integer(tmpParam.getIndexOfItemFromList(oldItems[nb]));
                                currentLine.put(items[j], nb);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) CellEditor(org.eclipse.jface.viewers.CellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) TableViewerCreatorColumnNotModifiable(org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorColumnNotModifiable) Connection(org.talend.designer.core.ui.editor.connections.Connection) IConnection(org.talend.core.model.process.IConnection) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) Point(org.eclipse.swt.graphics.Point) CCombo(org.eclipse.swt.custom.CCombo) IElementParameter(org.talend.core.model.process.IElementParameter) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with CellEditor

use of org.eclipse.jface.viewers.CellEditor in project tdi-studio-se by Talend.

the class AddArrayIndexForParentsDialog method createDialogArea.

protected Control createDialogArea(Composite parent) {
    Composite createDialogArea = (Composite) super.createDialogArea(parent);
    FillLayout layout = new FillLayout();
    // layout.horizontalSpacing = 1;
    // layout.numColumns = 1;
    GridData data = new GridData(GridData.FILL_BOTH);
    createDialogArea.setLayout(layout);
    createDialogArea.setLayoutData(data);
    table = new TableViewer(createDialogArea, SWT.FULL_SELECTION | SWT.BORDER);
    new TableColumn(table.getTable(), SWT.LEFT).setText(COLUMN_NAME[0]);
    table.getTable().getColumn(0).pack();
    new TableColumn(table.getTable(), SWT.LEFT).setText(COLUMN_NAME[1]);
    table.getTable().getColumn(1).pack();
    table.getTable().setHeaderVisible(true);
    table.getTable().setLinesVisible(true);
    table.setContentProvider(new IndexContentProvider());
    table.setLabelProvider(new IndexLabelProvider());
    table.setInput(arrayIndexList);
    table.setColumnProperties(COLUMN_NAME);
    CellEditor[] editors = new CellEditor[2];
    editors[0] = null;
    editors[1] = new TextCellEditor(table.getTable());
    table.setCellEditors(editors);
    table.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            if (property.equals(COLUMN_NAME[0]))
                return false;
            return true;
        }

        public Object getValue(Object element, String property) {
            ArrayIndexList index = (ArrayIndexList) element;
            if (property.equals(COLUMN_NAME[1])) {
                if (index.getIndexNum() != null) {
                    return index.getIndexNum();
                } else {
                    return "";
                }
            }
            return null;
        }

        public void modify(Object element, String property, Object value) {
            if (element instanceof Item)
                element = ((Item) element).getData();
            ArrayIndexList index = (ArrayIndexList) element;
            if (property.equals(COLUMN_NAME[1]))
                index.setIndexNum((String) value);
            table.refresh();
        }
    });
    return createDialogArea;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) Item(org.eclipse.swt.widgets.Item) GridData(org.eclipse.swt.layout.GridData) ICellModifier(org.eclipse.jface.viewers.ICellModifier) ArrayIndexList(org.talend.designer.webservice.data.ArrayIndexList) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

CellEditor (org.eclipse.jface.viewers.CellEditor)142 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)88 TableViewer (org.eclipse.jface.viewers.TableViewer)45 GridData (org.eclipse.swt.layout.GridData)44 Composite (org.eclipse.swt.widgets.Composite)37 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)35 ICellModifier (org.eclipse.jface.viewers.ICellModifier)32 GridLayout (org.eclipse.swt.layout.GridLayout)30 SelectionEvent (org.eclipse.swt.events.SelectionEvent)29 TableColumn (org.eclipse.swt.widgets.TableColumn)29 CheckboxCellEditor (org.eclipse.jface.viewers.CheckboxCellEditor)25 Table (org.eclipse.swt.widgets.Table)24 Button (org.eclipse.swt.widgets.Button)23 ArrayList (java.util.ArrayList)21 Label (org.eclipse.swt.widgets.Label)21 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)20 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)20 Text (org.eclipse.swt.widgets.Text)19 Map (java.util.Map)18 EditingSupport (org.eclipse.jface.viewers.EditingSupport)18