Search in sources :

Example 1 with ExportConnectionToTOSAction

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

the class ExportConnecitonActionProvider 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;
    }
    List<Object> selectionList = ((TreeSelection) this.getContext().getSelection()).toList();
    List<Package> packList = new ArrayList<Package>();
    boolean showMenu = false;
    for (Object obj : selectionList) {
        if (obj instanceof DBCatalogRepNode || obj instanceof DBSchemaRepNode) {
            // MOD gdbu 2011-12-29 TDQ-4281 Remove the "create a new connection" menu under
            // AnalysisSubFolderRepNode.
            RepositoryNode node = (RepositoryNode) obj;
            if (node.getParent() instanceof AnalysisSubFolderRepNode) {
                return;
            }
            // ~TDQ-4281
            ModelElement me = RepositoryNodeHelper.getModelElementFromRepositoryNode(node);
            if (me != null && me instanceof Package) {
                Package pack = (Package) me;
                packList.add(pack);
                showMenu = true;
            }
        }
    }
    if (showMenu) {
        ExportConnectionToTOSAction action = new ExportConnectionToTOSAction(packList);
        menu.add(action);
    }
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) AnalysisSubFolderRepNode(org.talend.dq.nodes.AnalysisSubFolderRepNode) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) ExportConnectionToTOSAction(org.talend.dataprofiler.core.ui.action.actions.ExportConnectionToTOSAction) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) Package(orgomg.cwm.objectmodel.core.Package)

Aggregations

ArrayList (java.util.ArrayList)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 ExportConnectionToTOSAction (org.talend.dataprofiler.core.ui.action.actions.ExportConnectionToTOSAction)1 AnalysisSubFolderRepNode (org.talend.dq.nodes.AnalysisSubFolderRepNode)1 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)1 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)1 Package (orgomg.cwm.objectmodel.core.Package)1