Search in sources :

Example 1 with ReportSubFolderRepNode

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

the class DuplicateResourceProvider method shouldShowMenu.

/**
 * DOC xqliu Comment method "shouldShowMenu".
 *
 * @param array
 * @return
 */
private boolean shouldShowMenu(Object[] array) {
    List<ENodeType> nodeTypes = new ArrayList<ENodeType>();
    nodeTypes.add(ENodeType.REPOSITORY_ELEMENT);
    nodeTypes.add(ENodeType.TDQ_REPOSITORY_ELEMENT);
    List<IRepositoryNode> repositoryNodeList = RepositoryNodeHelper.getRepositoryNodeList(array, nodeTypes);
    if (repositoryNodeList.size() == 0) {
        return false;
    }
    List<ERepositoryObjectType> objectTypes = new ArrayList<ERepositoryObjectType>();
    objectTypes.add(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_REPORT_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_INDICATOR_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES_SQL);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES_PARSER);
    objectTypes.add(ERepositoryObjectType.TDQ_PATTERN_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_JRAXML_ELEMENT);
    objectTypes.add(ERepositoryObjectType.TDQ_SOURCE_FILE_ELEMENT);
    objectTypes.add(ERepositoryObjectType.METADATA_CONNECTIONS);
    objectTypes.add(ERepositoryObjectType.TDQ_RULES_MATCHER);
    objectTypes.add(ERepositoryObjectType.CONTEXT);
    for (IRepositoryNode node : repositoryNodeList) {
        // MOD qiongli 2011-2-12.filter elements in recycle bin.
        if (RepositoryNodeHelper.isStateDeleted(node)) {
            return false;
        }
        ERepositoryObjectType contentType = node.getObjectType();
        if (contentType == null || (!objectTypes.contains(contentType) && !ConnectionUtils.isTcompJdbc(contentType.getLabel()))) {
            return false;
        }
        RepositoryNode parent = node.getParent();
        if ((parent instanceof ReportSubFolderRepNode) && (node instanceof AnalysisRepNode)) {
            return false;
        }
        if (node instanceof ReportFileRepNode || node instanceof ReportAnalysisRepNode) {
            return false;
        }
    }
    return true;
}
Also used : ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ReportFileRepNode(org.talend.dq.nodes.ReportFileRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Example 2 with ReportSubFolderRepNode

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

the class RunAnalysisActionProvider method fillContextMenu.

/**
 * Adds a submenu to the given menu with the name "New Component".
 */
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    Object[] array = ((TreeSelection) this.getContext().getSelection()).toArray();
    ArrayList<TDQAnalysisItem> selectedItemsList = new ArrayList<TDQAnalysisItem>();
    for (Object obj : array) {
        RepositoryNode node = (RepositoryNode) obj;
        RepositoryNode parent = node.getParent();
        if (!(parent instanceof ReportSubFolderRepNode)) {
            // IPath append = WorkbenchUtils.getFilePath(node);
            Item item = node.getObject().getProperty().getItem();
            if (item instanceof TDQAnalysisItem) {
                selectedItemsList.add((TDQAnalysisItem) item);
            }
        }
    }
    if (!selectedItemsList.isEmpty()) {
        // IFile file = ResourceManager.getRootProject().getFile(append);
        RunAnalysisAction runAnalysisAction = new RunAnalysisAction();
        // runAnalysisAction.setSelectionFile(file);
        runAnalysisAction.setAnalysisItems(selectedItemsList.toArray(new TDQAnalysisItem[selectedItemsList.size()]));
        menu.add(runAnalysisAction);
    }
}
Also used : Item(org.talend.core.model.properties.Item) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) RunAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RunAnalysisAction) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 3 with ReportSubFolderRepNode

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

the class UnitTestBuildHelper method createRealReportSubFolderRepNode.

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

Example 4 with ReportSubFolderRepNode

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

the class RepositoryNodeHelper method getPath.

