use of org.talend.core.repository.model.provider.AbstractMetadataExtractorViewProvider 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.core.repository.model.provider.AbstractMetadataExtractorViewProvider in project tbd-studio-se by Talend.
the class HCatalogTableSelectorForm 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 TableSelectorViewerFilter());
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) {
IHCatalogNode node = (IHCatalogNode) item.getData();
if (isExistTable(node)) {
item.setChecked(true);
} else {
item.setChecked(false);
}
}
}
}
});
int columnWidth1 = 300;
int columnWidth2 = 125;
int columnWidth3 = 140;
TreeColumn tableName = new TreeColumn(schemaTree, SWT.NONE);
// $NON-NLS-1$
tableName.setText(Messages.getString("HCatalogTableSelectorForm.schemaTree.nameColumn"));
tableName.setWidth(columnWidth1);
TreeColumn nbColumns = new TreeColumn(schemaTree, SWT.RIGHT);
// $NON-NLS-1$
nbColumns.setText(Messages.getString("HCatalogTableSelectorForm.schemaTree.numberColumn"));
nbColumns.setWidth(columnWidth2);
TreeColumn creationStatus = new TreeColumn(schemaTree, SWT.RIGHT);
// $NON-NLS-1$
creationStatus.setText(Messages.getString("HCatalogTableSelectorForm.schemaTree.statusColumn"));
creationStatus.setWidth(columnWidth3);
AbstractMetadataExtractorViewProvider viewProvider = new TableSelectorTreeViewerProvider();
schemaTreeViewer.setLabelProvider(viewProvider);
schemaTreeViewer.setContentProvider(viewProvider);
// schemaTreeViewer.setInput(getConnection());
scrolledCompositeFileViewer.setContent(schemaTree);
scrolledCompositeFileViewer.setMinSize(schemaTree.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
Aggregations