Search in sources :

Example 1 with IModifiedBeanListener

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

the class UIManager method modifySelectionChangedListener.

private void modifySelectionChangedListener(final Zone currentZone, final MetadataTableEditorView metadataTableEditorViewFinal, final TableViewerCreator metadataTVCreator, final MetadataTableEditor metadataTableEditor, final DataMapTableView dataMapTableView, DataMapTableView previousSelectedTableView) {
    final TableViewer tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
    IModifiedBeanListener<IMetadataColumn> modifiedBeanListener = new IModifiedBeanListener<IMetadataColumn>() {

        @Override
        public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
            if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId()) && !event.previousValue.equals(event.newValue)) {
                IMetadataColumn modifiedObject = event.bean;
                if (modifiedObject != null) {
                    TableEntryLocation tableEntryLocation = new TableEntryLocation(dataMapTableView.getDataMapTable().getName(), (String) event.previousValue);
                    final ITableEntry dataMapTableEntry = mapperManager.retrieveTableEntry(tableEntryLocation);
                    processColumnNameChanged((String) event.previousValue, (String) event.newValue, dataMapTableView, dataMapTableEntry, false);
                }
                // dataMapTableViewer.refresh(event.bean, true);
                tableViewer.refresh(true);
                mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
            } else if (AbstractMetadataTableEditorView.ID_COLUMN_KEY.equals(event.column.getId())) {
                tableViewer.refresh(true);
                IColumnEntry entry = dataMapTableView.getDataMapTable().getColumnEntries().get(event.index);
                parseExpression(entry.getExpression(), entry, false, false, false);
            } else if (AbstractMetadataTableEditorView.ID_COLUMN_TYPE.equals(event.column.getId()) || AbstractMetadataTableEditorView.ID_COLUMN_NULLABLE.equals(event.column.getId())) {
                mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
            }
        }
    };
    ILineSelectionListener metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            if (metadataTableEditorViewFinal.getTableViewerCreator() == e.source) {
                if (metadataTableEditorViewFinal.getExtendedTableViewer().isExecuteSelectionEvent()) {
                    mapperManager.getUiManager().selectLinkedTableEntries(metadataTableEditor.getMetadataTable(), metadataTVCreator.getTable().getSelectionIndices());
                }
            } else {
            // if (dataMapTableView.getExtendedTableViewerForColumns().isExecuteSelectionEvent()) {
            // int[] selectionIndices =
            // dataMapTableView.getTableViewerCreatorForColumns().getTable().getSelectionIndices();
            // mapperManager.getUiManager().selectLinkedMetadataEditorEntries(dataMapTableView,
            // selectionIndices);
            // }
            }
        }
    };
    // ISelectionChangedListener previousSelectionChangedListener = null;
    ILineSelectionListener previousSelectionChangedListener = null;
    IModifiedBeanListener<IMetadataColumn> previousModifiedBeanListener = null;
    if (currentZone == Zone.INPUTS) {
        previousSelectionChangedListener = inputsSelectionChangedListener;
        previousModifiedBeanListener = inputModifiedBeanListener;
    } else if (currentZone == Zone.OUTPUTS) {
        previousSelectionChangedListener = outputsSelectionChangedListener;
        previousModifiedBeanListener = outputModifiedBeanListener;
    }
    if (previousSelectionChangedListener != null) {
        // metadataTVCreator.removeSelectionChangedListener(previousSelectionChangedListener);
        metadataTVCreator.getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
        if (previousSelectedTableView != null) {
            previousSelectedTableView.getTableViewerCreatorForColumns().getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
        }
    }
    if (previousModifiedBeanListener != null) {
        metadataTableEditor.removeModifiedBeanListener(previousModifiedBeanListener);
    }
    if (currentZone == Zone.INPUTS) {
        inputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
        inputModifiedBeanListener = modifiedBeanListener;
    } else if (currentZone == Zone.OUTPUTS) {
        outputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
        outputModifiedBeanListener = modifiedBeanListener;
    }
    // metadataTVCreator.addSelectionChangedListener(metadataEditorViewerSelectionChangedListener);
    metadataTVCreator.getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    dataMapTableView.getTableViewerCreatorForColumns().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    metadataTableEditor.addModifiedBeanListener(modifiedBeanListener);
    if (this.commonMetadataDisposeListener == null) {
        this.commonMetadataDisposeListener = new DisposeListener() {

            @Override
            public void widgetDisposed(DisposeEvent e) {
                if (inputsSelectionChangedListener != null) {
                    getMetadataEditorView(Zone.INPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(inputsSelectionChangedListener);
                }
                if (outputsSelectionChangedListener != null) {
                    getMetadataEditorView(Zone.OUTPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(outputsSelectionChangedListener);
                }
                if (inputModifiedBeanListener != null) {
                    MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.INPUTS).getMetadataTableEditor();
                    if (metadataTableEditor != null) {
                        metadataTableEditor.removeModifiedBeanListener(inputModifiedBeanListener);
                    }
                }
                if (outputModifiedBeanListener != null) {
                    MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.OUTPUTS).getMetadataTableEditor();
                    if (metadataTableEditor != null) {
                        metadataTableEditor.removeModifiedBeanListener(outputModifiedBeanListener);
                    }
                }
            }
        };
        metadataTVCreator.getTable().addDisposeListener(this.commonMetadataDisposeListener);
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) MetadataTableEditor(org.talend.core.ui.metadata.editor.MetadataTableEditor) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) TableEntryLocation(org.talend.designer.dbmap.model.tableentry.TableEntryLocation) TableViewer(org.eclipse.jface.viewers.TableViewer)

