| 
| TreeViewer Performance [message #327628] | Sat, 26 April 2008 16:37 |  | 
| Eclipse User  |  |  |  |  | Originally posted by: micha.bgl.gmx.de 
 Hi there,
 
 relating to this topic I found already a few threads in the internet. I have
 in one view a treeviewer with some tabs which is updated by several actions
 in another view. Cause I don't want to reload the view with the tree viewer
 (it's the center view of my plug-in) , I would like to use this TreeViewer
 even to present some tables. This is also no problem. But the amount of data
 (10000 elements). In fact if I use the TreeViewer as "TableViewer" (all
 elements of the input list are parents without any children) the performance
 is really bad. I've already read that it is possible to use SWT.VIRTUAL and
 ILazyTreeContentProvider to solve the performance problem for TreeViewer
 with a lot of parents and children. So I adpated the snippet047, but it
 didn't work.
 
 here is my code:
 
 public LazyRawContentProvider(){
 model = Calculation.getInstance(); // model for getting my data
 }
 
 @Override
 public Object getParent(Object element) {
 return model.getDatalines().toArray();
 }
 
 @Override
 public void updateChildCount(Object element, int currentChildCount) {
 int length = 0;
 if(element == elements)
 length = elements.length;
 tviewer.setChildCount(element, length);
 }
 
 @Override
 public void updateElement(Object parent, int index) {
 Object element;
 element =  elements[index];
 tviewer.replace(parent, index, element);
 updateChildCount(element, -1);
 }
 
 @Override
 public void dispose() {
 // TODO Auto-generated method stub
 
 }
 
 @Override
 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
 this.tviewer = (TreeViewer) viewer;
 this.elements = (Object[])newInput;
 }
 
 I hope you can help me. Thanks.
 
 ciao,
 micha
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.03967 seconds