Search in sources :

Example 1 with OpenSqlFileAction

use of org.talend.dataprofiler.core.sql.OpenSqlFileAction in project tdq-studio-se by Talend.

the class NewSourceFileActionProvider method fillContextMenu.

public void fillContextMenu(IMenuManager menu) {
    // MOD mzhao user readonly role on svn repository mode.
    if (!isShowMenu()) {
        return;
    }
    TreeSelection treeSelection = ((TreeSelection) this.getContext().getSelection());
    List<IFile> selectedFiles = new ArrayList<IFile>();
    if (treeSelection.size() == 1) {
        RepositoryNode node = (RepositoryNode) treeSelection.getFirstElement();
        if (node instanceof SourceFileSubFolderNode) {
            menu.add(new AddSqlFileAction(node));
            menu.add(new ImportSqlFileAction(node));
            menu.add(new RenameTdqFolderAction(node));
        } else if (node instanceof SourceFileFolderRepNode) {
            menu.add(new AddSqlFileAction(node));
            menu.add(new ImportSqlFileAction(node));
        } else if (node instanceof SourceFileRepNode) {
            // MOD klliu bug TDQ-4797 2012-02-29
            menu.add(new RenameSqlFileAction(node));
        }
        boolean isSelectFile = computeSelectedFiles(treeSelection, selectedFiles);
        if (isSelectFile && !selectedFiles.isEmpty()) {
            menu.add(new OpenSqlFileAction(selectedFiles));
        }
    }
}
Also used : RenameSqlFileAction(org.talend.dataprofiler.core.sql.RenameSqlFileAction) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) SourceFileRepNode(org.talend.dq.nodes.SourceFileRepNode) AddSqlFileAction(org.talend.dataprofiler.core.sql.AddSqlFileAction) SourceFileFolderRepNode(org.talend.dq.nodes.SourceFileFolderRepNode) TreeSelection(org.eclipse.jface.viewers.TreeSelection) RenameTdqFolderAction(org.talend.dataprofiler.core.ui.action.actions.RenameTdqFolderAction) SourceFileSubFolderNode(org.talend.dq.nodes.SourceFileSubFolderNode) ImportSqlFileAction(org.talend.dataprofiler.core.sql.ImportSqlFileAction) OpenSqlFileAction(org.talend.dataprofiler.core.sql.OpenSqlFileAction)

Aggregations

ArrayList (java.util.ArrayList)1 IFile (org.eclipse.core.resources.IFile)1 TreeSelection (org.eclipse.jface.viewers.TreeSelection)1 AddSqlFileAction (org.talend.dataprofiler.core.sql.AddSqlFileAction)1 ImportSqlFileAction (org.talend.dataprofiler.core.sql.ImportSqlFileAction)1 OpenSqlFileAction (org.talend.dataprofiler.core.sql.OpenSqlFileAction)1 RenameSqlFileAction (org.talend.dataprofiler.core.sql.RenameSqlFileAction)1 RenameTdqFolderAction (org.talend.dataprofiler.core.ui.action.actions.RenameTdqFolderAction)1 SourceFileFolderRepNode (org.talend.dq.nodes.SourceFileFolderRepNode)1 SourceFileRepNode (org.talend.dq.nodes.SourceFileRepNode)1 SourceFileSubFolderNode (org.talend.dq.nodes.SourceFileSubFolderNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1