Search in sources :

Example 16 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode in project tdq-studio-se by Talend.

the class SchemaAnalysisDPSelectionPage method addListeners.

@Override
protected void addListeners() {
    addListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
            if (object instanceof Schema) {
                advanceToNextPageOrFinish();
            }
        }
    });
    addListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
            PackagesAnalyisParameter schemaPanameter = (PackagesAnalyisParameter) getConnectionParams();
            List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
            if (object instanceof DBSchemaRepNode) {
                DBSchemaRepNode schemaNode = (DBSchemaRepNode) object;
                Schema schema = ((MetadataSchemaRepositoryObject) schemaNode.getObject()).getSchema();
                Connection tdProvider = ConnectionHelper.getTdDataProvider(SwitchHelpers.PACKAGE_SWITCH.doSwitch(schema));
                RepositoryNode parent = schemaNode.getParent();
                if (tdProvider != null && schemaPanameter != null) {
                    if (parent instanceof DBCatalogRepNode) {
                        schemaPanameter.setConnectionRepNode((DBConnectionRepNode) parent.getParent());
                    } else {
                        schemaPanameter.setConnectionRepNode((DBConnectionRepNode) parent);
                    }
                    schemaPanameter.setTdDataProvider(tdProvider);
                }
                nodes.add(schemaNode);
                schemaPanameter.setPackages(nodes);
                setPageComplete(true);
            } else {
                setPageComplete(false);
            }
        }
    });
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Schema(orgomg.cwm.resource.relational.Schema) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Connection(org.talend.core.model.metadata.builder.connection.Connection) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject) ArrayList(java.util.ArrayList) List(java.util.List)

Example 17 with DBCatalogRepNode

use of org.talend.dq.nodes.DBCatalogRepNode in project tdq-studio-se by Talend.

the class ColumnsSelectionDialog method handleTreeExpanded.

/**
 * Added TDQ-8718 20140506 yyin: when expand the nodes in the column select dialog, should refresh the table/view
 * folder. otherwise: if the parent catalog is checked before expanding, it may get no children(without connecting
 * to db) If the user has checked some high level node, must refresh the table/view folder node. otherwise, it
 * always return 0
 */
@Override
protected void handleTreeExpanded(TreeItem item) {
    Object node = item.getData();
    if (node instanceof DBCatalogRepNode || node instanceof DBSchemaRepNode) {
        TreeItem[] children = item.getItems();
        if (children != null) {
            for (TreeItem child : children) {
                Object data = child.getData();
                if (data != null) {
                    if (!(data instanceof DQDBFolderRepositoryNode)) {
                        break;
                    } else {
                        getTreeViewer().refresh(data, true);
                    }
                }
            }
        }
    }
    super.handleTreeExpanded(item);
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) TreeItem(org.eclipse.swt.widgets.TreeItem) DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode)

Aggregations

DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)17 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)13 IRepositoryNode (org.talend.repository.model.IRepositoryNode)11 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)9 ArrayList (java.util.ArrayList)8 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)6 List (java.util.List)5 Connection (org.talend.core.model.metadata.builder.connection.Connection)5 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)4 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)4 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)4 PackagesAnalyisParameter (org.talend.dq.analysis.parameters.PackagesAnalyisParameter)4 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)4 Catalog (orgomg.cwm.resource.relational.Catalog)4 ExchangeCategoryRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode)3 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)3