Search in sources :

Example 1 with MetadataEmfPasteCommand

use of org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand in project tdi-studio-se by Talend.

the class HL7MetadataEmfToolbarEditor method createPastePushButton.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.ui.extended.ExtendedToolbarView#createPastButton()
     */
@Override
public PastePushButton createPastePushButton() {
    return new PastePushButtonForExtendedTable(toolbar, extendedTableViewer) {

        @Override
        protected Command getCommandToExecute(ExtendedTableModel extendedTableModel, Integer indexWhereInsert) {
            return new MetadataEmfPasteCommand(extendedTableModel, indexWhereInsert);
        }

        @Override
        public boolean getEnabledState() {
            // 13749
            return super.getEnabledState() && !isRepository;
        }

        @Override
        protected void afterCommandExecution(Command executedCommand) {
            MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
            IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
            Object selectedObj = selection.getFirstElement();
            if (selectedObj != null) {
                String key = ((IModel) selectedObj).getDisplayName();
                List<MetadataColumn> metadataColumnList = tableEditorModel.getMetadataColumnList();
                Map<String, List<MetadataColumn>> schemaRelationMap = linker.getManager().getSchemaRelationMap();
                if (schemaRelationMap != null) {
                    List<MetadataColumn> schemas = new ArrayList<MetadataColumn>();
                    schemas.addAll(metadataColumnList);
                    schemaRelationMap.put(key, schemas);
                }
            }
        }
    };
}
Also used : IModel(org.talend.designer.hl7.model.IModel) ArrayList(java.util.ArrayList) PastePushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButtonForExtendedTable) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) MetadataEmfPasteCommand(org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) MetadataEmfExportXmlCommand(org.talend.core.ui.metadata.extended.command.MetadataEmfExportXmlCommand) MetadataEmfPasteCommand(org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand) ExtendedTableResetDBTypesCommand(org.talend.core.ui.metadata.extended.command.ExtendedTableResetDBTypesCommand) MetadataEmfImportXmlCommand(org.talend.core.ui.metadata.extended.command.MetadataEmfImportXmlCommand) Command(org.eclipse.gef.commands.Command) MetadataEmfTableEditor(org.talend.core.ui.metadata.editor.MetadataEmfTableEditor) HL7MultiSchemaUI(org.talend.designer.hl7.ui.HL7MultiSchemaUI) ArrayList(java.util.ArrayList) List(java.util.List) ExtendedTableModel(org.talend.commons.ui.swt.extended.table.ExtendedTableModel)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Command (org.eclipse.gef.commands.Command)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 PastePushButtonForExtendedTable (org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButtonForExtendedTable)1 ExtendedTableModel (org.talend.commons.ui.swt.extended.table.ExtendedTableModel)1 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)1 MetadataEmfTableEditor (org.talend.core.ui.metadata.editor.MetadataEmfTableEditor)1 ExtendedTableResetDBTypesCommand (org.talend.core.ui.metadata.extended.command.ExtendedTableResetDBTypesCommand)1 MetadataEmfExportXmlCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfExportXmlCommand)1 MetadataEmfImportXmlCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfImportXmlCommand)1 MetadataEmfPasteCommand (org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand)1 IModel (org.talend.designer.hl7.model.IModel)1 HL7MultiSchemaUI (org.talend.designer.hl7.ui.HL7MultiSchemaUI)1