Search in sources :

Example 6 with AnalysisSubFolderRepNode

use of org.talend.dq.nodes.AnalysisSubFolderRepNode 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

AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)6 RepositoryNode (org.talend.repository.model.RepositoryNode)5 TreeSelection (org.eclipse.jface.viewers.TreeSelection)3 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)2 ReportRepNode (org.talend.dq.nodes.ReportRepNode)2 ReportSubFolderRepNode (org.talend.dq.nodes.ReportSubFolderRepNode)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 ArrayList (java.util.ArrayList)1 ISelection (org.eclipse.jface.viewers.ISelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)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 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MetadataCatalogRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject)1 MetadataSchemaRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject)1 CreateNewAnalysisAction (org.talend.dataprofiler.core.ui.action.actions.CreateNewAnalysisAction)1 ExportConnectionToTOSAction (org.talend.dataprofiler.core.ui.action.actions.ExportConnectionToTOSAction)1 TableViewFilterAction (org.talend.dataprofiler.core.ui.action.actions.TableViewFilterAction)1