Search in sources :

Example 1 with SysIndicatorDefinitionRepNode

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

the class AnalysisTableTreeViewer method createOneUnit.

public void createOneUnit(final TreeItem treeItem, TableIndicatorUnit indicatorUnit) {
    final TreeItem indicatorItem = new TreeItem(treeItem, SWT.NONE);
    final TableIndicatorUnit unit = indicatorUnit;
    IndicatorEnum type = indicatorUnit.getType();
    final IndicatorEnum indicatorEnum = type;
    indicatorItem.setData(TABLE_INDICATOR_KEY, treeItem.getData(TABLE_INDICATOR_KEY));
    indicatorItem.setData(INDICATOR_UNIT_KEY, unit);
    indicatorItem.setData(VIEWER_KEY, this);
    String label = indicatorUnit.getIndicatorName();
    // $NON-NLS-1$
    label = label != null ? label : "Unknown indicator";
    SysIndicatorDefinitionRepNode recursiveFindIndicatorDefinition = RepositoryNodeHelper.recursiveFindIndicatorDefinition(indicatorUnit.getIndicator().getIndicatorDefinition());
    if (recursiveFindIndicatorDefinition != null && !recursiveFindIndicatorDefinition.getProject().isMainProject()) {
        label = label + recursiveFindIndicatorDefinition.getDisplayProjectName();
    }
    if (IndicatorEnum.WhereRuleIndicatorEnum.compareTo(type) == 0) {
        indicatorItem.setImage(0, ImageLib.getImage(ImageLib.DQ_RULE));
    } else if (IndicatorEnum.RowCountIndicatorEnum.compareTo(type) == 0) {
        indicatorItem.setImage(0, ImageLib.getImage(ImageLib.IND_DEFINITION));
    }
    indicatorItem.setText(0, label);
    TreeEditor optionEditor = new TreeEditor(tree);
    // $NON-NLS-1$
    final Label optionLabel = createTreeItemLabel(tree, ImageLib.OPTION, "AnalysisTableTreeViewer.options");
    optionLabel.setData(indicatorUnit);
    optionLabel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {
            boolean hasIndicatorParameters = openIndicatorOptionDialog(Display.getCurrent().getActiveShell(), indicatorItem);
            if (hasIndicatorParameters) {
                optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
            }
        }
    });
    optionEditor.minimumWidth = optionLabel.getImage().getBounds().width;
    optionEditor.horizontalAlignment = SWT.CENTER;
    optionEditor.setEditor(optionLabel, indicatorItem, 1);
    TreeEditor delEditor = null;
    if (!(unit.getIndicator() instanceof RowCountIndicator)) {
        delEditor = new TreeEditor(tree);
        // $NON-NLS-1$
        Label delLabel = createTreeItemLabel(tree, ImageLib.DELETE_ACTION, "AnalysisTableTreeViewer.delete");
        delLabel.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDown(MouseEvent e) {
                deleteIndicatorItems((TableIndicator) treeItem.getData(TABLE_INDICATOR_KEY), unit);
                if (indicatorItem.getParentItem() != null && indicatorItem.getParentItem().getData(INDICATOR_UNIT_KEY) != null) {
                    setElements(tableIndicators);
                } else {
                    removeItemBranch(indicatorItem);
                    indicatorTreeItemMap.remove(unit);
                }
            }
        });
        delEditor.minimumWidth = delLabel.getImage().getBounds().width;
        delEditor.horizontalAlignment = SWT.CENTER;
        delEditor.setEditor(delLabel, indicatorItem, 2);
    }
    if (delEditor == null) {
        indicatorItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { optionEditor });
    } else {
        indicatorItem.setData(ITEM_EDITOR_KEY, new TreeEditor[] { optionEditor, delEditor });
    }
    if (indicatorEnum != null && indicatorEnum.hasChildren()) {
        indicatorItem.setData(treeItem.getData(TABLE_INDICATOR_KEY));
        createIndicatorItems(indicatorItem, indicatorUnit.getChildren());
    }
    if (hasIndicatorParameters(indicatorUnit)) {
        optionLabel.setImage(ImageLib.getImage(ImageLib.INDICATOR_OPTION_CHECKED));
    }
    // ADD xqliu 2009-04-30 bug 6808
    this.indicatorTreeItemMap.put(unit, indicatorItem);
}
Also used : TableIndicator(org.talend.dataprofiler.core.model.TableIndicator) MouseEvent(org.eclipse.swt.events.MouseEvent) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) TreeEditor(org.eclipse.swt.custom.TreeEditor) TreeItem(org.eclipse.swt.widgets.TreeItem) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) Label(org.eclipse.swt.widgets.Label) MouseAdapter(org.eclipse.swt.events.MouseAdapter) TableIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.TableIndicatorUnit) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator)

