use of org.talend.dataprofiler.core.ui.action.actions.CreateRepositoryNodeAction in project tdq-studio-se by Talend.
the class CreateNewRepositoryNodeFolder method fillContextMenu.
/**
* Adds a submenu to the given menu with the name "New Component".
*/
@Override
public void fillContextMenu(IMenuManager menu) {
if (!isShowMenu()) {
return;
}
// ADD msjian TDQ-10444: fix get error when click on the exchange node
if (isExchangeNode()) {
return;
}
// TDQ-10444~
Object obj = ((TreeSelection) this.getContext().getSelection()).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
RepositoryNode parent = node.getParent();
if (!(parent instanceof ReportSubFolderRepNode)) {
if (parent != null || node instanceof ContextFolderRepNode) {
IFolder folder = WorkbenchUtils.getFolder(node);
if (!(node instanceof ExchangeFolderRepNode) && !ResourceManager.getRulesFolder().equals(folder) && !ResourceManager.getPatternFolder().equals(folder) && !ResourceManager.getIndicatorFolder().equals(folder) && !ResourceService.isSubFolder(ResourceManager.getSystemIndicatorFolder(), folder) && (ENodeType.SYSTEM_FOLDER.equals(node.getType()) || ENodeType.SIMPLE_FOLDER.equals(node.getType())) && !(node instanceof HDFSOfHCFolderRepNode || node instanceof HiveOfHCFolderRepNode)) {
// MOD qiongli 2011-1-20 don't add it for recycle bin elements
if (node.getObject() != null && !node.getObject().getProperty().getItem().getState().isDeleted()) {
currentSelection = WorkbenchUtils.getFolder(node);
CreateRepositoryNodeAction createSubFolderAction = new CreateRepositoryNodeAction(currentSelection);
menu.add(createSubFolderAction);
}
}
}
}
}
Aggregations