public static IPath getPath(IRepositoryNode node) {
    if (node == null) {
        return null;
    }
    if (node.isBin()) {
        return new Path(PluginConstant.EMPTY_STRING);
    }
    if (node.getType() == null) {
        return null;
    }
    switch(node.getType()) {
        case SYSTEM_FOLDER:
            ERepositoryObjectType contentType = node.getContentType();
            if (contentType == null) {
                Item item = node.getObject().getProperty().getItem();
                contentType = ERepositoryObjectType.getItemType(item);
            }
            return new Path(ERepositoryObjectType.getFolderName(contentType));
        case SIMPLE_FOLDER:
            String label = PluginConstant.EMPTY_STRING;
            if (node.getObject() != null) {
                label = node.getObject().getProperty().getLabel();
            }
            if (node instanceof ReportSubFolderRepNode) {
                ReportSubFolderRepNode reportSubFolderRepNode = (ReportSubFolderRepNode) node;
                label = reportSubFolderRepNode.getLabel();
            }
            return getPath(node.getParent()).append(label);
        default:
    }
    return getPath(node.getParent());
}
Also used : Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem) ConnectionItem(org.talend.core.model.properties.ConnectionItem) TDQMatchRuleItem(org.talend.dataquality.properties.TDQMatchRuleItem) TDQBusinessRuleItem(org.talend.dataquality.properties.TDQBusinessRuleItem) ContextItem(org.talend.core.model.properties.ContextItem) Item(org.talend.core.model.properties.Item) FolderItem(org.talend.core.model.properties.FolderItem) TDQJrxmlItem(org.talend.dataquality.properties.TDQJrxmlItem) TDQItem(org.talend.core.model.properties.TDQItem) TDQPatternItem(org.talend.dataquality.properties.TDQPatternItem) TreeItem(org.eclipse.swt.widgets.TreeItem) TDQSourceFileItem(org.talend.dataquality.properties.TDQSourceFileItem) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode)

Example 5 with ReportSubFolderRepNode

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

the class DeleteResourceProvider method shouldShowRenameFolderMenu.

private boolean shouldShowRenameFolderMenu(RepositoryNode node) {
    boolean show = false;
    if (node instanceof AnalysisSubFolderRepNode) {
        AnalysisSubFolderRepNode anaSubFolderNode = (AnalysisSubFolderRepNode) node;
        show = !anaSubFolderNode.isVirtualFolder();
    } else if (node instanceof ReportSubFolderRepNode) {
        ReportSubFolderRepNode repSubFolderNode = (ReportSubFolderRepNode) node;
        show = !repSubFolderNode.isVirtualFolder();
    } else if (node instanceof UserDefIndicatorSubFolderRepNode || node instanceof PatternRegexSubFolderRepNode || node instanceof PatternSqlSubFolderRepNode || node instanceof RulesSQLSubFolderRepNode || node instanceof RulesParserSubFolderRepNode || node instanceof DBConnectionSubFolderRepNode || node instanceof DFConnectionSubFolderRepNode || node instanceof JrxmlTempSubFolderNode) {
        show = true;
    }
    return show;
}
Also used : PatternSqlSubFolderRepNode(org.talend.dq.nodes.PatternSqlSubFolderRepNode) UserDefIndicatorSubFolderRepNode(org.talend.dq.nodes.UserDefIndicatorSubFolderRepNode) PatternRegexSubFolderRepNode(org.talend.dq.nodes.PatternRegexSubFolderRepNode) RulesSQLSubFolderRepNode(org.talend.dq.nodes.RulesSQLSubFolderRepNode) DBConnectionSubFolderRepNode(org.talend.dq.nodes.DBConnectionSubFolderRepNode) DFConnectionSubFolderRepNode(org.talend.dq.nodes.DFConnectionSubFolderRepNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) RulesParserSubFolderRepNode(org.talend.dq.nodes.RulesParserSubFolderRepNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode) JrxmlTempSubFolderNode(org.talend.dq.nodes.JrxmlTempSubFolderNode)

Aggregations

ReportSubFolderRepNode (org.talend.dq.nodes.ReportSubFolderRepNode)7 RepositoryNode (org.talend.repository.model.RepositoryNode)4 ArrayList (java.util.ArrayList)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 IFolder (org.eclipse.core.resources.IFolder)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)2 Item (org.talend.core.model.properties.Item)2 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)2 TDQAnalysisItem (org.talend.dataquality.properties.TDQAnalysisItem)2 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)2 AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)2 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 ISetSelectionTarget (org.eclipse.ui.part.ISetSelectionTarget)1