Example 2 with SysIndicatorDefinitionRepNode

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

the class RepositoryNodeHelper method recursiveFindIndicatorDefinition.

public static SysIndicatorDefinitionRepNode recursiveFindIndicatorDefinition(IndicatorDefinition indDef) {
    if (indDef == null) {
        return null;
    }
    String uuid = getUUID(indDef);
    if (uuid == null) {
        return null;
    }
    List<SysIndicatorDefinitionRepNode> indicatorDefinitionRepNodes;
    if (ProxyRepositoryManager.getInstance().isMergeRefProject()) {
        indicatorDefinitionRepNodes = getIndicatorDefinitionRepNodes(getLibrariesFolderNode(EResourceConstant.SYSTEM_INDICATORS), true, true);
        indicatorDefinitionRepNodes.addAll(getIndicatorDefinitionRepNodes(getLibrariesFolderNode(EResourceConstant.USER_DEFINED_INDICATORS), true, true));
    } else {
        Project inWhichProject = getInWhichProject(indDef);
        indicatorDefinitionRepNodes = getIndicatorDefinitionRepNodes(getLibrariesFolderNode(EResourceConstant.SYSTEM_INDICATORS, inWhichProject), true, true);
        indicatorDefinitionRepNodes.addAll(getIndicatorDefinitionRepNodes(getLibrariesFolderNode(EResourceConstant.USER_DEFINED_INDICATORS, inWhichProject), true, true));
    }
    if (indicatorDefinitionRepNodes.size() > 0) {
        for (SysIndicatorDefinitionRepNode childNode : indicatorDefinitionRepNodes) {
            if (uuid.equals(getUUID(childNode.getIndicatorDefinition()))) {
                return childNode;
            }
        }
    }
    return null;
}
Also used : Project(org.talend.core.model.general.Project) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode)

Example 3 with SysIndicatorDefinitionRepNode

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

the class ColumnViewerDND method installDND.

/**
 * DOC qzhang Comment method "installDND".
 */
