Community
Participate
Working Groups
this code works ten times slower for tree. (expanding the whole tree) boolean expand = true/false; TreeItem[] subItems = treeAccounts.getItems(); for (int k = 0; k < subItems.length; k++) { expandTree(subItems[k], expand); } .. .. public void expandTree(TreeItem treeItem, boolean expand) { treeItem.setExpanded(expand); TreeItem[] subTree = treeItem.getItems(); for (int k = 0; k < subTree.length; k++) { expandTree(subTree[k], expand); } }
*** Bug 107418 has been marked as a duplicate of this bug. ***
This is happening because Windows is running animation.
workaround: expand, collapse (and inserts/removals) are slow for tree. Hide the tree at the start of these events and show it at the end. For the expand event, use the below code (same can be used for SWT.Collapse) this might be windows-only, so check that the OS==windows before adding the listener. causes a slight flicker. tree.addListener(SWT.Expand, new Listener() { public void handleEvent(Event event) { tree.setVisible(false); Display.getCurrent().asyncExec( new Runnable() { public void run() { tree.setVisible(true); tree.forceFocus(); } }); } }); keywords: swt slow tree expand tree collapse tree animation
Seems wrong to me. The correct platform behavior is to have the animation. Why not turn it off using the Control Panel instead?