use of org.talend.dq.nodes.AnalysisFolderRepNode in project tdq-studio-se by Talend.
the class NewAnalysisActionProvider method fillContextMenu.
/**
* Adds a submenu to the given menu with the name "New Component".
*/
@Override
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
// Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
// if (obj instanceof IFolder) {
// IFolder folder = (IFolder) obj;
//
// if (ResourceService.isSubFolder(ResourceManager.getAnalysisFolder(), folder)) {
// CreateNewAnalysisAction createAnalysisAction = new CreateNewAnalysisAction(folder);
// menu.add(createAnalysisAction);
// }
// }
// DOC klliu 2010-11-23 set the node and path to the action
Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
if (obj instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) obj;
if ((node instanceof AnalysisFolderRepNode && !(node instanceof AnalysisSubFolderRepNode)) || (node instanceof AnalysisSubFolderRepNode && node.getObject() != null)) {
CreateNewAnalysisAction createAnalysisAction = new CreateNewAnalysisAction(RepositoryNodeHelper.getPath(node), node);
menu.add(createAnalysisAction);
}
}
// RepositoryNode node = (RepositoryNode) obj;
// if (ENodeType.SYSTEM_FOLDER.equals(node.getType()) || ENodeType.SIMPLE_FOLDER.equals(node.getType())) {
// IFolder ifolder = WorkbenchUtils.getFolder(node);
// if (ifolder != null && (ResourceService.isSubFolder(ResourceManager.getAnalysisFolder(), ifolder))) {
// CreateNewAnalysisAction createAnalysisAction = new CreateNewAnalysisAction(WorkbenchUtils.getPath(node),
// node);
// menu.add(createAnalysisAction);
// }
// }
}
Aggregations