public static void installDND(final Tree targetControl) {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    DQRespositoryView findView = (DQRespositoryView) activePage.findView(DQRespositoryView.ID);
    final CommonViewer commonViewer = findView.getCommonViewer();
    final LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
    int operations = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer[] transfers = new Transfer[] { transfer };
    DropTarget dropTarget = new DropTarget(targetControl, operations);
    dropTarget.setTransfer(transfers);
    DropTargetListener dndListener = new TreeDropTargetEffect(targetControl) {

        ISelectionReceiver receiver = null;

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.dnd.DropTargetAdapter#dragEnter(org.eclipse.swt .dnd.DropTargetEvent)
             */
        @Override
        public void dragEnter(DropTargetEvent event) {
            super.dragEnter(event);
            IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
            Object object = selection.getFirstElement();
            // if (object instanceof IFile) {
            if (object instanceof SysIndicatorDefinitionRepNode) {
                receiver = new UDIReceiver();
            } else if (object instanceof PatternRepNode) {
                receiver = new PatternReceiver();
            }
            // MOD klliu 15750 2011-01-17 for Drag&Drop On columnset
            if (object instanceof DBColumnRepNode || object instanceof DBTableRepNode || object instanceof DFColumnRepNode) {
                receiver = new ColumnReceiver();
            }
            if (receiver == null) {
                event.detail = DND.DROP_NONE;
            } else {
                event.feedback = DND.FEEDBACK_EXPAND;
                receiver.doDropValidation(event, commonViewer);
            }
        }

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.dnd.TreeDropTargetEffect#dragOver(org.eclipse .swt.dnd.DropTargetEvent)
             */
        @Override
        public void dragOver(DropTargetEvent event) {
            super.dragOver(event);
            // MOD yyi 2009-09-18 bug: 9044
            if (null != receiver) {
                receiver.doDropValidation(event, commonViewer);
            }
        }

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.dnd.DropTargetAdapter#drop(org.eclipse.swt.dnd .DropTargetEvent)
             */
        @Override
        public void drop(DropTargetEvent event) {
            int index = targetControl.getItemCount();
            super.drop(event);
            if (event.item == null) {
                // TreeItem item = new TreeItem(targetControl, SWT.NONE);
                // item.setText(texts);
                // item.setText(text);
                index = 0;
            } else {
                TreeItem item = (TreeItem) event.item;
                TreeItem[] items = targetControl.getItems();
                for (int i = 0; i < items.length; i++) {
                    if (items[i] == item) {
                        index = i;
                        break;
                    }
                }
            }
            receiver.drop(event, commonViewer, index);
        }
    };
    dropTarget.addDropListener(dndListener);
}
Also used : CommonViewer(org.eclipse.ui.navigator.CommonViewer) TreeItem(org.eclipse.swt.widgets.TreeItem) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) TreeDropTargetEffect(org.eclipse.swt.dnd.TreeDropTargetEffect) DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) DropTargetListener(org.eclipse.swt.dnd.DropTargetListener) LocalSelectionTransfer(org.eclipse.jface.util.LocalSelectionTransfer) Transfer(org.eclipse.swt.dnd.Transfer) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) DropTarget(org.eclipse.swt.dnd.DropTarget) LocalSelectionTransfer(org.eclipse.jface.util.LocalSelectionTransfer) PatternRepNode(org.talend.dq.nodes.PatternRepNode)

Example 4 with SysIndicatorDefinitionRepNode

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

the class ImageLib method getImageNameByRepositoryNode.

