[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] How to do a tree search?

I am using a treeviewer to display a tree.

I have attached a keylistener to the tree. I want to search tree
base on keystrokes. I am able to capture keystrokes on tree- but I don't know


how to proceed with search on the tree - When I search the tree from beginning and then expand items to get children it takes up plenty of time - Also there is flicker on the the screen as I am expanding treeItem to get to their children.

When I search the treeModel that was used as an input and find the object, I am not able to set tree selection
e.g. Object[] oArr = new Object[1];
oArr[0] = obj3; // obj3 is object found from treemodal search

TreePath tp = new TreePath(oArr);
TreePath[] pArr = new TreePath[1];
pArr[0] = tp;
tv.setExpandedTreePaths(pArr); // tv = treeViewer
TreeSelection ts = new TreeSelection(tp);
tv.setSelection(ts, true);


I would appreciate if anybody can help me with this problem or tree search in eclipse.

Thanks

Dhiresh