Search in sources :

Example 6 with AnalysisFolderRepNode

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

the class NewAnalysisActionProvider method fillContextMenu.

/**
 * Adds a submenu to the given menu with the name "New Component".
 */
@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    // Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
    // if (obj instanceof IFolder) {
    // IFolder folder = (IFolder) obj;
    // 
    // if (ResourceService.isSubFolder(ResourceManager.getAnalysisFolder(), folder)) {
    // CreateNewAnalysisAction createAnalysisAction = new CreateNewAnalysisAction(folder);
    // menu.add(createAnalysisAction);
    // }
    // }
    // DOC klliu 2010-11-23 set the node and path to the action
    Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
    if (obj instanceof RepositoryNode) {
        RepositoryNode node = (RepositoryNode) obj;
        if ((node instanceof AnalysisFolderRepNode && !(node instanceof AnalysisSubFolderRepNode)) || (node instanceof AnalysisSubFolderRepNode && node.getObject() != null)) {
            CreateNewAnalysisAction createAnalysisAction = new CreateNewAnalysisAction(RepositoryNodeHelper.getPath(node), node);
            menu.add(createAnalysisAction);
        }
    }
// RepositoryNode node = (RepositoryNode) obj;
// if (ENodeType.SYSTEM_FOLDER.equals(node.getType()) || ENodeType.SIMPLE_FOLDER.equals(node.getType())) {
// IFolder ifolder = WorkbenchUtils.getFolder(node);
// if (ifolder != null && (ResourceService.isSubFolder(ResourceManager.getAnalysisFolder(), ifolder))) {
// CreateNewAnalysisAction createAnalysisAction = new CreateNewAnalysisAction(WorkbenchUtils.getPath(node),
// node);
// menu.add(createAnalysisAction);
// }
// }
}
Also used : TreeSelection(org.eclipse.jface.viewers.TreeSelection) AnalysisFolderRepNode(org.talend.dq.nodes.AnalysisFolderRepNode) RepositoryNode(org.talend.repository.model.RepositoryNode) CreateNewAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.CreateNewAnalysisAction) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode)

Aggregations

AnalysisFolderRepNode (org.talend.dq.nodes.AnalysisFolderRepNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)4 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)3 ReportFolderRepNode (org.talend.dq.nodes.ReportFolderRepNode)3 ArrayList (java.util.ArrayList)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Test (org.junit.Test)1 Project (org.talend.core.model.general.Project)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 CreateNewAnalysisAction (org.talend.dataprofiler.core.ui.action.actions.CreateNewAnalysisAction)1 ExchangeFolderRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode)1 AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)1 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)1 DFConnectionFolderRepNode (org.talend.dq.nodes.DFConnectionFolderRepNode)1 IndicatorFolderRepNode (org.talend.dq.nodes.IndicatorFolderRepNode)1 JrxmlTempFolderRepNode (org.talend.dq.nodes.JrxmlTempFolderRepNode)1 PatternFolderRepNode (org.talend.dq.nodes.PatternFolderRepNode)1 PatternRegexFolderRepNode (org.talend.dq.nodes.PatternRegexFolderRepNode)1 PatternRegexSubFolderRepNode (org.talend.dq.nodes.PatternRegexSubFolderRepNode)1