public static String getImageNameByRepositoryNode(IRepositoryNode node) {
    String imageName = null;
    IRepositoryViewObject viewObject = node.getObject();
    ENodeType type = node.getType();
    if (node instanceof ReportAnalysisRepNode) {
        imageName = ImageLib.ANALYSIS_OBJECT;
    } else if (node instanceof RecycleBinRepNode) {
        imageName = ImageLib.RECYCLEBIN_EMPTY;
    } else if (type.equals(ENodeType.SYSTEM_FOLDER)) {
        String label = viewObject.getLabel();
        if (label.equals(EResourceConstant.DATA_PROFILING.getName())) {
            imageName = ImageLib.DATA_PROFILING;
        } else if (label.equals(EResourceConstant.METADATA.getName())) {
            imageName = ImageLib.METADATA;
        } else if (node instanceof DBConnectionFolderRepNode) {
            imageName = ImageLib.CONNECTION;
        } else if (label.equals(EResourceConstant.FILEDELIMITED.getName())) {
            imageName = ImageLib.FILE_DELIMITED;
        } else if (label.equals(EResourceConstant.HADOOP_CLUSTER.getName())) {
            imageName = ImageLib.HADOOP_CLUSTER;
        } else if (label.equals(EResourceConstant.LIBRARIES.getName())) {
            imageName = ImageLib.LIBRARIES;
        } else if (label.equals(EResourceConstant.EXCHANGE.getName())) {
            imageName = ImageLib.EXCHANGE;
        } else {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        }
    } else if (type.equals(ENodeType.SIMPLE_FOLDER)) {
        imageName = ImageLib.FOLDERNODE_IMAGE;
    } else if (type.equals(ENodeType.REPOSITORY_ELEMENT)) {
        if (node instanceof DBConnectionRepNode) {
            imageName = ImageLib.TD_DATAPROVIDER;
        } else if (node instanceof DFConnectionRepNode) {
            imageName = ImageLib.FILE_DELIMITED;
        } else if (node instanceof AnalysisRepNode) {
            imageName = ImageLib.ANALYSIS_OBJECT;
        } else if (node instanceof ReportRepNode) {
            imageName = ImageLib.REPORT_OBJECT;
        } else if (node instanceof SysIndicatorDefinitionRepNode) {
            imageName = ImageLib.IND_DEFINITION;
        } else if (node instanceof PatternRepNode) {
            imageName = ImageLib.PATTERN_REG;
        } else if (node instanceof RuleRepNode) {
            imageName = ImageLib.DQ_RULE;
        } else if (node instanceof SourceFileRepNode) {
            imageName = ImageLib.SOURCE_FILE;
        } else if (node instanceof ExchangeCategoryRepNode || node instanceof ExchangeComponentRepNode) {
            imageName = ImageLib.EXCHANGE;
        } else if (node instanceof JrxmlTempleteRepNode) {
            imageName = ImageLib.JRXML_ICON;
        }
    } else if (type.equals(ENodeType.TDQ_REPOSITORY_ELEMENT)) {
        if (node instanceof DBCatalogRepNode) {
            imageName = ImageLib.CATALOG;
        } else if (node instanceof DBSchemaRepNode) {
            imageName = ImageLib.SCHEMA;
        } else if (node instanceof DBTableFolderRepNode) {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        } else if (node instanceof DBViewFolderRepNode) {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        } else if (node instanceof DBTableRepNode || node instanceof DFTableRepNode) {
            imageName = ImageLib.TABLE;
        } else if (node instanceof DBViewRepNode) {
            imageName = ImageLib.VIEW;
        } else if (node instanceof DBColumnRepNode) {
            if (((DBColumnRepNode) node).isKey()) {
                imageName = ImageLib.PK_COLUMN;
            } else {
                imageName = ImageLib.TD_COLUMN;
            }
        } else if (node instanceof DFColumnRepNode) {
            imageName = ImageLib.TD_COLUMN;
        } else if (node instanceof DBColumnFolderRepNode || node instanceof DFColumnFolderRepNode) {
            imageName = ImageLib.FOLDERNODE_IMAGE;
        }
    }
    return imageName;
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) DBViewFolderRepNode(org.talend.dq.nodes.DBViewFolderRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ReportRepNode(org.talend.dq.nodes.ReportRepNode) ExchangeComponentRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) DFTableRepNode(org.talend.dq.nodes.DFTableRepNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) PatternRepNode(org.talend.dq.nodes.PatternRepNode) DBTableFolderRepNode(org.talend.dq.nodes.DBTableFolderRepNode) DFColumnFolderRepNode(org.talend.dq.nodes.DFColumnFolderRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) RuleRepNode(org.talend.dq.nodes.RuleRepNode) JrxmlTempleteRepNode(org.talend.dq.nodes.JrxmlTempleteRepNode) RecycleBinRepNode(org.talend.dq.nodes.RecycleBinRepNode) DBColumnFolderRepNode(org.talend.dq.nodes.DBColumnFolderRepNode) DFColumnRepNode(org.talend.dq.nodes.DFColumnRepNode) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) ExchangeCategoryRepNode(org.talend.dataprofiler.core.ui.exchange.ExchangeCategoryRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ENodeType(org.talend.repository.model.IRepositoryNode.ENodeType) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode)

Example 5 with SysIndicatorDefinitionRepNode

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

