Search in sources :

Example 1 with OverviewAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.OverviewAnalysisAction in project tdq-studio-se by Talend.

the class OverviewResultPage method createContextMenuFor.

protected void createContextMenuFor(final StructuredViewer viewer) {
    // $NON-NLS-1$
    final MenuManager contextMenu = new MenuManager("#PopUp");
    // $NON-NLS-1$
    contextMenu.add(new Separator("additions"));
    contextMenu.setRemoveAllWhenShown(true);
    contextMenu.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager mgr) {
            Object overviewObject = ((StructuredSelection) viewer.getSelection()).getFirstElement();
            if (overviewObject instanceof OverviewIndUIElement) {
                OverviewIndUIElement overview = (OverviewIndUIElement) overviewObject;
                IRepositoryNode node = overview.getNode();
                List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
                nodes.add(node);
                contextMenu.add(new OverviewAnalysisAction(nodes));
            }
        // if (obj instanceof SchemaIndicator) {
        // SchemaIndicator schemaIndicator = (SchemaIndicator) obj;
        // contextMenu.add(new OverviewAnalysisAction(new Package[] { (Package)
        // schemaIndicator.getAnalyzedElement() }));
        // }
        }
    });
    Menu menu = contextMenu.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) OverviewAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.OverviewAnalysisAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) List(java.util.List) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator) IMenuListener(org.eclipse.jface.action.IMenuListener)

Example 2 with OverviewAnalysisAction

use of org.talend.dataprofiler.core.ui.action.actions.OverviewAnalysisAction in project tdq-studio-se by Talend.

the class OverViewAnalysisActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
    List list = currentSelection.toList();
    // DOC MOD klliu 2010-12-14 feature 15750 for overview catalog or schema analysis.
    List<IRepositoryNode> packageList = new ArrayList<IRepositoryNode>();
    for (Object obj : list) {
        Connection conn = getConnection(obj);
        if (!MetadataConnectionUtils.isTDQSupportDBTemplate(conn)) {
            return;
        }
        IRepositoryNode node = (IRepositoryNode) obj;
        packageList.add(node);
    }
    if (packageList.size() > 0) {
        OverviewAnalysisAction overviewAnalysisAction = new OverviewAnalysisAction(packageList);
        menu.add(overviewAnalysisAction);
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) OverviewAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.OverviewAnalysisAction) ArrayList(java.util.ArrayList) Connection(org.talend.core.model.metadata.builder.connection.Connection) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 List (java.util.List)2 OverviewAnalysisAction (org.talend.dataprofiler.core.ui.action.actions.OverviewAnalysisAction)2 IRepositoryNode (org.talend.repository.model.IRepositoryNode)2 EList (org.eclipse.emf.common.util.EList)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Separator (org.eclipse.jface.action.Separator)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 Menu (org.eclipse.swt.widgets.Menu)1 Connection (org.talend.core.model.metadata.builder.connection.Connection)1 MetadataTableRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)1 OverviewIndUIElement (org.talend.dataprofiler.core.model.OverviewIndUIElement)1