Search in sources :

Example 1 with RemoveAnalysisAction

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

the class RemoveAnalysisActionProvider method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
    if (!treeSelection.isEmpty()) {
        Iterator iterator = treeSelection.iterator();
        while (iterator.hasNext()) {
            Object obj = iterator.next();
            if (obj instanceof ReportAnalysisRepNode) {
                ReportAnalysisRepNode repAnaNode = (ReportAnalysisRepNode) obj;
                TDQReportItem reportItem = repAnaNode.getReportItem();
                if (CorePlugin.getDefault().itemIsOpening(reportItem, false)) {
                    // if the report's editor is opening, don't show the menu
                    return;
                }
            } else {
                // if include other type node, don't show the menu
                return;
            }
        }
    }
    // show the menu
    menu.add(new RemoveAnalysisAction());
}
Also used : TreeSelection(org.eclipse.jface.viewers.TreeSelection) Iterator(java.util.Iterator) ReportAnalysisRepNode(org.talend.dq.nodes.ReportAnalysisRepNode) TDQReportItem(org.talend.dataquality.properties.TDQReportItem) RemoveAnalysisAction(org.talend.dataprofiler.core.ui.action.actions.RemoveAnalysisAction)

Aggregations

Iterator (java.util.Iterator)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 RemoveAnalysisAction (org.talend.dataprofiler.core.ui.action.actions.RemoveAnalysisAction)1 TDQReportItem (org.talend.dataquality.properties.TDQReportItem)1 ReportAnalysisRepNode (org.talend.dq.nodes.ReportAnalysisRepNode)1