use of org.talend.repository.hadoopcluster.node.HadoopFolderRepositoryNode in project tbd-studio-se by Talend.
the class CreateHadoopDBNodeAction method init.
/*
* (non-Javadoc)
*
* @see org.talend.repository.hadoopcluster.action.common.CreateHadoopNodeAction#init(org.talend.repository.model.
* RepositoryNode)
*/
@Override
protected void init(RepositoryNode node) {
ERepositoryObjectType nodeType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
if (nodeType == null) {
return;
}
if (hideAction(node)) {
return;
}
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (HCRepositoryUtil.isHadoopClusterNode(node) || (node instanceof HadoopFolderRepositoryNode && getNodeType().equals(nodeType) && isParentNode(node))) {
if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(node) || (node.getObject() != null && factory.getStatus(node.getObject()) == ERepositoryStatus.DELETED)) {
setEnabled(false);
return;
}
this.setText(getCreateLabel());
collectChildNames(node);
creation = true;
setEnabled(true);
return;
}
if (!nodeType.equals(getNodeType())) {
return;
}
switch(node.getType()) {
case SIMPLE_FOLDER:
setEnabled(false);
return;
case SYSTEM_FOLDER:
if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(node) || !isParentNode(node)) {
setEnabled(false);
return;
}
this.setText(getCreateLabel());
collectChildNames(node);
creation = true;
break;
case REPOSITORY_ELEMENT:
if (!isParentNode(node.getParent())) {
setEnabled(false);
return;
}
if (factory.isPotentiallyEditable(node.getObject())) {
this.setText(getEditLabel());
collectSiblingNames(node);
} else {
this.setText(getOpenLabel());
}
collectSiblingNames(node);
creation = false;
break;
default:
return;
}
setEnabled(true);
}
use of org.talend.repository.hadoopcluster.node.HadoopFolderRepositoryNode in project tbd-studio-se by Talend.
the class AbstractHadoopRepositoryContentHandler method createHadoopFolderNode.
protected RepositoryNode createHadoopFolderNode(RepositoryNode parentNode, ERepositoryObjectType nodeType, String folderName, int childrenNum) {
StringBuffer floderName = new StringBuffer();
floderName.append(folderName);
// $NON-NLS-1$
floderName.append("(");
floderName.append(childrenNum);
// $NON-NLS-1$
floderName.append(")");
RepositoryNode typeFolderNode = new HadoopFolderRepositoryNode(parentNode, floderName.toString());
typeFolderNode.setProperties(EProperties.CONTENT_TYPE, nodeType);
return typeFolderNode;
}
use of org.talend.repository.hadoopcluster.node.HadoopFolderRepositoryNode in project tbd-studio-se by Talend.
the class CreateHadoopNodeAction method init.
@Override
protected void init(RepositoryNode node) {
ERepositoryObjectType nodeType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
if (nodeType == null) {
return;
}
if (hideAction(node)) {
return;
}
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (HCRepositoryUtil.isHadoopClusterNode(node) || (node instanceof HadoopFolderRepositoryNode && getNodeType().equals(nodeType))) {
if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(node) || (node.getObject() != null && factory.getStatus(node.getObject()) == ERepositoryStatus.DELETED)) {
setEnabled(false);
return;
}
this.setText(getCreateLabel());
collectChildNames(node);
creation = true;
setEnabled(true);
return;
}
if (!nodeType.equals(getNodeType())) {
return;
}
switch(node.getType()) {
case SIMPLE_FOLDER:
if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
setEnabled(false);
return;
}
break;
case SYSTEM_FOLDER:
if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(node)) {
setEnabled(false);
return;
}
this.setText(getCreateLabel());
collectChildNames(node);
creation = true;
break;
case REPOSITORY_ELEMENT:
if (factory.isPotentiallyEditable(node.getObject())) {
this.setText(getEditLabel());
collectSiblingNames(node);
} else {
this.setText(getOpenLabel());
}
collectSiblingNames(node);
creation = false;
break;
default:
return;
}
setEnabled(true);
}
Aggregations