Search in sources :

Example 11 with DBCatalogRepNode

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

the class ExportConnecitonActionProvider method fillContextMenu.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
     */
@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    List<Object> selectionList = ((TreeSelection) this.getContext().getSelection()).toList();
    List<Package> packList = new ArrayList<Package>();
    boolean showMenu = false;
    for (Object obj : selectionList) {
        if (obj instanceof DBCatalogRepNode || obj instanceof DBSchemaRepNode) {
            // MOD gdbu 2011-12-29 TDQ-4281 Remove the "create a new connection" menu under
            // AnalysisSubFolderRepNode.
            RepositoryNode node = (RepositoryNode) obj;
            if (node.getParent() instanceof AnalysisSubFolderRepNode) {
                return;
            }
            // ~TDQ-4281
            ModelElement me = RepositoryNodeHelper.getModelElementFromRepositoryNode(node);
            if (me != null && me instanceof Package) {
                Package pack = (Package) me;
                packList.add(pack);
                showMenu = true;
            }
        }
    }
    if (showMenu) {
        ExportConnectionToTOSAction action = new ExportConnectionToTOSAction(packList);
        menu.add(action);
    }
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) ExportConnectionToTOSAction(org.talend.dataprofiler.core.ui.action.actions.ExportConnectionToTOSAction) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) Package(orgomg.cwm.objectmodel.core.Package)

Example 12 with DBCatalogRepNode

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

the class DQRepositoryViewLabelProvider method getImage.