Example 2 with IModifiedBeanListener

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

the class DataMapTableView method addTablesListeners.

/**
     * DOC amaumont Comment method "addTableForColumnsListeners".
     */
private void addTablesListeners() {
    tableViewerCreatorForColumns.addCellValueModifiedListener(new ITableCellValueModifiedListener() {

        @Override
        public void cellValueModified(TableCellValueModifiedEvent e) {
            unselectAllEntriesIfErrorDetected(e);
        }
    });
    abstractDataMapTable.getTableColumnsEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {

        @Override
        public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
            mapperManager.getUiManager().refreshSqlExpression();
        }
    });
    final TableViewer tableViewerForEntries = tableViewerCreatorForColumns.getTableViewer();
    tableViewerForEntries.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            int[] selectionIndices = tableViewerForEntries.getTable().getSelectionIndices();
            if (selectionIndices.length > 0) {
                selectThisDataMapTableView();
                onSelectedEntries(event.getSelection(), selectionIndices);
                // bug 18414
                MetadataTableEditorView metadataTableEditorView = null;
                if (getZone() == Zone.INPUTS) {
                    metadataTableEditorView = mapperManager.getUiManager().getInputMetaEditorView();
                } else if (getZone() == Zone.OUTPUTS) {
                    metadataTableEditorView = mapperManager.getUiManager().getOutputMetaEditorView();
                }
                if (metadataTableEditorView != null) {
                    metadataTableEditorView.getTableViewerCreator().refresh();
                }
            }
        }
    });
    tableForEntries.addListener(SWT.DragDetect, new Listener() {

        @Override
        public void handleEvent(Event event) {
            onSelectedEntries(tableViewerForEntries.getSelection(), tableViewerForEntries.getTable().getSelectionIndices());
        }
    });
    tableViewerCreatorForColumns.getSelectionHelper().addAfterSelectionListener(new ILineSelectionListener() {

        @Override
        public void handle(LineSelectionEvent e) {
            if (forceExecuteSelectionEvent) {
                forceExecuteSelectionEvent = false;
                onSelectedEntries(tableViewerForEntries.getSelection(), tableViewerForEntries.getTable().getSelectionIndices());
            }
        }
    });
    tableForEntries.addListener(SWT.KeyDown, new Listener() {

        @Override
        public void handleEvent(Event event) {
            processEnterKeyDown(tableViewerCreatorForColumns, event);
        }
    });
    abstractDataMapTable.getTableColumnsEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<IColumnEntry>() {

        @Override
        public void handleEvent(ModifiedBeanEvent<IColumnEntry> event) {
            TableViewerCreator tableViewerCreator = tableViewerCreatorForColumns;
            ITableEntry tableEntry = event.bean;
            parseExpressionIfNeeded(event, tableViewerCreator, tableEntry);
            mapperManager.getUiManager().refreshSqlExpression();
        }
    });
    if (abstractDataMapTable instanceof OutputTable) {
        OutputTable outputTable = (OutputTable) abstractDataMapTable;
        outputTable.getWhereTableFiltersEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {

            @Override
            public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
                resizeAtExpandedSize();
                mapperManager.getUiManager().refreshSqlExpression();
            }
        });
        outputTable.getWhereTableFiltersEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<FilterTableEntry>() {

            @Override
            public void handleEvent(ModifiedBeanEvent<FilterTableEntry> event) {
                onOutputTableFiltersModified(event, extendedTableViewerForFilters);
                mapperManager.getUiManager().refreshSqlExpression();
            }
        });
        outputTable.getOtherTableFiltersEntriesModel().addAfterOperationListListener(new IListenableListListener<FilterTableEntry>() {

            @Override
            public void handleEvent(ListenableListEvent<FilterTableEntry> event) {
                resizeAtExpandedSize();
                mapperManager.getUiManager().refreshSqlExpression();
            }
        });
        outputTable.getOtherTableFiltersEntriesModel().addModifiedBeanListener(new IModifiedBeanListener<FilterTableEntry>() {

            @Override
            public void handleEvent(ModifiedBeanEvent<FilterTableEntry> event) {
                onOutputTableFiltersModified(event, entendedTableViewerForOtherClauses);
                mapperManager.getUiManager().refreshSqlExpression();
            }
        });
    }
}
Also used : SelectionListener(org.eclipse.swt.events.SelectionListener) ControlListener(org.eclipse.swt.events.ControlListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) DisposeListener(org.eclipse.swt.events.DisposeListener) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) ICellEditorListener(org.eclipse.jface.viewers.ICellEditorListener) MouseListener(org.eclipse.swt.events.MouseListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) FocusListener(org.eclipse.swt.events.FocusListener) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) KeyListener(org.eclipse.swt.events.KeyListener) TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) FilterTableEntry(org.talend.designer.dbmap.model.tableentry.FilterTableEntry) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) ITableCellValueModifiedListener(org.talend.commons.ui.runtime.swt.tableviewer.behavior.ITableCellValueModifiedListener) OutputTable(org.talend.designer.dbmap.model.table.OutputTable) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) FocusEvent(org.eclipse.swt.events.FocusEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) TableCellValueModifiedEvent(org.talend.commons.ui.runtime.swt.tableviewer.behavior.TableCellValueModifiedEvent) Event(org.eclipse.swt.widgets.Event) SelectionEvent(org.eclipse.swt.events.SelectionEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) AbstractExtendedTableViewer(org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView)

