Search in sources :

Example 6 with ReportSubFolderRepNode

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

the class DuplicateAction method selectAndReveal.

/**
 * DOC bZhou Comment method "selectAndReveal".
 *
 * Selects and reveals the newly added resource in all parts of the active workbench window's active page.
 *
 * @param newLabel
 *
 * @param duplicateObject
 * @throws BusinessException
 */
private void selectAndReveal(String newLabel, Item duplicateItem) throws BusinessException {
    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IWorkbenchPage page = workbenchWindow.getActivePage();
    IWorkbenchPart activePart = page.getActivePart();
    RepositoryNode recursiveFind = null;
    recursiveFind = getSelctionNode(newLabel, duplicateItem.getProperty());
    if (recursiveFind != null) {
        if (recursiveFind instanceof AnalysisRepNode || recursiveFind instanceof AnalysisSubFolderRepNode || recursiveFind instanceof ReportRepNode || recursiveFind instanceof ReportSubFolderRepNode) {
            CorePlugin.getDefault().refreshDQView(RepositoryNodeHelper.findNearestSystemFolderNode(recursiveFind));
        } else {
            CorePlugin.getDefault().refreshDQView(recursiveFind.getParent());
            refreshHiveConnectionParent(recursiveFind);
        }
        // MOD qiongli TDQ-5391 Avoid 'recursiveFind' to casue NPE .
        if (activePart instanceof ISetSelectionTarget) {
            ISelection selection = new StructuredSelection(recursiveFind);
            ((ISetSelectionTarget) activePart).selectReveal(selection);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ISetSelectionTarget(org.eclipse.ui.part.ISetSelectionTarget) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ReportSubFolderRepNode(org.talend.dq.nodes.ReportSubFolderRepNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode)

Example 7 with ReportSubFolderRepNode

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

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