@Override
public Image getImage(Object element) {
    Image image = super.getImage(element);
    if (element instanceof IRepositoryNode) {
        IRepositoryNode node = (IRepositoryNode) element;
        if (node instanceof ReportAnalysisRepNode) {
            image = ImageLib.getImage(ImageLib.ANALYSIS_OBJECT);
        } else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
            image = ImageLib.getImage(ImageLib.EXCHANGE);
        } else if (node instanceof RecycleBinRepNode) {
            image = ImageLib.getImage(ImageLib.RECYCLEBIN_EMPTY);
        } else {
            IRepositoryViewObject viewObject = node.getObject();
            ENodeType type = node.getType();
            if (type.equals(ENodeType.SYSTEM_FOLDER)) {
                if (EResourceConstant.REFERENCED_PROJECT.getName().equals(node.getProperties(EProperties.LABEL))) {
                    image = ImageLib.getImage(ImageLib.REFERENCED_PROJECT);
                } else {
                    String label = viewObject.getLabel();
                    if (label.equals(EResourceConstant.DATA_PROFILING.getName())) {
                        image = ImageLib.getImage(ImageLib.DATA_PROFILING);
                    } else if (label.equals(EResourceConstant.METADATA.getName())) {
                        image = ImageLib.getImage(ImageLib.METADATA);
                    } else if (node instanceof DBConnectionFolderRepNode) {
                        image = ImageLib.getImage(ImageLib.CONNECTION);
                    } else if (label.equals(EResourceConstant.FILEDELIMITED.getName())) {
                        image = ImageLib.getImage(ImageLib.FILE_DELIMITED);
                    } else if (label.equals(EResourceConstant.LIBRARIES.getName())) {
                        image = ImageLib.getImage(ImageLib.LIBRARIES);
                    } else if (label.equals(EResourceConstant.EXCHANGE.getName())) {
                        image = ImageLib.getImage(ImageLib.EXCHANGE);
                    } else if (label.equals(EResourceConstant.HADOOP_CLUSTER.getName())) {
                        image = ImageLib.getImage(ImageLib.HADOOP_CLUSTER);
                    } else if (label.equals(EResourceConstant.CONTEXT.getName())) {
                        image = ImageLib.getImage(ImageLib.CONTEXT);
                    } else {
                        image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
                    }
                }
            } else if (type.equals(ENodeType.SIMPLE_FOLDER)) {
                image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
            } else if (type.equals(ENodeType.REFERENCED_PROJECT)) {
                image = ImageLib.getImage(ImageLib.REFERENCED_PROJECT);
            } else if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
                // TDQ-7560 when the image is a overlay image,use originalImageName to get the corresponding one.
                String originalImageName = null;
                if (node instanceof DBConnectionRepNode) {
                    originalImageName = ImageLib.TD_DATAPROVIDER;
                    if (!RepositoryNodeHelper.isSupportedConnection(node) || isNeedAddDriverConnection(node)) {
                        image = ImageLib.createErrorIcon(originalImageName);
                    } else if (isInvalidJDBCConnection(node)) {
                        image = ImageLib.createInvalidIcon(originalImageName);
                    } else {
                        image = ImageLib.getImage(originalImageName);
                    }
                } else if (node instanceof DFConnectionRepNode) {
                    originalImageName = ImageLib.FILE_DELIMITED;
                } else if (node instanceof AnalysisRepNode) {
                    originalImageName = ImageLib.ANALYSIS_OBJECT;
                    image = addWarnIconIfNeeded(node, originalImageName);
                } else if (node instanceof ReportRepNode) {
                    originalImageName = ImageLib.REPORT_OBJECT;
                    image = addWarnIconIfNeeded(node, originalImageName);
                } else if (node instanceof SysIndicatorDefinitionRepNode) {
                    originalImageName = ImageLib.IND_DEFINITION;
                } else if (node instanceof PatternRepNode) {
                    originalImageName = ImageLib.PATTERN_REG;
                } else if (node instanceof RuleRepNode) {
                    if (((RuleRepNode) node).getRule() instanceof MatchRuleDefinition) {
                        originalImageName = ImageLib.MATCH_RULE_ICON;
                    } else {
                        originalImageName = ImageLib.DQ_RULE;
                    }
                } else if (node instanceof SourceFileRepNode) {
                    originalImageName = ImageLib.SOURCE_FILE;
                } else if (node instanceof HadoopClusterConnectionRepNode) {
                    originalImageName = ImageLib.HADOOP_CLUSTER;
                } else if (node instanceof HDFSOfHCConnectionNode) {
                    originalImageName = ImageLib.HDFS;
                } else if (node instanceof HiveOfHCConnectionNode) {
                    originalImageName = ImageLib.HIVE_LINK;
                } else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
                    originalImageName = ImageLib.EXCHANGE;
                } else if (node instanceof ContextRepNode) {
                    originalImageName = ImageLib.CONTEXT;
                } else if (node instanceof RepositoryNode) {
                    // MOD qiongli 2011-1-18 get image for nodes in recycle bin
                    Image imageNode = getImageByContentType((RepositoryNode) node);
                    if (image != null) {
                        image = imageNode;
                    }
                }
                if (originalImageName != null && !(node instanceof DBConnectionRepNode || node instanceof AnalysisRepNode || node instanceof ReportRepNode)) {
                    image = ImageLib.getImage(originalImageName);
                }
                // exchange folder did not contain viewObject.
                if (viewObject != null) {
                    // MOD yyi 2011-04-07 19696: "Lock element"
                    ERepositoryStatus status = ProxyRepositoryFactory.getInstance().getStatus(viewObject);
                    Context ctx = CoreRuntimePlugin.getInstance().getContext();
                    RepositoryContext rc = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
                    // will be enhanced later by TDI-29265.
                    if (rc.isEditableAsReadOnly()) {
                        if (status == ERepositoryStatus.LOCK_BY_USER) {
                            status = ERepositoryStatus.DEFAULT;
                        }
                    }
                    if (ERepositoryStatus.DEFAULT != status && originalImageName != null) {
                        if (ERepositoryStatus.LOCK_BY_USER == status) {
                            image = ImageLib.createLockedByOwnIcon(originalImageName);
                        } else if (ERepositoryStatus.LOCK_BY_OTHER == status) {
                            image = ImageLib.createLockedByOtherIcon(originalImageName);
                        }
                    }
                }
            } else if (type.equals(ENodeType.TDQ_REPOSITORY_ELEMENT)) {
                if (node instanceof DBCatalogRepNode) {
                    image = ImageLib.getImage(ImageLib.CATALOG);
                } else if (node instanceof DBSchemaRepNode) {
                    image = ImageLib.getImage(ImageLib.SCHEMA);
                } else if (node instanceof DBTableFolderRepNode) {
                    image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
                } else if (node instanceof DBViewFolderRepNode) {
                    image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
                } else if (node instanceof DBTableRepNode || node instanceof DFTableRepNode) {
                    image = ImageLib.getImage(ImageLib.TABLE);
                } else if (node instanceof DBViewRepNode) {
                    image = ImageLib.getImage(ImageLib.VIEW);
                } else if (node instanceof DBColumnRepNode) {
                    if (((DBColumnRepNode) node).isKey()) {
                        image = ImageLib.getImage(ImageLib.PK_COLUMN);
                    } else {
                        image = ImageLib.getImage(ImageLib.TD_COLUMN);
                    }
                } else if (node instanceof DFColumnRepNode) {
                    image = ImageLib.getImage(ImageLib.TD_COLUMN);
                } else if (node instanceof DBColumnFolderRepNode || node instanceof DFColumnFolderRepNode) {
                    image = ImageLib.getImage(ImageLib.FOLDERNODE_IMAGE);
                } else if (node instanceof JrxmlTempleteRepNode) {
                    image = ImageLib.getImage(ImageLib.JRXML_ICON);
                }
            }
        }
    }
    return image;
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) RepositoryContext(org.talend.core.context.RepositoryContext) HDFSOfHCConnectionNode(org.talend.dq.nodes.hadoopcluster.HDFSOfHCConnectionNode) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) Image(org.eclipse.swt.graphics.Image) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) DFTableRepNode(org.talend.dq.nodes.DFTableRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) PatternRepNode(org.talend.dq.nodes.PatternRepNode) AnalysisContext(org.talend.dataquality.analysis.AnalysisContext) Context(org.talend.core.context.Context) RepositoryContext(org.talend.core.context.RepositoryContext) DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DFColumnFolderRepNode(org.talend.dq.nodes.DFColumnFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) HiveOfHCConnectionNode(org.talend.dq.nodes.hadoopcluster.HiveOfHCConnectionNode) RuleRepNode(org.talend.dq.nodes.RuleRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) RecycleBinRepNode(org.talend.dq.nodes.RecycleBinRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) HadoopClusterConnectionRepNode(org.talend.dq.nodes.hadoopcluster.HadoopClusterConnectionRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) ContextRepNode(org.talend.dq.nodes.ContextRepNode)

