use of com.amalto.workbench.widgets.FilteredCheckboxTree in project tmdm-studio-se by Talend.
the class TreeObjectCheckTreeViewer method createTreeViewer.
@Override
protected void createTreeViewer(Composite itemComposite) {
filteredCheckboxTree = new FilteredCheckboxTree(itemComposite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.FULL_SELECTION) {
ContainerCheckedTreeViewer treeViewer;
@Override
protected CheckboxTreeViewer doCreateTreeViewer(Composite parent, int style) {
treeViewer = new ContainerCheckedTreeViewer(parent, style);
contentProvider = new TreeObjectContentProvider(serverRoot);
treeViewer.setContentProvider(contentProvider);
installColumns();
treeViewer.setInput(serverRoot);
return treeViewer;
}
private void installColumns() {
treeViewer.getTree().setHeaderVisible(true);
//
TreeViewerColumn nameColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
nameColumn.getColumn().setWidth(320);
nameColumn.getColumn().setText(Messages.ConsistencyConflict_name);
nameColumn.setLabelProvider(new ServerTreeLabelProvider());
// compare result
TreeViewerColumn resultColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
resultColumn.getColumn().setWidth(120);
resultColumn.getColumn().setText(Messages.ConsistencyConflict_compareResult);
resultColumn.setLabelProvider(new CompareResultColumnProvider());
//
localTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
localTimeColumn.getColumn().setText(Messages.ConsistencyConflict_retrievalTimestamp);
localTimeColumn.setLabelProvider(new TimeStampColumnProvider(true));
//
serverTimeColumn = new TreeViewerColumn(treeViewer, SWT.NONE);
serverTimeColumn.getColumn().setText(Messages.ConsistencyConflict_serverTimestamp);
serverTimeColumn.setLabelProvider(new TimeStampColumnProvider(false));
//
showTimeStampColumns(false);
}
@Override
protected boolean isNodeCollectable(TreeItem item) {
return false;
}
@Override
protected void refreshCompleted() {
treeViewer.expandToLevel(3);
restoreCheckedElements();
}
};
filteredCheckboxTree.getViewer().addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
TreeObject node = (TreeObject) element;
return filterRepositoryNode(node, isOverWrite);
}
});
}
Aggregations