use of org.talend.dq.helper.RepositoryNodeComparator in project tdq-studio-se by Talend.
the class ExportWizardPage method createRepositoryTree.
/**
* DOC bZhou Comment method "createRepositoryTree".
*
* @param top
*/
protected void createRepositoryTree(Composite top) {
Composite treeComposite = new Composite(top, SWT.NONE);
treeComposite.setLayout(new GridLayout(2, false));
treeComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
repositoryTree = new ContainerCheckedTreeViewer(treeComposite);
repositoryTree.setContentProvider(new FileTreeContentProvider());
repositoryTree.setLabelProvider(new FileTreeLabelProvider());
repositoryTree.setInput(writer.computeInput(specifiedPath));
repositoryTree.expandAll();
repositoryTree.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
// ADD msjian TDQ-14573: automatically checked the initial selected items.
if (intCheckedElements != null) {
List<ItemRecord> selectedItemRecords = new ArrayList<ItemRecord>();
for (Object intCheckedElement : intCheckedElements) {
getFileFromNode(selectedItemRecords, (IRepositoryNode) intCheckedElement);
}
repositoryTree.setCheckedElements(selectedItemRecords.toArray());
}
// show the same order with repository tree
repositoryTree.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer iviewer, Object o1, Object o2) {
DQRepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(((ItemRecord) o1).getElement());
DQRepositoryNode recursiveFind2 = RepositoryNodeHelper.recursiveFind(((ItemRecord) o2).getElement());
return new RepositoryNodeComparator().compare(recursiveFind, recursiveFind2);
}
});
// TDQ-14573~
createUtilityButtons(treeComposite);
}
Aggregations