Search in sources :

Example 1 with SourceFileFolderRepNode

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

the class NewSourceFileActionProvider method fillContextMenu.

public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
    List<IFile> selectedFiles = new ArrayList<IFile>();
    if (treeSelection.size() == 1) {
        RepositoryNode node = (RepositoryNode) treeSelection.getFirstElement();
        if (node instanceof SourceFileSubFolderNode) {
            menu.add(new AddSqlFileAction(node));
            menu.add(new ImportSqlFileAction(node));
            menu.add(new RenameTdqFolderAction(node));
        } else if (node instanceof SourceFileFolderRepNode) {
            menu.add(new AddSqlFileAction(node));
            menu.add(new ImportSqlFileAction(node));
        } else if (node instanceof SourceFileRepNode) {
            // MOD klliu bug TDQ-4797 2012-02-29
            menu.add(new RenameSqlFileAction(node));
        }
        boolean isSelectFile = computeSelectedFiles(treeSelection, selectedFiles);
        if (isSelectFile && !selectedFiles.isEmpty()) {
            menu.add(new OpenSqlFileAction(selectedFiles));
        }
    }
}
Also used : RenameSqlFileAction(org.talend.dataprofiler.core.sql.RenameSqlFileAction) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) AddSqlFileAction(org.talend.dataprofiler.core.sql.AddSqlFileAction) SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) RenameTdqFolderAction(org.talend.dataprofiler.core.ui.action.actions.RenameTdqFolderAction) SourceFileSubFolderNode(org.talend.dq.nodes.SourceFileSubFolderNode) ImportSqlFileAction(org.talend.dataprofiler.core.sql.ImportSqlFileAction) OpenSqlFileAction(org.talend.dataprofiler.core.sql.OpenSqlFileAction)

Example 2 with SourceFileFolderRepNode

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

the class UnitTestBuildHelper method createRealSourceFileFolderRepNode.

/**
 * create the real SourceFileFolderRepNode.
 *
 * @param parentNode
 * @return
 */
public static SourceFileFolderRepNode createRealSourceFileFolderRepNode(RepositoryNode parentNode) {
    SourceFileFolderRepNode node = null;
    RepositoryNodeBuilder instance = RepositoryNodeBuilder.getInstance();
    try {
        node = (SourceFileFolderRepNode) instance.createRepositoryNodeSystemFolder(instance.getFolderHelper(), parentNode, EResourceConstant.SOURCE_FILES);
    } catch (PersistenceException e) {
        Assert.fail(e.getMessage());
    }
    return node;
}
Also used : SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) PersistenceException(org.talend.commons.exception.PersistenceException) RepositoryNodeBuilder(org.talend.dataprofiler.core.ui.views.provider.RepositoryNodeBuilder)

Example 3 with SourceFileFolderRepNode

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

the class RepositoryNodeHelper method getSourceFileRepNodes.

/**
 * get SourceFileRepNodes which under the parentNode.
 *
 * @param parentNode
 * @param recursive
 * @return
 */
public static List<SourceFileRepNode> getSourceFileRepNodes(IRepositoryNode parentNode, boolean recursive) {
    List<SourceFileRepNode> result = new ArrayList<SourceFileRepNode>();
    List<IRepositoryNode> children = parentNode.getChildren();
    for (IRepositoryNode node : children) {
        if (node instanceof SourceFileRepNode) {
            result.add((SourceFileRepNode) node);
        } else if (node instanceof SourceFileFolderRepNode || node instanceof SourceFileSubFolderNode) {
            if (recursive) {
                result.addAll(getSourceFileRepNodes(node, recursive));
            }
        }
    }
    return result;
}
Also used : SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) SourceFileSubFolderNode(org.talend.dq.nodes.SourceFileSubFolderNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode)

Example 4 with SourceFileFolderRepNode

use of org.talend.dq.nodes.SourceFileFolderRepNode 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 5 with SourceFileFolderRepNode

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

the class UnitTestBuildHelper method createRealSourceFileSubFolderRepNode.

public static SourceFileSubFolderNode createRealSourceFileSubFolderRepNode(RepositoryNode parentNode, String folderName) {
    SourceFileSubFolderNode folderNode = null;
    // create the sub folder
    IFolder iFolder = RepositoryNodeHelper.getIFolder(parentNode);
    createRealFolder(iFolder, folderName);
    List<IRepositoryNode> subFolders = new ArrayList<IRepositoryNode>();
    if (parentNode instanceof SourceFileFolderRepNode) {
        subFolders = ((SourceFileFolderRepNode) parentNode).getChildren(false);
    } else if (parentNode instanceof SourceFileSubFolderNode) {
        subFolders = ((SourceFileSubFolderNode) parentNode).getChildren(false);
    }
    if (!subFolders.isEmpty()) {
        for (IRepositoryNode node : subFolders) {
            if (node instanceof SourceFileSubFolderNode) {
                SourceFileSubFolderNode subNode = (SourceFileSubFolderNode) node;
                if (folderName.equals(subNode.getLabel())) {
                    folderNode = subNode;
                    break;
                }
            }
        }
    }
    return folderNode;
}
Also used : SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) SourceFileSubFolderNode(org.talend.dq.nodes.SourceFileSubFolderNode) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

SourceFileFolderRepNode (org.talend.dq.nodes.SourceFileFolderRepNode)5 ArrayList (java.util.ArrayList)3 SourceFileSubFolderNode (org.talend.dq.nodes.SourceFileSubFolderNode)3 SourceFileRepNode (org.talend.dq.nodes.SourceFileRepNode)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 AddSqlFileAction (org.talend.dataprofiler.core.sql.AddSqlFileAction)1 ImportSqlFileAction (org.talend.dataprofiler.core.sql.ImportSqlFileAction)1 OpenSqlFileAction (org.talend.dataprofiler.core.sql.OpenSqlFileAction)1 RenameSqlFileAction (org.talend.dataprofiler.core.sql.RenameSqlFileAction)1 RenameTdqFolderAction (org.talend.dataprofiler.core.ui.action.actions.RenameTdqFolderAction)1 ExchangeFolderRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode)1 RepositoryNodeBuilder (org.talend.dataprofiler.core.ui.views.provider.RepositoryNodeBuilder)1 AnalysisFolderRepNode (org.talend.dq.nodes.AnalysisFolderRepNode)1 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)1 DFConnectionFolderRepNode (org.talend.dq.nodes.DFConnectionFolderRepNode)1 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)1