Example 3 with IModifiedBeanListener

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

the class MapperManager method selectInputXmlTree.

public void selectInputXmlTree(InputXmlTree inputTree) {
    if (inputTree != selectedInputTree) {
        selectedInputTree = inputTree;
        MetadataTableEditorView inputMetaEditorView = mapperUI.getTabFolderEditors().getInputMetaEditorView();
        List<IODataComponent> inputs = getMapperComponent().getIODataComponents().getInputs();
        IMetadataTable table = null;
        for (int i = 0; i < inputs.size(); i++) {
            IODataComponent ioDataComponent = inputs.get(i);
            if (inputTree.getName() != null && inputTree.getName().equals(ioDataComponent.getConnection().getName())) {
                table = ioDataComponent.getTable();
                break;
            }
        }
        if (table != null) {
            MetadataTableEditor editor = new MetadataTableEditor(table, selectedInputTree.getName());
            editor.setModifiedBeanListenable(inputMetaEditorView.getTableViewerCreator());
            IModifiedBeanListener<IMetadataColumn> columnListener = new IModifiedBeanListener<IMetadataColumn>() {

                @Override
                public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
                    fireCurrentDirectEditApply();
                    if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId())) {
                        if (event.index < selectedInputTree.getNodes().size()) {
                            TreeNode treeNode = selectedInputTree.getNodes().get(event.index);
                            if (treeNode != null) {
                                treeNode.setName((String) event.newValue);
                                processColumnNameChanged(treeNode);
                            }
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_TYPE.equals(event.column.getId())) {
                        if (event.index < selectedInputTree.getNodes().size()) {
                            TreeNode treeNode = selectedInputTree.getNodes().get(event.index);
                            if (treeNode != null) {
                                if (treeNode.getType() != null && treeNode.getType().equals(XmlMapUtil.DOCUMENT)) {
                                    List<TreeNode> oldLoops = new ArrayList<TreeNode>();
                                    if (selectedInputTree == mainInputTree && mainInputTree.isMultiLoops()) {
                                        oldLoops = XmlMapUtil.getMultiLoopsForXmlTree(selectedInputTree);
                                    }
                                    XmlMapUtil.detachNodeConnections(treeNode, getExternalData(), true);
                                    treeNode.getChildren().clear();
                                    if (selectedInputTree == mainInputTree && mainInputTree.isMultiLoops()) {
                                        selectedInputTree.setMultiLoops(XmlMapUtil.checkMultiLoopsStatus(selectedInputTree));
                                        List<TreeNode> newLoops = XmlMapUtil.getMultiLoopsForXmlTree(selectedInputTree);
                                        oldLoops.removeAll(newLoops);
                                        if (!oldLoops.isEmpty()) {
                                            XmlMapUtil.removeloopInOutputTree(MapperManager.this, oldLoops);
                                        }
                                    }
                                }
                                treeNode.setType((String) event.newValue);
                                if (XmlMapUtil.DOCUMENT.equals(event.newValue)) {
                                    XmlMapUtil.detachNodeConnections(treeNode, getExternalData(), true);
                                    TreeNode createTreeNode = XmlmapFactory.eINSTANCE.createTreeNode();
                                    createTreeNode.setName("root");
                                    createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
                                    createTreeNode.setNodeType(NodeType.ELEMENT);
                                    createTreeNode.setXpath(XmlMapUtil.getXPath(treeNode.getXpath(), createTreeNode.getName(), createTreeNode.getNodeType()));
                                    createTreeNode.setLoop(true);
                                    createTreeNode.setMain(true);
                                    treeNode.getChildren().add(createTreeNode);
                                }
                                problemsAnalyser.checkProblems(selectedInputTree);
                                mapperUI.updateStatusBar();
                                inputTreeSchemaBeanListModified();
                            }
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_KEY.equals(event.column.getId())) {
                        if (event.index < selectedInputTree.getNodes().size()) {
                            TreeNode treeNode = selectedInputTree.getNodes().get(event.index);
                            treeNode.setKey((Boolean) event.newValue);
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_PATTERN.equals(event.column.getId())) {
                        if (event.index < selectedInputTree.getNodes().size()) {
                            TreeNode treeNode = selectedInputTree.getNodes().get(event.index);
                            treeNode.setPattern((String) event.newValue);
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_NULLABLE.equals(event.column.getId())) {
                        if (event.index < selectedInputTree.getNodes().size()) {
                            TreeNode treeNode = selectedInputTree.getNodes().get(event.index);
                            treeNode.setNullable((Boolean) event.newValue);
                        }
                    }
                }
            };
            editor.addModifiedBeanListener(columnListener);
            editor.addAfterOperationListListener(new IListenableListListener() {

                @Override
                public void handleEvent(ListenableListEvent event) {
                    if (event.type == TYPE.ADDED) {
                        EList<TreeNode> nodes = selectedInputTree.getNodes();
                        List<IMetadataColumn> metadataColumns = (List<IMetadataColumn>) event.addedObjects;
                        if (event.index != null) {
                            int index = event.index;
                            for (IMetadataColumn column : metadataColumns) {
                                TreeNode createTreeNode = XmlmapFactory.eINSTANCE.createTreeNode();
                                createTreeNode.setName(column.getLabel());
                                createTreeNode.setType(column.getTalendType());
                                createTreeNode.setNullable(column.isNullable());
                                createTreeNode.setPattern(column.getPattern());
                                createTreeNode.setXpath(XmlMapUtil.getXPath(selectedInputTree.getName(), createTreeNode.getName(), createTreeNode.getNodeType()));
                                selectedInputTree.getNodes().add(index, createTreeNode);
                                index = index + 1;
                            }
                        }
                    } else if (event.type == TYPE.REMOVED) {
                        List<IMetadataColumn> metadataColumns = (List<IMetadataColumn>) event.removedObjects;
                        List treeNodeToRemove = new ArrayList();
                        for (IMetadataColumn column : metadataColumns) {
                            for (TreeNode node : selectedInputTree.getNodes()) {
                                if (node.getName() != null && node.getName().equals(column.getLabel())) {
                                    XmlMapUtil.detachNodeConnections(node, getExternalData(), true);
                                    treeNodeToRemove.add(node);
                                }
                            }
                        }
                        selectedInputTree.getNodes().removeAll(treeNodeToRemove);
                        if (selectedInputTree == mainInputTree && mainInputTree.isMultiLoops()) {
                            selectedInputTree.setMultiLoops(XmlMapUtil.checkMultiLoopsStatus(selectedInputTree));
                            List<TreeNode> oldLoops = new ArrayList<TreeNode>();
                            XmlMapUtil.getChildLoops(oldLoops, treeNodeToRemove);
                            if (!oldLoops.isEmpty()) {
                                XmlMapUtil.removeloopInOutputTree(MapperManager.this, oldLoops);
                            }
                        }
                        problemsAnalyser.checkProblems(selectedInputTree);
                        mapperUI.updateStatusBar();
                        inputTreeSchemaBeanListModified();
                    } else if (event.type == TYPE.SWAPED) {
                        List<Integer> listIndexTarget = event.indicesTarget;
                        List<Integer> listIndexOrignal = event.indicesOrigin;
                        for (int i = 0; i < listIndexOrignal.size(); i++) {
                            int orignal = listIndexOrignal.get(i);
                            int target = listIndexTarget.get(i);
                            if (orignal < selectedInputTree.getNodes().size()) {
                                TreeNode tempTreeNode = selectedInputTree.getNodes().get(orignal);
                                selectedInputTree.getNodes().remove(orignal);
                                selectedInputTree.getNodes().add(target, tempTreeNode);
                            }
                        }
                    } else if (event.type == TYPE.REPLACED) {
                        // fix for TDI-24071
                        List added = (List) event.addedObjects;
                        List removed = (List) event.removedObjects;
                        boolean needCheckOutput = false;
                        List<TreeNode> oldLoops = new ArrayList<TreeNode>();
                        if (selectedInputTree == mainInputTree && mainInputTree.isMultiLoops()) {
                            needCheckOutput = true;
                        }
                        List<IMetadataColumn> removedColumn = new ArrayList<IMetadataColumn>();
                        List<IMetadataColumn> addedColumn = new ArrayList<IMetadataColumn>();
                        if (!added.isEmpty()) {
                            addedColumn.addAll((List<IMetadataColumn>) added.get(0));
                        }
                        if (!removed.isEmpty()) {
                            removedColumn.addAll((List<IMetadataColumn>) removed.get(0));
                        }
                        Map<IMetadataColumn, TreeNode> nodeMap = new HashMap<IMetadataColumn, TreeNode>();
                        for (int i = 0; i < removedColumn.size(); i++) {
                            IMetadataColumn column = removedColumn.get(i);
                            TreeNode node = selectedInputTree.getNodes().get(i);
                            boolean found = false;
                            for (IMetadataColumn columnAdded : addedColumn) {
                                if (column.sameMetacolumnAs(columnAdded)) {
                                    nodeMap.put(columnAdded, node);
                                    found = true;
                                    break;
                                }
                            }
                            if (!found) {
                                XmlMapUtil.detachNodeConnections(node, getExternalData(), true);
                                // get old loops if doc column need to be delete
                                if (needCheckOutput) {
                                    XmlMapUtil.getChildLoops(oldLoops, node.getChildren());
                                }
                            }
                        }
                        // remove all
                        selectedInputTree.getNodes().clear();
                        // add all
                        for (IMetadataColumn column : addedColumn) {
                            TreeNode treeNode = nodeMap.get(column);
                            if (treeNode == null) {
                                treeNode = XmlmapFactory.eINSTANCE.createTreeNode();
                                treeNode.setName(column.getLabel());
                                treeNode.setType(column.getTalendType());
                                treeNode.setNullable(column.isNullable());
                                treeNode.setPattern(column.getPattern());
                                treeNode.setXpath(XmlMapUtil.getXPath(selectedInputTree.getName(), treeNode.getName(), treeNode.getNodeType()));
                                if (XmlMapUtil.DOCUMENT.equals(column.getTalendType())) {
                                    TreeNode createTreeNode = XmlmapFactory.eINSTANCE.createTreeNode();
                                    createTreeNode.setName("root");
                                    createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
                                    createTreeNode.setNodeType(NodeType.ELEMENT);
                                    createTreeNode.setXpath(XmlMapUtil.getXPath(treeNode.getXpath(), createTreeNode.getName(), createTreeNode.getNodeType()));
                                    createTreeNode.setLoop(true);
                                    createTreeNode.setMain(true);
                                    treeNode.getChildren().add(createTreeNode);
                                }
                            }
                            selectedInputTree.getNodes().add(treeNode);
                        }
                        // for multi loops ,incase the doc node with multi loop is deleted
                        selectedInputTree.setMultiLoops(XmlMapUtil.checkMultiLoopsStatus(selectedInputTree));
                        if (!oldLoops.isEmpty()) {
                            XmlMapUtil.removeloopInOutputTree(MapperManager.this, oldLoops);
                        }
                        mapperUI.updateStatusBar();
                    }
                }
            });
            inputMetaEditorView.setMetadataTableEditor(editor);
        }
        refreshTreeSchemaEditor(inputTree);
    }
}
Also used : ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) MetadataTableEditor(org.talend.core.ui.metadata.editor.MetadataTableEditor) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) EList(org.eclipse.emf.common.util.EList) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) IODataComponent(org.talend.core.model.components.IODataComponent) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)

