Search in sources :

Example 1 with MoveUpPushButtonForExtendedTable

use of org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButtonForExtendedTable in project tdi-studio-se by Talend.

the class HL7MetadataEmfToolbarEditor method createMoveUpPushButton.

@Override
protected MoveUpPushButton createMoveUpPushButton() {
    return new MoveUpPushButtonForExtendedTable(toolbar, extendedTableViewer) {

        @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);
                }
            }
            linker.getMainui().redrawLinkers();
            linker.getBackgroundRefresher().refreshBackground();
        }

        @Override
        public boolean getEnabledState() {
            // 13749
            return super.getEnabledState() && !isRepository;
        }
    };
}
Also used : IModel(org.talend.designer.hl7.model.IModel) MoveUpPushButtonForExtendedTable(org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButtonForExtendedTable) ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) 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)

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 MoveUpPushButtonForExtendedTable (org.talend.commons.ui.swt.advanced.dataeditor.button.MoveUpPushButtonForExtendedTable)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