Help! an issue after removed the filter [message #642669] |
Thu, 02 December 2010 09:44 |
Zongyong Qin Messages: 4 Registered: December 2010 |
Junior Member |
|
|
Hi,
I get a problem when use the filter to a CheckboxTreeViewer, could anyone help me?
I add a filter, which is just to return the checked elements, to a CheckboxTreeViewer, the filter is like:
class TreeFilter extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
ItemRecord record = (ItemRecord) element;
return repositoryTree.getChecked(record);
}
}
it works to filter the tree, but after that ,I removed this filter, the problem is happened: the before checked item is unchecked automatically, if add this fiter agian, it can't work well any more.
I create a check box to add or remove the filter, the code is like:
showSelectBTN.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (showSelectBTN.getSelection()) {
repositoryTree.addFilter(treeFilter);
} else {
repositoryTree.removeFilter(treeFilter);
repositoryTree.expandAll();
}
}
});
any suggestion is appreciated!
Regards,
Zongyong
|
|
|
|
Powered by
FUDForum. Page generated in 0.03468 seconds