Example 13 with DBCatalogRepNode

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

the class ResourceViewContentProvider method hasChildren.

@Override
public boolean hasChildren(Object element) {
    try {
        if (element instanceof IRepositoryNode) {
            IRepositoryNode node = (IRepositoryNode) element;
            IRepositoryViewObject viewObject = node.getObject();
            if (viewObject instanceof MetadataColumnRepositoryObject) {
                return false;
            } else if (node instanceof ExchangeFolderRepNode || node instanceof ExchangeCategoryRepNode || node instanceof SysIndicatorFolderRepNode || element instanceof DBTableRepNode || element instanceof DBViewRepNode || element instanceof DBCatalogRepNode || element instanceof DBSchemaRepNode) {
                // ExchangeCategoryRepNode always have children
                return true;
            } else if (node instanceof ExchangeComponentRepNode) {
                // ExchangeComponentRepNode always don't have children
                return false;
            } else if (element instanceof DBTableFolderRepNode) {
                // MOD gdbu 2011-9-1 TDQ-3457
                if (DQRepositoryNode.isOnFilterring()) {
                    return true;
                }
                DBTableFolderRepNode dbTableFolder = (DBTableFolderRepNode) element;
                return dbTableFolder.hasChildren();
            } else if (element instanceof DBViewFolderRepNode) {
                if (DQRepositoryNode.isOnFilterring()) {
                    return true;
                }
                DBViewFolderRepNode dbViewFolder = (DBViewFolderRepNode) element;
                return dbViewFolder.hasChildren();
            // ~TDQ-3457
            }
        } else if (element instanceof IEcosCategory) {
            return true;
        }
    // // MOD qiongli feature 9486
    // if (element instanceof IFolder) {
    // // MOD yyi 2010-09-30 15271: svn project can't load exchange nodes
    // if (ResourceManager.isExchangeFolder((IFolder) element)) {
    // return true;
    // }
    // // ~15271
    // List<Object> obsLs = Arrays.asList(super.getChildren(element));
    // if (obsLs.size() == 1) {
    // Object obj = (Object) obsLs.get(0);
    // if (obj instanceof IFolder && ((IFolder) obj).getName().equals(PluginConstant.SVN_SUFFIX))
    // return false;
    // }
    // } else if (element instanceof DQRecycleBinNode) {
    // DQRecycleBinNode rbn = (DQRecycleBinNode) element;
    // Object obj = rbn.getObject();
    // if (obj instanceof IFolder) {
    // try {
    // return ((IFolder) obj).members().length > 0;
    // } catch (CoreException e) {
    // log.error(e);
    // }
    // }
    // return false;
    // }
    } catch (MissingDriverException e) {
        if (PluginChecker.isOnlyTopLoaded()) {
            MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // $NON-NLS-1$
            DefaultMessagesImpl.getString("ResourceViewContentProvider.warining"), e.getErrorMessage());
        } else {
            log.error(e, e);
        }
        return false;
    }
    return super.hasChildren(element);
}
Also used : DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ExchangeFolderRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode) IEcosCategory(org.talend.dataprofiler.ecos.model.IEcosCategory) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) SysIndicatorFolderRepNode(org.talend.dq.nodes.SysIndicatorFolderRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) MissingDriverException(org.talend.utils.exceptions.MissingDriverException) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode)

