use of org.talend.designer.hdfsbrowse.ui.provider.FileSelectorTreeViewerProvider in project tbd-studio-se by Talend.
the class HDFSFileSelectorForm method addSchemaFields.
private void addSchemaFields() {
schemaTreeViewer = new ContainerCheckedTreeViewer(scrolledCompositeFileViewer, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
schemaTreeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
schemaTreeViewer.setUseHashlookup(true);
schemaTreeViewer.addFilter(new FileSelectorViewerFilter());
schemaTree = schemaTreeViewer.getTree();
schemaTree.setHeaderVisible(true);
schemaTree.setLinesVisible(true);
schemaTree.addListener(SWT.Expand, new Listener() {
@Override
public void handleEvent(Event event) {
TreeItem treeItem = (TreeItem) event.item;
for (TreeItem item : treeItem.getItems()) {
if (item.getData() != null) {
IHDFSNode node = (IHDFSNode) item.getData();
if (node.getType() == EHadoopFileTypes.FILE) {
if (isExistTable(node)) {
item.setChecked(true);
updateParentItemCheckStatus(item);
} else {
TreeEditor treeEditor = treeEditorMap.get(item);
if (treeEditor == null) {
item.setChecked(false);
}
}
} else {
// item.setGrayed(item.getChecked());
}
}
}
}
});
int columnWidth1 = 250;
int columnWidth2 = 100;
int columnWidth3 = 110;
int columnWidth4 = 130;
int columnWidth5 = 140;
TreeColumn fileName = new TreeColumn(schemaTree, SWT.LEFT);
// $NON-NLS-1$
fileName.setText(Messages.getString("HDFSFileSelectorForm.schemaTree.nameColumn"));
fileName.setWidth(columnWidth1);
TreeColumn fileType = new TreeColumn(schemaTree, SWT.LEFT);
// $NON-NLS-1$
fileType.setText(Messages.getString("HDFSFileSelectorForm.schemaTree.typeColumn"));
fileType.setWidth(columnWidth2);
TreeColumn fileSize = new TreeColumn(schemaTree, SWT.LEFT);
// $NON-NLS-1$
fileSize.setText(Messages.getString("HDFSFileSelectorForm.schemaTree.sizeColumn"));
fileSize.setWidth(columnWidth3);
TreeColumn nbColumns = new TreeColumn(schemaTree, SWT.LEFT);
// $NON-NLS-1$
nbColumns.setText(Messages.getString("HDFSFileSelectorForm.schemaTree.numberColumn"));
nbColumns.setWidth(columnWidth4);
TreeColumn creationStatus = new TreeColumn(schemaTree, SWT.LEFT);
// $NON-NLS-1$
creationStatus.setText(Messages.getString("HDFSFileSelectorForm.schemaTree.statusColumn"));
creationStatus.setWidth(columnWidth5);
AbstractMetadataExtractorViewProvider viewProvider = new FileSelectorTreeViewerProvider();
schemaTreeViewer.setLabelProvider(viewProvider);
schemaTreeViewer.setContentProvider(viewProvider);
schemaTreeViewer.setInput(connectionBean = getConnectionBean());
scrolledCompositeFileViewer.setContent(schemaTree);
scrolledCompositeFileViewer.setMinSize(schemaTree.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
use of org.talend.designer.hdfsbrowse.ui.provider.FileSelectorTreeViewerProvider in project tbd-studio-se by Talend.
the class HDFSBrowseDialog method createHDFSTreeField.
private void createHDFSTreeField(Composite composite) {
viewer = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
viewer.setUseHashlookup(true);
tree = viewer.getTree();
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
// $NON-NLS-1$
column1.setText(Messages.getString("HDFSBrowseDialog.column.name"));
column1.setWidth(300);
column1.setResizable(true);
TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
// $NON-NLS-1$
column2.setText(Messages.getString("HDFSBrowseDialog.column.type"));
column2.setWidth(120);
column2.setResizable(true);
TreeColumn column3 = new TreeColumn(tree, SWT.LEFT);
// $NON-NLS-1$
column3.setText(Messages.getString("HDFSBrowseDialog.column.size"));
column3.setWidth(150);
column3.setResizable(true);
FileSelectorTreeViewerProvider provider = new FileSelectorTreeViewerProvider();
viewer.setContentProvider(provider);
viewer.setLabelProvider(provider);
viewer.setInput(connectionBean);
viewer.expandToLevel(2);
}
Aggregations