the class DQRespositoryView method createPartControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.navigator.CommonNavigator#createPartControl(org.eclipse .swt.widgets.Composite)
     */
@Override
public void createPartControl(Composite parent) {
    parent.setLayout(new BorderLayout());
    Composite topComp = new Composite(parent, SWT.NONE);
    topComp.setFont(parent.getFont());
    topComp.setLayoutData(BorderLayout.NORTH);
    Composite bottomComp = new Composite(parent, SWT.NONE);
    bottomComp.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    bottomComp.setFont(parent.getFont());
    bottomComp.setLayoutData(BorderLayout.CENTER);
    topComp.setLayout(new BorderLayout());
    FillLayout bottomLayout = new FillLayout(SWT.VERTICAL);
    bottomComp.setLayout(bottomLayout);
    createTreeFilter(topComp);
    super.createPartControl(bottomComp);
    // For removing the popup menu of DQRepositoryView.
    // $NON-NLS-1$
    MenuManager menuMgr = new MenuManager("org.talend.dataprofiler.core.ui.views.DQRespositoryView");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager menuManager) {
            ISelection selection = getCommonViewer().getSelection();
            getNavigatorActionService().setContext(new ActionContext(selection));
            getNavigatorActionService().fillContextMenu(menuManager);
        }
    });
    Menu menu = menuMgr.createContextMenu(getCommonViewer().getTree());
    getCommonViewer().getTree().setMenu(menu);
    this.addViewerFilter(EMFObjFilter.FILTER_ID);
    this.addViewerFilter(ReportingFilter.FILTER_ID);
    this.addViewerFilter(FolderObjFilter.FILTER_ID);
    adjustFilter();
    activateContext();
    getCommonViewer().setSorter(null);
    getCommonViewer().getTree().addTreeListener(new TreeAdapter() {

        @Override
        public void treeExpanded(TreeEvent e) {
            TreeItem item = (TreeItem) e.item;
            if (!item.getText().endsWith(")")) {
                // $NON-NLS-1$
                Object obj = item.getData();
                if (obj instanceof TableFolderNode || obj instanceof ViewFolderNode || obj instanceof ColumnFolderNode) {
                    // $NON-NLS-1$ //$NON-NLS-2$
                    item.setText(item.getText() + "(" + item.getItemCount() + ")");
                }
            }
            super.treeExpanded(e);
        }
    });
    getCommonViewer().getTree().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent e) {
            boolean superDoubleClick = true;
            Tree tree = (Tree) e.getSource();
            Point point = new Point(e.x, e.y);
            final TreeItem item = tree.getItem(point);
            if (item != null) {
                Object obj = item.getData();
                if (obj instanceof AbstractFolderNode) {
                    AbstractFolderNode node = (AbstractFolderNode) obj;
                    node.loadChildren();
                    Object[] children = node.getChildren();
                    if (children != null) {
                        if (item.getText().indexOf("(") > 0) {
                            // $NON-NLS-1$
                            item.setText(// $NON-NLS-1$ //$NON-NLS-2$
                            item.getText().substring(0, item.getText().indexOf("(")) + "(" + children.length + // $NON-NLS-1$
                            ")");
                        } else {
                            // $NON-NLS-1$ //$NON-NLS-2$
                            item.setText(item.getText() + "(" + children.length + ")");
                        }
                    }
                }
                if (obj instanceof IndicatorDefinition) {
                    IndicatorDefinition indicatorDefinition = (IndicatorDefinition) obj;
                    // reload object
                    indicatorDefinition = DefinitionHandler.getInstance().getIndicatorDefinition(indicatorDefinition.getLabel());
                    IndicatorEditorInput input = new IndicatorEditorInput(indicatorDefinition);
                    try {
                        CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, IndicatorEditor.class.getName());
                    } catch (PartInitException e1) {
                        log.error(e1, e1);
                    }
                }
                if (obj instanceof DQRepositoryNode) {
                    if (obj instanceof ReportFileRepNode) {
                        new OpenItemEditorAction(new IRepositoryNode[] { (IRepositoryNode) obj }).run();
                    } else if (obj instanceof DFConnectionRepNode) {
                        new EditFileDelimitedAction((IRepositoryNode) obj).run();
                    } else if (obj instanceof HadoopClusterConnectionRepNode && HadoopClusterUtils.getDefault().isServiceInstalled()) {
                        new EditHadoopClusterAction((IRepositoryNode) obj).run();
                    } else if (obj instanceof HDFSOfHCConnectionNode && HadoopClusterUtils.getDefault().isServiceInstalled()) {
                        new EditHDFSConnectionAction((IRepositoryNode) obj).run();
                    } else if (obj instanceof DFTableRepNode) {
                        new EditDFTableAction((IRepositoryNode) obj).run();
                    } else if (obj instanceof ContextRepNode) {
                        new DQEditContextAction((ContextRepNode) obj, false).run();
                    } else {
                        DQRepositoryNode repoNode = (DQRepositoryNode) obj;
                        if (RepositoryNodeHelper.canOpenEditor(repoNode)) {
                            OpenItemEditorAction openItemEditorAction = new OpenItemEditorAction(new IRepositoryNode[] { repoNode });
                            openItemEditorAction.run();
                        }
                        if (repoNode instanceof AnalysisRepNode || repoNode instanceof ReportRepNode || repoNode instanceof SysIndicatorDefinitionRepNode || repoNode instanceof PatternRepNode || repoNode instanceof RuleRepNode) {
                            superDoubleClick = false;
                        }
                    }
                }
            }
            if (superDoubleClick) {
                super.mouseDoubleClick(e);
            }
        }
    });
    getCommonViewer().getTree().addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
                Tree tree = (Tree) e.getSource();
                TreeItem[] selection = tree.getSelection();
                for (TreeItem item : selection) {
                    Object data = item.getData();
                    DQRepositoryNode repoNode = (DQRepositoryNode) data;
                    if (RepositoryNodeHelper.canOpenEditor(repoNode)) {
                        OpenItemEditorAction openItemEditorAction = new OpenItemEditorAction(new IRepositoryNode[] { repoNode });
                        openItemEditorAction.run();
                    }
                }
            }
        }

        public void keyReleased(KeyEvent e) {
        // do nothing here until now
        }
    });
    // ~ADD mzhao for feature 6233 Load columns when selecting a table (or
    // view) in DQ Repository view
    getCommonViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            TreeSelection selection = (TreeSelection) event.getSelection();
            Iterator<?> iterator = selection.iterator();
            while (iterator.hasNext()) {
                Object selectedElement = iterator.next();
                if (selectedElement instanceof DBTableRepNode || selectedElement instanceof DBViewRepNode) {
                    ((RepositoryNode) selectedElement).getChildren().get(0).getChildren();
                }
            }
        }
    });
    // MOD mzhao 2011-03-10 bug 19147: filter MDM entries.
    getCommonViewer().addFilter(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof IProject) {
                return false;
            }
            return true;
        }
    });
