Search in sources :

Example 6 with AutoConversionType

use of org.talend.core.model.metadata.types.AutoConversionType in project tdi-studio-se by Talend.

the class AutoConversionTypesEditorView method createSourceDataTypeColumn.

private TableViewerCreatorColumn createSourceDataTypeColumn(TableViewerCreator<AutoConversionType> tableViewerCreator) {
    TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("AutoConversionTypesEditor.table.column.sourceDataType"));
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<AutoConversionType, String>() {

        @Override
        public String get(AutoConversionType bean) {
            return bean.getSourceDataType();
        }

        @Override
        public void set(AutoConversionType bean, String value) {
            bean.setSourceDataType(value);
        }
    });
    column.setModifiable(true);
    column.setWeight(30);
    column.setMinimumWidth(50);
    configureTypeColumn(tableViewerCreator, column);
    return column;
}
Also used : AutoConversionType(org.talend.core.model.metadata.types.AutoConversionType) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Example 7 with AutoConversionType

use of org.talend.core.model.metadata.types.AutoConversionType in project tdi-studio-se by Talend.

the class AutoConversionTypesEditorView method initToolBar.

@Override
protected ExtendedToolbarView initToolBar() {
    return new ExtendedToolbarView(getMainComposite(), SWT.NONE, getExtendedTableViewer()) {

        @Override
        protected AddPushButtonForExtendedTable createAddPushButton() {
            return new AddPushButtonForExtendedTable(this.toolbar, getExtendedTableViewer()) {

                @Override
                protected Object getObjectToAdd() {
                    AutoConversionType bean = new AutoConversionType();
                    bean.setSourceDataType(JavaTypesManager.getDefaultJavaType().getId());
                    bean.setTargetDataType(JavaTypesManager.getDefaultJavaType().getId());
                    //$NON-NLS-1$
                    bean.setConversionFunction("String.valueOf(${0})");
                    return bean;
                }
            };
        }

        @Override
        protected PastePushButton createPastePushButton() {
            return new PastePushButtonForExtendedTable(toolbar, extendedTableViewer) {

                @Override
                protected Command getCommandToExecute(ExtendedTableModel extendedTableModel, Integer indexWhereInsert) {
                    return new ExtendedTablePasteCommand(extendedTableModel, indexWhereInsert) {

                        @Override
                        public List<AutoConversionType> createPastableBeansList(ExtendedTableModel extendedTableModel, List copiedObjectsList) {
                            List<AutoConversionType> beans = new ArrayList<>();
                            beans.addAll(copiedObjectsList);
                            return beans;
                        }
                    };
                }
            };
        }
    };
}
Also used : AddPushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.AddPushButtonForExtendedTable) AutoConversionType(org.talend.core.model.metadata.types.AutoConversionType) ExtendedTablePasteCommand(org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTablePasteCommand) ArrayList(java.util.ArrayList) PastePushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButtonForExtendedTable) ArrayList(java.util.ArrayList) List(java.util.List) ExtendedTableModel(org.talend.commons.ui.swt.extended.table.ExtendedTableModel) ExtendedToolbarView(org.talend.commons.ui.swt.advanced.dataeditor.ExtendedToolbarView)

Example 8 with AutoConversionType

use of org.talend.core.model.metadata.types.AutoConversionType in project tdi-studio-se by Talend.

the class AutoConversionTypesEditorView method createConversionFunctionColumn.

private TableViewerCreatorColumn createConversionFunctionColumn(TableViewerCreator<AutoConversionType> tableViewerCreator) {
    TableViewerCreatorColumn column = new TableViewerCreatorColumn(tableViewerCreator);
    //$NON-NLS-1$
    column.setTitle(Messages.getString("AutoConversionTypesEditor.table.column.conversionFunction"));
    column.setBeanPropertyAccessors(new IBeanPropertyAccessors<AutoConversionType, String>() {

        @Override
        public String get(AutoConversionType bean) {
            return bean.getConversionFunction();
        }

        @Override
        public void set(AutoConversionType bean, String value) {
            bean.setConversionFunction(value);
        }
    });
    column.setModifiable(true);
    column.setWeight(60);
    column.setMinimumWidth(50);
    //$NON-NLS-1$
    column.setDefaultInternalValue("");
    AutoConversionProposalProvider functionProposalProvider = new AutoConversionProposalProvider();
    TextCellEditorWithProposal textCellEditor = new TextCellEditorWithProposal(tableViewerCreator.getTable(), column);
    textCellEditor.setContentProposalProvider(functionProposalProvider);
    column.setCellEditor(textCellEditor);
    return column;
}
Also used : AutoConversionType(org.talend.core.model.metadata.types.AutoConversionType) TextCellEditorWithProposal(org.talend.commons.ui.swt.proposal.TextCellEditorWithProposal) AutoConversionProposalProvider(org.talend.core.ui.proposal.AutoConversionProposalProvider) TableViewerCreatorColumn(org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)

Aggregations

AutoConversionType (org.talend.core.model.metadata.types.AutoConversionType)8 TableViewerCreatorColumn (org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn)3 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)2 Document (org.w3c.dom.Document)2 ErrorHandler (org.xml.sax.ErrorHandler)2 SAXException (org.xml.sax.SAXException)2 SAXParseException (org.xml.sax.SAXParseException)2 OutputFormat (com.sun.org.apache.xml.internal.serialize.OutputFormat)1 XMLSerializer (com.sun.org.apache.xml.internal.serialize.XMLSerializer)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Path (org.eclipse.core.runtime.Path)1 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)1 CCombo (org.eclipse.swt.custom.CCombo)1