| How to expand a TreeViewer in a view through an IVewPart (verification hook) [message #70599] | 
Fri, 12 May 2006 06:13   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Hello :) 
  
I've done a testCase with the GUI Recorder where I insert a hook on the  
package explorer view. 
I've downloaded the Ali Mehregani's codes (cf. the  
" http://dev.eclipse.org/newslists/news.eclipse.tptp/msg01854. html" news to  
know more - very usefull) to get access to the controls located in this  
hooked View (the packageExplorer view), and particularly a tree (likely a  
TreeViewer). 
  
I've noticed that I can't get control on all the children of the tree in  
my code if it isn't fully expanded (am I right or do I need sleep? :p). To  
resolve the problem I just add a recursive method to perform a  
setExpanded(true) on each tree item. 
  
Surprisingly, it works but just a bit... 
The tree is expanded but the expanded items don't show up! 
I've somthing like this: 
  
** initial state -, for ex. fully collapsed but it doesn't matter: ** 
  
+MyTreeRoot 
  
** I perform the setExpanded)true) through my verification hook and I get  
: ** 
  
-MyTreeRoot 
|_                  << nothing 
  
** instead of (for example): ** 
  
-MyTreeRoot 
|_FirstChild 
| |_file1 
| 
|_SecondChild 
  
  
The weird thing is that if I "physically" click on the +MyTreeRoot to  
expand it, it perfectly works... 
  
I was wondering if it was due to the cast I made on my tree component (I  
did a cast from "Control" to "Tree") because I suppose that the tree in  
this view is a TreeViewer. 
  
If someone has a beginning of solution... Cheers  
  
Bertrand.
 |  
 |  
  | 
 | 
 | 
Powered by 
FUDForum. Page generated in 0.61121 seconds