Search in sources :

Example 1 with PreviewAction

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

the class PreviewProvider method fillContextMenu.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
     */
@Override
public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
    Object firstElement = treeSelection.getFirstElement();
    NamedColumnSet set = null;
    if (firstElement instanceof DBTableRepNode) {
        set = ((DBTableRepNode) firstElement).getTdTable();
    } else if (firstElement instanceof DBViewRepNode) {
        set = ((DBViewRepNode) firstElement).getTdView();
    }
    if (set != null) {
        PreviewAction action = new PreviewAction(set);
        menu.add(action);
    }
}
Also used : DBTableRepNode(org.talend.dq.nodes.DBTableRepNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) PreviewAction(org.talend.dataprofiler.core.ui.action.actions.predefined.PreviewAction) DBViewRepNode(org.talend.dq.nodes.DBViewRepNode) NamedColumnSet(orgomg.cwm.resource.relational.NamedColumnSet)

Aggregations

TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 PreviewAction (org.talend.dataprofiler.core.ui.action.actions.predefined.PreviewAction)1 DBTableRepNode (org.talend.dq.nodes.DBTableRepNode)1 DBViewRepNode (org.talend.dq.nodes.DBViewRepNode)1 NamedColumnSet (orgomg.cwm.resource.relational.NamedColumnSet)1