SWT TreeViewer在填充许多元素时很慢 [英] SWT TreeViewer is slow when filling with many elements
问题描述
我正在开发Eclipse视图部分, m填充具有以下数据结构的SWT树视图。所有数据都在内存中:
Node1
Child1
Child2
Node2
Child1
...
Child2915
我觉得这不是很大树,但它被缓慢绘制(10秒)。我已经在.NET中管理超过10.000个元素的树,并且它顺利地加载。我不知道我是否实现了代码,但是如果我没有调用$ code> BeginUpdate() - EndUpdate()。
我必须在Java / SWT中调用类似的东西吗?关于为什么这么慢的树的任何其他提示?
最后,我使用 setRedraw(boolean value )
在我的TreeViewer调用刷新后。
public void refresh(){
try {
mTreeViewer.getControl()。setRedraw(false);
mTreeViewer.refresh(true);
mTreeViewer.expandAll();
}
finally {
mTreeViewer.getControl()。setRedraw(true);
}
}
I'm new in the java world, so I'm sorry if my question is trivial.
I'm developing a Eclipse view part, and I'm filling a SWT tree view with the following data structure. All data is in memory:
Node1
Child1
Child2
Node2
Child1
...
Child2915
I think that is not a very big tree, but it is slow being drawn (10 seconds). I have manage trees in .NET with more than 10.000 elements and it loaded smoothly. I don't know if I've implemented the code, but the same problem appeared in .NET if I did not call BeginUpdate() - EndUpdate()
.
Must I call something similar in Java/SWT? Any other tips about why the tree is so slow?
Finally, I used setRedraw(boolean value)
after calling refresh in my TreeViewer.
public void refresh() {
try {
mTreeViewer.getControl().setRedraw(false);
mTreeViewer.refresh(true);
mTreeViewer.expandAll();
}
finally {
mTreeViewer.getControl().setRedraw(true);
}
}
这篇关于SWT TreeViewer在填充许多元素时很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!