Example 4 with IModifiedBeanListener

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

the class MapperManager method selectOutputXmlTree.

public void selectOutputXmlTree(OutputXmlTree outputTree) {
    if (outputTree != selectedOutputTree) {
        selectedOutputTree = outputTree;
        MetadataTableEditorView outputMetaEditorView = mapperUI.getTabFolderEditors().getOutputMetaEditorView();
        List<IMetadataTable> metadataList = getMapperComponent().getMetadataList();
        IMetadataTable table = null;
        for (int i = 0; i < metadataList.size(); i++) {
            if (outputTree.getName() != null && outputTree.getName().equals(metadataList.get(i).getTableName())) {
                table = metadataList.get(i);
                break;
            }
        }
        if (outputTree.isErrorReject()) {
            for (IMetadataColumn column : table.getListColumns()) {
                if (ERROR_REJECT_MESSAGE.equals(column.getLabel()) || ERROR_REJECT_STACK_TRACE.equals(column.getLabel())) {
                    column.setCustom(true);
                }
            }
            CustomTableManager.addCustomManagementToTable(mapperUI.getTabFolderEditors().getOutputMetaEditorView(), true);
        }
        if (table != null) {
            MetadataTableEditor editor = new MetadataTableEditor(table, table.getTableName());
            outputMetaEditorView.setMetadataTableEditor(editor);
            editor.setModifiedBeanListenable(outputMetaEditorView.getTableViewerCreator());
            IModifiedBeanListener<IMetadataColumn> columnListener = new IModifiedBeanListener<IMetadataColumn>() {

                @Override
                public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
                    fireCurrentDirectEditApply();
                    if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId())) {
                        if (event.index < selectedOutputTree.getNodes().size()) {
                            TreeNode treeNode = selectedOutputTree.getNodes().get(event.index);
                            if (treeNode != null) {
                                treeNode.setName((String) event.newValue);
                                processColumnNameChanged(treeNode);
                            }
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_TYPE.equals(event.column.getId())) {
                        if (event.index < selectedOutputTree.getNodes().size()) {
                            OutputTreeNode treeNode = selectedOutputTree.getNodes().get(event.index);
                            if (treeNode != null) {
                                String oldValue = treeNode.getType();
                                treeNode.setType((String) event.newValue);
                                if (oldValue != null && oldValue.equals(XmlMapUtil.DOCUMENT)) {
                                    XmlMapUtil.detachNodeConnections(treeNode, getExternalData(), true);
                                    List<TreeNode> removedLoops = new ArrayList<TreeNode>();
                                    if (mainInputTree != null && mainInputTree.isMultiLoops()) {
                                        XmlMapUtil.getChildLoops(removedLoops, treeNode.getChildren());
                                    }
                                    treeNode.getChildren().clear();
                                    selectedOutputTree.setMultiLoops(XmlMapUtil.checkMultiLoopsStatus(selectedOutputTree));
                                    if (mainInputTree != null && mainInputTree.isMultiLoops()) {
                                        if (XmlMapUtil.hasDocument(selectedOutputTree)) {
                                            XmlMapUtil.removeLoopTableForOutput(selectedOutputTree, removedLoops, mainInputTree == null ? false : mainInputTree.isMultiLoops());
                                        } else {
                                            selectedOutputTree.getInputLoopNodesTables().clear();
                                            selectedOutputTree.getInputLoopNodesTables().add(XmlmapFactory.eINSTANCE.createInputLoopNodesTable());
                                        }
                                    }
                                }
                                if (XmlMapUtil.DOCUMENT.equals(event.newValue)) {
                                    XmlMapUtil.detachNodeConnections(treeNode, getExternalData(), true);
                                    OutputTreeNode createTreeNode = XmlmapFactory.eINSTANCE.createOutputTreeNode();
                                    createTreeNode.setName("root");
                                    createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
                                    createTreeNode.setNodeType(NodeType.ELEMENT);
                                    createTreeNode.setXpath(XmlMapUtil.getXPath(treeNode.getXpath(), createTreeNode.getName(), createTreeNode.getNodeType()));
                                    createTreeNode.setLoop(true);
                                    createTreeNode.setMain(true);
                                    treeNode.getChildren().add(createTreeNode);
                                }
                                problemsAnalyser.checkProblems(selectedOutputTree);
                                mapperUI.updateStatusBar();
                                outputTreeSchemaBeanListModified();
                            }
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_KEY.equals(event.column.getId())) {
                        if (event.index < selectedOutputTree.getNodes().size()) {
                            TreeNode treeNode = selectedOutputTree.getNodes().get(event.index);
                            treeNode.setKey((Boolean) event.newValue);
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_PATTERN.equals(event.column.getId())) {
                        if (event.index < selectedOutputTree.getNodes().size()) {
                            TreeNode treeNode = selectedOutputTree.getNodes().get(event.index);
                            treeNode.setPattern((String) event.newValue);
                        }
                    } else if (AbstractMetadataTableEditorView.ID_COLUMN_NULLABLE.equals(event.column.getId())) {
                        if (event.index < selectedOutputTree.getNodes().size()) {
                            TreeNode treeNode = selectedOutputTree.getNodes().get(event.index);
                            treeNode.setNullable((Boolean) event.newValue);
                        }
                    }
                }
            };
            editor.addModifiedBeanListener(columnListener);
            editor.addAfterOperationListListener(new IListenableListListener() {

                @Override
                public void handleEvent(ListenableListEvent event) {
                    if (event.type == TYPE.ADDED) {
                        EList<OutputTreeNode> nodes = selectedOutputTree.getNodes();
                        List<IMetadataColumn> metadataColumns = (List<IMetadataColumn>) event.addedObjects;
                        if (event.index != null) {
                            int index = event.index;
                            for (IMetadataColumn column : metadataColumns) {
                                OutputTreeNode createTreeNode = XmlmapFactory.eINSTANCE.createOutputTreeNode();
                                createTreeNode.setName(column.getLabel());
                                createTreeNode.setType(column.getTalendType());
                                createTreeNode.setNullable(column.isNullable());
                                createTreeNode.setPattern(column.getPattern());
                                createTreeNode.setXpath(XmlMapUtil.getXPath(selectedOutputTree.getName(), createTreeNode.getName(), createTreeNode.getNodeType()));
                                selectedOutputTree.getNodes().add(index, createTreeNode);
                                index = index + 1;
                            }
                        }
                    } else if (event.type == TYPE.REMOVED) {
                        List<IMetadataColumn> metadataColumns = (List<IMetadataColumn>) event.removedObjects;
                        List treeNodeToRemove = new ArrayList();
                        for (IMetadataColumn column : metadataColumns) {
                            for (TreeNode node : selectedOutputTree.getNodes()) {
                                if (node.getName() != null && node.getName().equals(column.getLabel())) {
                                    XmlMapUtil.detachNodeConnections(node, getExternalData(), true);
                                    treeNodeToRemove.add(node);
                                }
                            }
                        }
                        selectedOutputTree.getNodes().removeAll(treeNodeToRemove);
                        problemsAnalyser.checkProblems(selectedOutputTree);
                        mapperUI.updateStatusBar();
                        outputTreeSchemaBeanListModified();
                    } else if (event.type == TYPE.SWAPED) {
                        List<Integer> listIndexTarget = event.indicesTarget;
                        List<Integer> listIndexOrignal = event.indicesOrigin;
                        for (int i = 0; i < listIndexOrignal.size(); i++) {
                            int orignal = listIndexOrignal.get(i);
                            int target = listIndexTarget.get(i);
                            if (orignal < selectedOutputTree.getNodes().size()) {
                                OutputTreeNode tempTreeNode = selectedOutputTree.getNodes().get(orignal);
                                selectedOutputTree.getNodes().remove(orignal);
                                selectedOutputTree.getNodes().add(target, tempTreeNode);
                            }
                        }
                    } else if (event.type == TYPE.REPLACED) {
                        // fix for TDI-24071
                        List added = (List) event.addedObjects;
                        List removed = (List) event.removedObjects;
                        List<IMetadataColumn> removedColumn = new ArrayList<IMetadataColumn>();
                        List<IMetadataColumn> addedColumn = new ArrayList<IMetadataColumn>();
                        if (!added.isEmpty()) {
                            addedColumn.addAll((List<IMetadataColumn>) added.get(0));
                        }
                        if (!removed.isEmpty()) {
                            removedColumn.addAll((List<IMetadataColumn>) removed.get(0));
                        }
                        Map<IMetadataColumn, OutputTreeNode> nodeMap = new HashMap<IMetadataColumn, OutputTreeNode>();
                        for (int i = 0; i < removedColumn.size(); i++) {
                            IMetadataColumn column = removedColumn.get(i);
                            OutputTreeNode node = selectedOutputTree.getNodes().get(i);
                            boolean found = false;
                            for (IMetadataColumn columnAdded : addedColumn) {
                                if (column.sameMetacolumnAs(columnAdded)) {
                                    nodeMap.put(columnAdded, node);
                                    found = true;
                                    break;
                                }
                            }
                            if (!found) {
                                XmlMapUtil.detachNodeConnections(node, getExternalData(), true);
                            }
                        }
                        // remove all
                        boolean needCheck = false;
                        if (selectedOutputTree.isMultiLoops()) {
                            needCheck = true;
                        }
                        selectedOutputTree.getNodes().clear();
                        // add all
                        for (IMetadataColumn column : addedColumn) {
                            OutputTreeNode treeNode = nodeMap.get(column);
                            if (treeNode == null) {
                                treeNode = XmlmapFactory.eINSTANCE.createOutputTreeNode();
                                treeNode.setName(column.getLabel());
                                treeNode.setType(column.getTalendType());
                                treeNode.setNullable(column.isNullable());
                                treeNode.setPattern(column.getPattern());
                                treeNode.setXpath(XmlMapUtil.getXPath(selectedInputTree.getName(), treeNode.getName(), treeNode.getNodeType()));
                                if (XmlMapUtil.DOCUMENT.equals(column.getTalendType())) {
                                    TreeNode createTreeNode = XmlmapFactory.eINSTANCE.createOutputTreeNode();
                                    createTreeNode.setName("root");
                                    createTreeNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
                                    createTreeNode.setNodeType(NodeType.ELEMENT);
                                    createTreeNode.setXpath(XmlMapUtil.getXPath(treeNode.getXpath(), createTreeNode.getName(), createTreeNode.getNodeType()));
                                    createTreeNode.setLoop(true);
                                    createTreeNode.setMain(true);
                                    treeNode.getChildren().add(createTreeNode);
                                }
                            }
                            selectedOutputTree.getNodes().add(treeNode);
                        }
                        if (needCheck) {
                            selectedOutputTree.setMultiLoops(XmlMapUtil.checkMultiLoopsStatus(selectedOutputTree));
                        }
                        mapperUI.updateStatusBar();
                        mapperUI.updateStatusBar();
                    }
                }
            });
        }
        refreshTreeSchemaEditor(outputTree);
    }
}
Also used : ListenableListEvent(org.talend.commons.utils.data.list.ListenableListEvent) MetadataTableEditor(org.talend.core.ui.metadata.editor.MetadataTableEditor) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) IListenableListListener(org.talend.commons.utils.data.list.IListenableListListener) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) EList(org.eclipse.emf.common.util.EList) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) MetadataTableEditorView(org.talend.core.ui.metadata.editor.MetadataTableEditorView) AbstractMetadataTableEditorView(org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)

