Search in sources :

Example 1 with CreateRepositoryNodeAction

use of org.talend.dataprofiler.core.ui.action.actions.CreateRepositoryNodeAction 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

IFolder (org.eclipse.core.resources.IFolder)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 CreateRepositoryNodeAction (org.talend.dataprofiler.core.ui.action.actions.CreateRepositoryNodeAction)1 ExchangeFolderRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeFolderRepNode)1 ContextFolderRepNode (org.talend.dq.nodes.ContextFolderRepNode)1 ReportSubFolderRepNode (org.talend.dq.nodes.ReportSubFolderRepNode)1 HDFSOfHCFolderRepNode (org.talend.dq.nodes.hadoopcluster.HDFSOfHCFolderRepNode)1 HiveOfHCFolderRepNode (org.talend.dq.nodes.hadoopcluster.HiveOfHCFolderRepNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1