Search in sources :

Example 1 with OpenIndicatorDefinitionAction

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

the class IndicatorDefinitionActionProvider 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 currentSelection = ((TreeSelection) this.getContext().getSelection());
    List<IndicatorDefinition> list = new ArrayList<IndicatorDefinition>();
    Object[] objs = currentSelection.toArray();
    for (Object obj : objs) {
        if (obj instanceof RepositoryNode) {
            RepositoryNode node = (RepositoryNode) obj;
            if (ERepositoryObjectType.TDQ_INDICATOR_ELEMENT.equals(node.getContentType())) {
                TDQIndicatorDefinitionItem item = (TDQIndicatorDefinitionItem) node.getObject().getProperty().getItem();
                list.add(item.getIndicatorDefinition());
            }
        }
    }
    if (!list.isEmpty()) {
        menu.add(new OpenIndicatorDefinitionAction(list.toArray(new IndicatorDefinition[list.size()])));
    }
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) OpenIndicatorDefinitionAction(org.talend.dataprofiler.core.ui.action.actions.OpenIndicatorDefinitionAction)

Aggregations

ArrayList (java.util.ArrayList)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 OpenIndicatorDefinitionAction (org.talend.dataprofiler.core.ui.action.actions.OpenIndicatorDefinitionAction)1 IndicatorDefinition (org.talend.dataquality.indicators.definition.IndicatorDefinition)1 TDQIndicatorDefinitionItem (org.talend.dataquality.properties.TDQIndicatorDefinitionItem)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1