Example 14 with DBCatalogRepNode

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

the class RespositoryDetailView method selectionChanged.

/*
     * (non-Javadoc)
     * 
     * @seeorg.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui. IWorkbenchPart,
     * org.eclipse.jface.viewers.ISelection)
     */
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    clearContainer();
    boolean isNeedcreateDefault = true;
    try {
        if (part instanceof DQRespositoryView) {
            StructuredSelection sel = (StructuredSelection) selection;
            // MOD by zshen for bug 15750 TODO 39(13) make Detail View can be used.
            Object fe = sel.getFirstElement();
            // MOD klliu 2011-02-24 if choose diffirent node ,that will load diffirent child ,so that not use up.
            if (fe instanceof AnalysisRepNode || fe instanceof ReportRepNode || fe instanceof SysIndicatorDefinitionRepNode || fe instanceof PatternRepNode || fe instanceof RuleRepNode) {
                fe = ((IRepositoryNode) fe).getObject();
            }
            if (fe instanceof IFile) {
                IFile fe2 = (IFile) fe;
                isNeedcreateDefault = createFileDetail(isNeedcreateDefault, fe2);
            } else if (fe instanceof IRepositoryViewObject) {
                isNeedcreateDefault = createFileDetail(isNeedcreateDefault, (IRepositoryViewObject) fe);
            } else if (fe instanceof DBConnectionRepNode) {
                DBConnectionRepNode connNode = (DBConnectionRepNode) fe;
                // MOD sizhaoliu TDQ-6316
                ConnectionItem connectionItem = (ConnectionItem) connNode.getObject().getProperty().getItem();
                createDataProviderDetail(connectionItem);
                isNeedcreateDefault = false;
            } else if (fe instanceof DBCatalogRepNode) {
                DBCatalogRepNode catalogNode = (DBCatalogRepNode) fe;
                Catalog catalog = catalogNode.getCatalog();
                createTdCatalogDetail(catalog);
                isNeedcreateDefault = false;
            } else if (fe instanceof DBSchemaRepNode) {
                DBSchemaRepNode schemaNode = (DBSchemaRepNode) fe;
                Schema schema = schemaNode.getSchema();
                createTdSchemaDetail(schema);
                isNeedcreateDefault = false;
            } else if (fe instanceof DBTableRepNode) {
                DBTableRepNode tableNode = (DBTableRepNode) fe;
                // MOD gdbu 2011-9-14 TDQ-3243
                if (!DQRepositoryNode.isOnFilterring()) {
                    tableNode.getChildren().get(0).getChildren();
                }
                // ~TDQ-3243
                TdTable tdTable = tableNode.getTdTable();
                createTableDetail(tdTable);
                isNeedcreateDefault = false;
            } else if (fe instanceof DBViewRepNode) {
                DBViewRepNode viewNode = (DBViewRepNode) fe;
                // MOD gdbu 2011-9-14 TDQ-3243
                if (!DQRepositoryNode.isOnFilterring()) {
                    viewNode.getChildren().get(0).getChildren();
                }
                // ~TDQ-3243
                createNameCommentDetail(viewNode.getTdView());
                isNeedcreateDefault = false;
            } else if (fe instanceof DBColumnRepNode) {
                DBColumnRepNode columnNode = (DBColumnRepNode) fe;
                TdColumn column = columnNode.getTdColumn();
                createTdColumn(column);
                isNeedcreateDefault = false;
            } else if (fe instanceof IEcosComponent) {
                IEcosComponent component = (IEcosComponent) fe;
                createEcosComponent(component);
                isNeedcreateDefault = false;
            } else if (fe instanceof RegularExpression) {
                // MOD mzhao 2009-04-20,Bug 6349.
                RegularExpression regularExpression = (RegularExpression) fe;
                createRegularExpression(regularExpression);
                isNeedcreateDefault = false;
            } else if (fe instanceof PatternLanguageRepNode) {
                // MOD mzhao 2012-08-15,feature TDQ-4037.
                PatternLanguageRepNode pattLangNode = (PatternLanguageRepNode) fe;
                createRegularExpression(pattLangNode.getRegularExpression());
                isNeedcreateDefault = false;
            } else if (fe instanceof SourceFileRepNode) {
                // MOD klliu 2001-02-28 bug 19154
                IPath filePath = WorkbenchUtils.getFilePath((SourceFileRepNode) fe);
                DQRepositoryNode node = (DQRepositoryNode) fe;
                IFile file = ResourceManager.getRoot().getProject(node.getProject().getTechnicalLabel()).getFile(filePath);
                createSqlFileDetail(file);
            } else if (fe instanceof ExchangeComponentRepNode) {
                // MOD klliu 2001-02-28 bug 19154
                IEcosComponent ecosComponent = ((ExchangeComponentRepNode) fe).getEcosComponent();
                IEcosComponent component = ecosComponent;
                createEcosComponent(component);
                isNeedcreateDefault = false;
            // ADD by msjian 2011-5-12 21186: don't check whether the selected object is "MDMConnectionRepNode"
            } else if (fe instanceof DFConnectionRepNode) {
                DFConnectionRepNode dfNode = (DFConnectionRepNode) fe;
                DelimitedFileConnection dfConnection = dfNode.getDfConnection();
                createDFconnectionName(dfNode.getObject().getLabel());
                createDataProviderDetail(dfConnection);
                isNeedcreateDefault = false;
            }
            if (PluginChecker.isTDQLoaded()) {
                if (fe instanceof EObject) {
                    createTechnicalDetail((EObject) fe);
                } else if (fe instanceof IFile) {
                    createTechnicalDetail((IFile) fe);
                } else if (fe instanceof IRepositoryViewObject) {
                    createTechnicalDetail((IRepositoryViewObject) fe);
                } else {
                    createExtDefault();
                }
            }
            if (!scomp.isDisposed()) {
                scomp.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                composite.layout();
            }
        } else if (part instanceof CommonFormEditor) {
            CommonFormEditor editor = (CommonFormEditor) part;
            IEditorInput editorInput = editor.getEditorInput();
            if (editorInput instanceof IFileEditorInput) {
                IFileEditorInput input = (IFileEditorInput) editorInput;
                IFile file = input.getFile();
                isNeedcreateDefault = createFileDetail(isNeedcreateDefault, file);
            }
        }
        if (isNeedcreateDefault) {
            createDefault();
        }
        // feature 19053
        if (!gContainer.isDisposed()) {
            gContainer.layout();
            if (tContainer != null) {
                tContainer.layout();
            }
        }
    } catch (MissingDriverException e) {
        if (PluginChecker.isOnlyTopLoaded()) {
            MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // $NON-NLS-1$
            DefaultMessagesImpl.getString("RespositoryDetailView.warning"), e.getErrorMessage());
        } else {
            log.error(e, e);
        }
    }
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) IFile(org.eclipse.core.resources.IFile) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Schema(orgomg.cwm.resource.relational.Schema) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) PatternLanguageRepNode(org.talend.dq.nodes.PatternLanguageRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) IFileEditorInput(org.eclipse.ui.IFileEditorInput) EObject(org.eclipse.emf.ecore.EObject) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) PatternRepNode(org.talend.dq.nodes.PatternRepNode) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) TdTable(org.talend.cwm.relational.TdTable) IPath(org.eclipse.core.runtime.IPath) DelimitedFileConnection(org.talend.core.model.metadata.builder.connection.DelimitedFileConnection) RuleRepNode(org.talend.dq.nodes.RuleRepNode) Catalog(orgomg.cwm.resource.relational.Catalog) CommonFormEditor(org.talend.dataprofiler.core.ui.editor.CommonFormEditor) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) MissingDriverException(org.talend.utils.exceptions.MissingDriverException) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) TdColumn(org.talend.cwm.relational.TdColumn) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEcosComponent(org.talend.dataprofiler.ecos.model.IEcosComponent) EObject(org.eclipse.emf.ecore.EObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IEditorInput(org.eclipse.ui.IEditorInput)

Example 15 with DBCatalogRepNode

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

the class AnalyzeColumnSetAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    PackagesAnalyisParameter packaFilterParameter = new PackagesAnalyisParameter();
    if (nodeColumns != null) {
        DQRepositoryNode tFolder = (DQRepositoryNode) nodeColumns.getParent();
        if (tFolder != null) {
            IRepositoryNode node = tFolder.getParent();
            if (node instanceof DBCatalogRepNode) {
                IRepositoryNode connNode = ((DBCatalogRepNode) node).getParent();
                packaFilterParameter.setConnectionRepNode(connNode);
                catalogs.add(node);
                packaFilterParameter.setPackages(catalogs);
            } else if (node instanceof DBSchemaRepNode) {
                schemaNode = (DBSchemaRepNode) node;
                RepositoryNode parent = schemaNode.getParent();
                if (parent instanceof DBCatalogRepNode) {
                    catalogs.add(parent);
                    packaFilterParameter.setConnectionRepNode(parent);
                } else {
                    catalogs.add(schemaNode);
                    packaFilterParameter.setConnectionRepNode(schemaNode);
                }
                packaFilterParameter.setPackages(catalogs);
            }
        }
    }
    if (needselection) {
        IRepositoryNode firstElement = (RepositoryNode) this.selection.getFirstElement();
        IRepositoryViewObject viewObject = firstElement.getObject();
        Item item = viewObject.getProperty().getItem();
        ConnectionItem connectionItem = (ConnectionItem) item;
        Connection connection = connectionItem.getConnection();
        IRepositoryNode repositoryNode = RepositoryNodeHelper.recursiveFind(connection);
        packaFilterParameter.setConnectionRepNode(repositoryNode);
    }
    if (opencolumnSetAnalysisDialog(packaFilterParameter) == Window.OK) {
        AnalysisEditor editor = (AnalysisEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
        if (editor != null) {
            ColumnSetAnalysisDetailsPage page = (ColumnSetAnalysisDetailsPage) editor.getMasterPage();
            if (this.needselection && !this.selection.isEmpty()) {
                IRepositoryNode[] nodeArray = new IRepositoryNode[selection.size()];
                Iterator it = this.selection.iterator();
                int i = 0;
                while (it.hasNext()) {
                    nodeArray[i] = (IRepositoryNode) it.next();
                    i++;
                }
                page.setTreeViewInput(nodeArray);
            } else if (!this.needselection && null != this.nodeColumns) {
                List<IRepositoryNode> column = new ArrayList<IRepositoryNode>();
                for (IRepositoryNode columnFolder : nodeColumns.getChildren()) {
                    if (columnFolder instanceof DBColumnFolderRepNode) {
                        column.addAll(columnFolder.getChildren());
                    }
                }
                page.setTreeViewInput(column.toArray());
            }
            page.doSave(null);
        }
    }
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Connection(org.talend.core.model.metadata.builder.connection.Connection) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) ColumnSetAnalysisDetailsPage(org.talend.dataprofiler.core.ui.editor.analysis.ColumnSetAnalysisDetailsPage) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) AnalysisEditor(org.talend.dataprofiler.core.ui.editor.analysis.AnalysisEditor)

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