Search in sources :

Example 1 with ExchangeFolderRepNode

use of org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode 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 2 with ExchangeFolderRepNode

use of org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode in project tdq-studio-se by Talend.

the class RepositoryNodeBuilder method createRepositoryNode.

private RepositoryNode createRepositoryNode(IRepositoryViewObject folder, RepositoryNode parentNode, EResourceConstant resConstant, org.talend.core.model.general.Project inWhichProject) throws PersistenceException {
    DQRepositoryNode subFolderNode = null;
    switch(resConstant) {
        case ANALYSIS:
            AnalysisFolderRepNode anaFolderNode = new AnalysisFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(anaFolderNode);
            parentNode.getChildren().add(anaFolderNode);
            return anaFolderNode;
        case REPORTS:
            ReportFolderRepNode repFolderNode = new ReportFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(repFolderNode);
            parentNode.getChildren().add(repFolderNode);
            return repFolderNode;
        case INDICATORS:
            IndicatorFolderRepNode indicatorFolderRepNode = new IndicatorFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(indicatorFolderRepNode);
            parentNode.getChildren().add(indicatorFolderRepNode);
            return indicatorFolderRepNode;
        case JRXML_TEMPLATE:
            JrxmlTempFolderRepNode jrxmlFolderNode = new JrxmlTempFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(jrxmlFolderNode);
            parentNode.getChildren().add(jrxmlFolderNode);
            return jrxmlFolderNode;
        case SOURCE_FILES:
            SourceFileFolderRepNode sourceFileFolder = new SourceFileFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(sourceFileFolder);
            parentNode.getChildren().add(sourceFileFolder);
            return sourceFileFolder;
        case PATTERNS:
            PatternFolderRepNode patternFolder = new PatternFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(patternFolder);
            parentNode.getChildren().add(patternFolder);
            return patternFolder;
        case RULES:
            RulesFolderRepNode ruleFolder = new RulesFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(ruleFolder);
            parentNode.getChildren().add(ruleFolder);
            return ruleFolder;
        case DB_CONNECTIONS:
            DBConnectionFolderRepNode dbFolder = new DBConnectionFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(dbFolder);
            parentNode.getChildren().add(dbFolder);
            return dbFolder;
        case FILEDELIMITED:
            DFConnectionFolderRepNode dfmFolder = new DFConnectionFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(dfmFolder);
            parentNode.getChildren().add(dfmFolder);
            return dfmFolder;
        case HADOOP_CLUSTER:
            if (HadoopClusterUtils.getDefault().isServiceInstalled()) {
                HadoopClusterFolderRepNode hcFolder = new HadoopClusterFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
                folder.setRepositoryNode(hcFolder);
                parentNode.getChildren().add(hcFolder);
                return hcFolder;
            }
        case EXCHANGE:
            ExchangeFolderRepNode exchangeFolder = new ExchangeFolderRepNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(exchangeFolder);
            parentNode.getChildren().add(exchangeFolder);
            return exchangeFolder;
        default:
            subFolderNode = new DQRepositoryNode(folder, parentNode, ENodeType.SYSTEM_FOLDER, inWhichProject);
            folder.setRepositoryNode(subFolderNode);
            parentNode.getChildren().add(subFolderNode);
            if (resConstant.equals(EResourceConstant.PATTERNS)) {
                // MOD gdbu 2011-8-26 bug 23303 : initialization regex and sql folder when initialization pattern folder
                createRepositoryNodeSubSystemFolder(subFolderNode, EResourceConstant.PATTERN_REGEX, inWhichProject);
                createRepositoryNodeSubSystemFolder(subFolderNode, EResourceConstant.PATTERN_SQL, inWhichProject);
            }
            break;
    }
    return subFolderNode;
}
Also used : DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) IndicatorFolderRepNode(org.talend.dq.nodes.IndicatorFolderRepNode) SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) JrxmlTempFolderRepNode(org.talend.dq.nodes.JrxmlTempFolderRepNode) HadoopClusterFolderRepNode(org.talend.dq.nodes.hadoopcluster.HadoopClusterFolderRepNode) PatternFolderRepNode(org.talend.dq.nodes.PatternFolderRepNode) RulesFolderRepNode(org.talend.dq.nodes.RulesFolderRepNode) ReportFolderRepNode(org.talend.dq.nodes.ReportFolderRepNode) AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode) ExchangeFolderRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DFConnectionFolderRepNode(org.talend.dq.nodes.DFConnectionFolderRepNode)