Example 5 with IModifiedBeanListener

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

the class UIManager method modifySelectionChangedListener.

private void modifySelectionChangedListener(final Zone currentZone, final MetadataTableEditorView metadataTableEditorViewFinal, final TableViewerCreator metadataTVCreator, final MetadataTableEditor metadataTableEditor, final DataMapTableView dataMapTableView, DataMapTableView previousSelectedTableView) {
    final TableViewer tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
    IModifiedBeanListener<IMetadataColumn> modifiedBeanListener = new IModifiedBeanListener<IMetadataColumn>() {

        public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
            if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId()) && !event.previousValue.equals(event.newValue)) {
                IMetadataColumn modifiedObject = event.bean;
                if (modifiedObject != null) {
                    TableEntryLocation tableEntryLocation = new TableEntryLocation(dataMapTableView.getDataMapTable().getName(), (String) event.previousValue);
                    final ITableEntry dataMapTableEntry = mapperManager.retrieveTableEntry(tableEntryLocation);
                    // see bug 7471,record the modification about the column value
                    String curConnName = null;
                    if (dataMapTableEntry != null) {
                        curConnName = dataMapTableEntry.getParentName();
                    }
                    List<? extends IConnection> curInConns = mapperManager.getAbstractMapComponent().getIncomingConnections();
                    List<? extends IConnection> curOutConns = mapperManager.getAbstractMapComponent().getOutgoingConnections();
                    for (IConnection curInConn : curInConns) {
                        if (curConnName.equals(curInConn.getUniqueName())) {
                            Map<String, String> changedNameInColumns = new HashMap<String, String>();
                            changedNameInColumns.put((String) event.newValue, (String) event.previousValue);
                            changedNameColumns.put(curInConn, changedNameInColumns);
                        }
                    }
                    for (IConnection curOutConn : curOutConns) {
                        if (curConnName.equals(curOutConn.getUniqueName())) {
                            Map<String, String> changedNameOutColumns = new HashMap<String, String>();
                            changedNameOutColumns.put((String) event.newValue, (String) event.previousValue);
                            changedNameColumns.put(curOutConn, changedNameOutColumns);
                        }
                    }
                    processColumnNameChanged((String) event.previousValue, (String) event.newValue, dataMapTableView, dataMapTableEntry);
                    // related tables
                    List<DataMapTableView> relatedOutputsTableView = getRelatedOutputsTableView(dataMapTableView);
                    for (DataMapTableView relatedView : relatedOutputsTableView) {
                        TableEntryLocation relatedEntryLocation = new TableEntryLocation(relatedView.getDataMapTable().getName(), (String) event.previousValue);
                        ITableEntry relatedTableEntry = mapperManager.retrieveTableEntry(relatedEntryLocation);
                        processColumnNameChanged((String) event.previousValue, (String) event.newValue, relatedView, relatedTableEntry);
                    }
                }
                // dataMapTableViewer.refresh(event.bean, true);
                tableViewer.refresh(true);
            } else if (AbstractMetadataTableEditorView.ID_COLUMN_KEY.equals(event.column.getId())) {
                tableViewer.refresh(true);
                IColumnEntry entry = dataMapTableView.getDataMapTable().getColumnEntries().get(event.index);
                parseExpression(entry.getExpression(), entry, false, false, false);
            } else if (AbstractMetadataTableEditorView.ID_COLUMN_TYPE.equals(event.column.getId()) || AbstractMetadataTableEditorView.ID_COLUMN_NULLABLE.equals(event.column.getId())) {
                mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
            }
        }
    };
    ILineSelectionListener metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {

        public void handle(LineSelectionEvent e) {
            if (metadataTableEditorViewFinal.getTableViewerCreator() == e.source) {
                if (metadataTableEditorViewFinal.getExtendedTableViewer().isExecuteSelectionEvent()) {
                    mapperManager.getUiManager().selectLinkedTableEntries(metadataTableEditor.getMetadataTable(), metadataTVCreator.getTable().getSelectionIndices());
                }
            } else {
            // if (dataMapTableView.getExtendedTableViewerForColumns().isExecuteSelectionEvent()) {
            // int[] selectionIndices =
            // dataMapTableView.getTableViewerCreatorForColumns().getTable().getSelectionIndices();
            // mapperManager.getUiManager().selectLinkedMetadataEditorEntries(dataMapTableView,
            // selectionIndices);
            // }
            }
        }
    };
    // ISelectionChangedListener previousSelectionChangedListener = null;
    ILineSelectionListener previousSelectionChangedListener = null;
    IModifiedBeanListener<IMetadataColumn> previousModifiedBeanListener = null;
    if (currentZone == Zone.INPUTS) {
        previousSelectionChangedListener = inputsSelectionChangedListener;
        previousModifiedBeanListener = inputModifiedBeanListener;
    } else if (currentZone == Zone.OUTPUTS) {
        previousSelectionChangedListener = outputsSelectionChangedListener;
        previousModifiedBeanListener = outputModifiedBeanListener;
    }
    if (previousSelectionChangedListener != null) {
        // metadataTVCreator.removeSelectionChangedListener(previousSelectionChangedListener);
        metadataTVCreator.getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
        if (previousSelectedTableView != null) {
            previousSelectedTableView.getTableViewerCreatorForColumns().getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
        }
    }
    if (previousModifiedBeanListener != null) {
        metadataTableEditor.removeModifiedBeanListener(previousModifiedBeanListener);
    }
    if (currentZone == Zone.INPUTS) {
        inputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
        inputModifiedBeanListener = modifiedBeanListener;
    } else if (currentZone == Zone.OUTPUTS) {
        outputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
        outputModifiedBeanListener = modifiedBeanListener;
    }
    // metadataTVCreator.addSelectionChangedListener(metadataEditorViewerSelectionChangedListener);
    metadataTVCreator.getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    dataMapTableView.getTableViewerCreatorForColumns().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
    metadataTableEditor.addModifiedBeanListener(modifiedBeanListener);
    if (this.commonMetadataDisposeListener == null) {
        this.commonMetadataDisposeListener = new DisposeListener() {

            public void widgetDisposed(DisposeEvent e) {
                if (inputsSelectionChangedListener != null) {
                    getMetadataEditorView(Zone.INPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(inputsSelectionChangedListener);
                }
                if (outputsSelectionChangedListener != null) {
                    getMetadataEditorView(Zone.OUTPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(outputsSelectionChangedListener);
                }
                if (inputModifiedBeanListener != null) {
                    MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.INPUTS).getMetadataTableEditor();
                    if (metadataTableEditor != null) {
                        metadataTableEditor.removeModifiedBeanListener(inputModifiedBeanListener);
                    }
                }
                if (outputModifiedBeanListener != null) {
                    MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.OUTPUTS).getMetadataTableEditor();
                    if (metadataTableEditor != null) {
                        metadataTableEditor.removeModifiedBeanListener(outputModifiedBeanListener);
                    }
                }
            }
        };
        metadataTVCreator.getTable().addDisposeListener(this.commonMetadataDisposeListener);
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) MetadataTableEditor(org.talend.core.ui.metadata.editor.MetadataTableEditor) HashMap(java.util.HashMap) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) IConnection(org.talend.core.model.process.IConnection) InputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView) OutputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView) VarsDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) IModifiedBeanListener(org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener) IColumnEntry(org.talend.designer.abstractmap.model.tableentry.IColumnEntry) ILineSelectionListener(org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ModifiedBeanEvent(org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent) LineSelectionEvent(org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent) TableEntryLocation(org.talend.designer.mapper.model.tableentry.TableEntryLocation) TableViewer(org.eclipse.jface.viewers.TableViewer)

Aggregations

IModifiedBeanListener (org.talend.commons.ui.swt.tableviewer.IModifiedBeanListener)5 ModifiedBeanEvent (org.talend.commons.ui.swt.tableviewer.ModifiedBeanEvent)5 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)4 MetadataTableEditor (org.talend.core.ui.metadata.editor.MetadataTableEditor)4 HashMap (java.util.HashMap)3 TableViewer (org.eclipse.jface.viewers.TableViewer)3 DisposeEvent (org.eclipse.swt.events.DisposeEvent)3 DisposeListener (org.eclipse.swt.events.DisposeListener)3 ILineSelectionListener (org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener)3 LineSelectionEvent (org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent)3 IListenableListListener (org.talend.commons.utils.data.list.IListenableListListener)3 ListenableListEvent (org.talend.commons.utils.data.list.ListenableListEvent)3 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)3 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)3 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 EList (org.eclipse.emf.common.util.EList)2 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)2 AbstractMetadataTableEditorView (org.talend.core.ui.metadata.editor.AbstractMetadataTableEditorView)2