// ~
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) HDFSOfHCConnectionNode(org.talend.dq.nodes.hadoopcluster.HDFSOfHCConnectionNode) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ColumnViewer(org.eclipse.jface.viewers.ColumnViewer) Viewer(org.eclipse.jface.viewers.Viewer) TreeAdapter(org.eclipse.swt.events.TreeAdapter) TableFolderNode(org.talend.dataprofiler.core.model.nodes.foldernode.TableFolderNode) TreeEvent(org.eclipse.swt.events.TreeEvent) IndicatorEditorInput(org.talend.dataprofiler.core.ui.editor.indicator.IndicatorEditorInput) ReportFileRepNode(org.talend.dq.nodes.ReportFileRepNode) BorderLayout(org.talend.dataprofiler.core.ui.views.layout.BorderLayout) ReportRepNode(org.talend.dq.nodes.ReportRepNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) Tree(org.eclipse.swt.widgets.Tree) PatternRepNode(org.talend.dq.nodes.PatternRepNode) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) FillLayout(org.eclipse.swt.layout.FillLayout) OpenItemEditorAction(org.talend.dataprofiler.core.ui.action.actions.OpenItemEditorAction) ViewFolderNode(org.talend.dataprofiler.core.model.nodes.foldernode.ViewFolderNode) DQEditContextAction(org.talend.dataprofiler.core.ui.action.actions.DQEditContextAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) ColumnFolderNode(org.talend.dataprofiler.core.model.nodes.foldernode.ColumnFolderNode) EditDFTableAction(org.talend.dataprofiler.core.ui.action.actions.EditDFTableAction) AbstractViewerFilter(org.talend.dataprofiler.core.ui.filters.AbstractViewerFilter) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) AbstractFolderNode(org.talend.dq.nodes.foldernode.AbstractFolderNode) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) KeyEvent(org.eclipse.swt.events.KeyEvent) DQRepositoryNode(org.talend.dq.nodes.DQRepositoryNode) ISelection(org.eclipse.jface.viewers.ISelection) EditHDFSConnectionAction(org.talend.dataprofiler.core.ui.action.actions.EditHDFSConnectionAction) SysIndicatorDefinitionRepNode(org.talend.dq.nodes.SysIndicatorDefinitionRepNode) Iterator(java.util.Iterator) DFTableRepNode(org.talend.dq.nodes.DFTableRepNode) Menu(org.eclipse.swt.widgets.Menu) PartInitException(org.eclipse.ui.PartInitException) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) IRepositoryNode(org.talend.repository.model.IRepositoryNode) MouseAdapter(org.eclipse.swt.events.MouseAdapter) Point(org.eclipse.swt.graphics.Point) ActionContext(org.eclipse.ui.actions.ActionContext) RuleRepNode(org.talend.dq.nodes.RuleRepNode) IMenuListener(org.eclipse.jface.action.IMenuListener) IProject(org.eclipse.core.resources.IProject) EditFileDelimitedAction(org.talend.dataprofiler.core.ui.action.actions.EditFileDelimitedAction) DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) AnalysisRepNode(org.talend.dq.nodes.AnalysisRepNode) DFConnectionRepNode(org.talend.dq.nodes.DFConnectionRepNode) EditHadoopClusterAction(org.talend.dataprofiler.core.ui.action.actions.EditHadoopClusterAction) KeyListener(org.eclipse.swt.events.KeyListener) IMenuManager(org.eclipse.jface.action.IMenuManager) HadoopClusterConnectionRepNode(org.talend.dq.nodes.hadoopcluster.HadoopClusterConnectionRepNode) ContextRepNode(org.talend.dq.nodes.ContextRepNode)

Aggregations

SysIndicatorDefinitionRepNode (org.talend.dq.nodes.SysIndicatorDefinitionRepNode)11 PatternRepNode (org.talend.dq.nodes.PatternRepNode)6 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)5 AnalysisRepNode (org.talend.dq.nodes.AnalysisRepNode)5 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)5 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)4 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)4 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)4 DFConnectionRepNode (org.talend.dq.nodes.DFConnectionRepNode)4 ReportRepNode (org.talend.dq.nodes.ReportRepNode)4 RuleRepNode (org.talend.dq.nodes.RuleRepNode)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)3 MouseEvent (org.eclipse.swt.events.MouseEvent)3 ExchangeComponentRepNode (org.talend.dataprofiler.core.ui.exchange.ExchangeComponentRepNode)3 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)3 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)3 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)3 DFTableRepNode (org.talend.dq.nodes.DFTableRepNode)3 DQRepositoryNode (org.talend.dq.nodes.DQRepositoryNode)3 SourceFileRepNode (org.talend.dq.nodes.SourceFileRepNode)3