XViewer Depth First Search Filter and CustomizeManager [message #1071218] |
Fri, 19 July 2013 11:23  |
Eclipse User |
|
|
|
I would like XViewer to support a depth first search algorithm. In that if any of the children match it should also match the parent.
I accomplished this by overriding the getXViewerTextFilter method in my XViewer and returning an XViewer with following select method:
public boolean select(Viewer viewer, Object parentElement, Object element) {
ITreeContentProvider cp = (ITreeContentProvider) this.xViewer.getContentProvider();
boolean retVal = super.select(viewer, parentElement, element);
if (retVal) {
return true;
}
if (cp.hasChildren(element)) {
for (Object child : cp.getChildren(element)) {
retVal = select(viewer, element, child);
if (retVal) {
break;
}
}
}
return retVal;
}
This seems to work. Is there a better method?
Also, I'd like it to automatically expand to show all matching children. Unfortunately, it looks like to do this I would need to change the behavior of the CustomizeManager in the setFilterText method to do:
At the end of the method. However, there is no way to provide my own implementation of the CustomizeManager as it is a private field created in the constructor of the XViewer. Suggestions? It would be nice if the XViewerFactory provided a mechanism to provide my own CustomizeManager.
Thanks.
|
|
|
|
Powered by
FUDForum. Page generated in 0.06312 seconds