use of org.talend.designer.hdfsbrowse.model.IHDFSNode in project tbd-studio-se by Talend.
the class FileSelectorTreeViewerProvider method getColumnText.
public String getColumnText(Object element, int columnIndex) {
IHDFSNode content = (IHDFSNode) element;
EHadoopFileTypes type = content.getType();
switch(columnIndex) {
case 0:
return StringUtils.trimToEmpty(content.getValue());
case 1:
return StringUtils.trimToEmpty(type.getValue());
case 2:
if (content instanceof HDFSFile) {
HDFSFile file = (HDFSFile) content;
return StringUtils.trimToEmpty(file.getSize());
} else {
return EMPTY_STRING;
}
default:
return EMPTY_STRING;
}
}
use of org.talend.designer.hdfsbrowse.model.IHDFSNode in project tbd-studio-se by Talend.
the class HDFSFileSelectorForm method restoreCheckItems.
protected void restoreCheckItems(TreeItem treeItem, List<String> checkedItems) {
// If all the checked items are updated then no need to restore.
if (checkedItems.size() == 0) {
return;
}
IHDFSNode node = (IHDFSNode) treeItem.getData();
if (node == null) {
return;
}
EHadoopFileTypes type = node.getType();
if (type == EHadoopFileTypes.FOLDER) {
for (TreeItem item : treeItem.getItems()) {
IHDFSNode childNode = (IHDFSNode) item.getData();
if (childNode == null) {
node.getChildren();
}
restoreCheckItems(item, checkedItems);
}
} else if (type == EHadoopFileTypes.FILE) {
refreshItem(treeItem);
checkedItems.remove(node.getTable().getName());
}
}
use of org.talend.designer.hdfsbrowse.model.IHDFSNode in project tbd-studio-se by Talend.
the class HDFSFileSelectorForm method fetchChildren.
private long fetchChildren(IHDFSNode node, IProgressMonitor monitor) {
if (monitor != null && monitor.isCanceled()) {
return 0;
}
node.forceFetchChildren();
long nodeSize = 0;
EHadoopFileTypes type = node.getType();
if (type == EHadoopFileTypes.FILE) {
nodeSize++;
}
List<IHDFSNode> children = node.getChildren();
if (monitor != null && monitor.isCanceled()) {
return 0;
}
if (children != null) {
for (IHDFSNode child : children) {
nodeSize += fetchChildren(child, monitor);
}
}
return nodeSize;
}
Aggregations