Example 3 with ExchangeFolderRepNode

use of org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode in project tdq-studio-se by Talend.

the class CreateNewRepositoryNodeFolder method fillContextMenu.

/**
 * Adds a submenu to the given menu with the name "New Component".
 */
@Override
public void fillContextMenu(IMenuManager menu) {
    if (!isShowMenu()) {
        return;
    }
    // ADD msjian TDQ-10444: fix get error when click on the exchange node
    if (isExchangeNode()) {
        return;
    }
    // TDQ-10444~
    Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
    RepositoryNode node = (RepositoryNode) obj;
    RepositoryNode parent = node.getParent();
    if (!(parent instanceof ReportSubFolderRepNode)) {
        if (parent != null || node instanceof ContextFolderRepNode) {
            IFolder folder = WorkbenchUtils.getFolder(node);
            if (!(node instanceof ExchangeFolderRepNode) && !ResourceManager.getRulesFolder().equals(folder) && !ResourceManager.getPatternFolder().equals(folder) && !ResourceManager.getIndicatorFolder().equals(folder) && !ResourceService.isSubFolder(ResourceManager.getSystemIndicatorFolder(), folder) && (ENodeType.SYSTEM_FOLDER.equals(node.getType()) || ENodeType.SIMPLE_FOLDER.equals(node.getType())) && !(node instanceof HDFSOfHCFolderRepNode || node instanceof HiveOfHCFolderRepNode)) {
                // MOD qiongli 2011-1-20 don't add it for recycle bin elements
                if (node.getObject() != null && !node.getObject().getProperty().getItem().getState().isDeleted()) {
                    currentSelection = WorkbenchUtils.getFolder(node);
                    CreateRepositoryNodeAction createSubFolderAction = new CreateRepositoryNodeAction(currentSelection);
                    menu.add(createSubFolderAction);
                }
            }
        }
    }
}
Also used : HDFSOfHCFolderRepNode(org.talend.dq.nodes.hadoopcluster.HDFSOfHCFolderRepNode) HiveOfHCFolderRepNode(org.talend.dq.nodes.hadoopcluster.HiveOfHCFolderRepNode) CreateRepositoryNodeAction(org.talend.dataprofiler.core.ui.action.actions.CreateRepositoryNodeAction) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ExchangeFolderRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) ContextFolderRepNode(org.talend.dq.nodes.ContextFolderRepNode) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

ExchangeFolderRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode)3 IFolder (org.eclipse.core.resources.IFolder)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 CreateRepositoryNodeAction (org.talend.dataprofiler.core.ui.action.actions.CreateRepositoryNodeAction)1 ExchangeCategoryRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode)1 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)1 IEcosCategory (org.talend.dataprofiler.ecos.model.IEcosCategory)1 AnalysisFolderRepNode (org.talend.dq.nodes.AnalysisFolderRepNode)1 ContextFolderRepNode (org.talend.dq.nodes.ContextFolderRepNode)1 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)1 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)1 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)1 DBTableFolderRepNode (org.talend.dq.nodes.DBTableFolderRepNode)1 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)1 DBViewFolderRepNode (org.talend.dq.nodes.DBViewFolderRepNode)1 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)1 DFConnectionFolderRepNode (org.talend.dq.nodes.DFConnectionFolderRepNode)1 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)1