Community
Participate
Working Groups
Either calling dispose() on a TreeItem or removeAll() on the Tree results in TreeEvents being fired. That happens in case the disposed TreeItem was expanded and contained children. Mac seems to collapse all expanded TreeItems at first before proceeding with the disposal. This is not happening on Windows, and I dont think its happening on Linux GTK or Solaris Motif either. Ben
GG to construct a simple example and/or demonstate the difference in the ControlExample, then fix with SN.
click on the Tree in the snippet to dispose its root item: public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10,10,200,200); Tree tree = new Tree(shell, SWT.NONE); tree.setBounds(10,10,100,100); final TreeItem root = new TreeItem(tree, SWT.NONE); root.setText("root"); TreeItem child = new TreeItem(root, SWT.NONE); child.setText("child"); tree.addTreeListener(new TreeAdapter() { public void treeCollapsed(TreeEvent e) { System.out.println("collapsed"); } }); tree.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event event) { root.dispose(); } }); root.setExpanded(true); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
fixed > 0426, but note that this will NOT be in this week's integration build