Search in sources :

Example 1 with PreviewColumnAction

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

the class ModelElementTreeMenuProvider method previewSelectedElements.

/**
 * DOC Zqin Comment method "previewSelectedElements".
 *
 * @param newTree
 */
private void previewSelectedElements(Tree newTree) {
    TreeItem[] items = newTree.getSelection();
    ModelElement[] mes = new ModelElement[items.length];
    for (int i = 0; i < items.length; i++) {
        ModelElementIndicator meIndicator = (ModelElementIndicator) items[i].getData(AbstractColumnDropTree.MODELELEMENT_INDICATOR_KEY);
        ModelElement me = ((MetadataColumnRepositoryObject) meIndicator.getModelElementRepositoryNode().getObject()).getTdColumn();
        mes[i] = me;
    }
    new PreviewColumnAction(mes).run();
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) TreeItem(org.eclipse.swt.widgets.TreeItem) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) PreviewColumnAction(org.talend.dataprofiler.core.ui.action.actions.predefined.PreviewColumnAction) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 2 with PreviewColumnAction

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

the class PreviewColumnProvider 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());
    List<TdColumn> list = new ArrayList<TdColumn>();
    Object[] selectedObjs = treeSelection.toArray();
    for (Object obj : selectedObjs) {
        // MOD msjian 2011-12-7 TDQ-4091: the tdColumn info is not correct
        if (obj instanceof DBColumnRepNode) {
            list.add(((DBColumnRepNode) obj).getTdColumn());
        }
    // TDQ-4091 ~
    }
    if (!list.isEmpty()) {
        PreviewColumnAction action = new PreviewColumnAction(list.toArray(new TdColumn[list.size()]));
        menu.add(action);
    }
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) TreeSelection(org.eclipse.jface.viewers.TreeSelection) ArrayList(java.util.ArrayList) DBColumnRepNode(org.talend.dq.nodes.DBColumnRepNode) PreviewColumnAction(org.talend.dataprofiler.core.ui.action.actions.predefined.PreviewColumnAction)

Aggregations

PreviewColumnAction (org.talend.dataprofiler.core.ui.action.actions.predefined.PreviewColumnAction)2 ArrayList (java.util.ArrayList)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 TdColumn (org.talend.cwm.relational.TdColumn)1 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)1 DBColumnRepNode (org.talend.dq.nodes.DBColumnRepNode)1 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)1