use of org.eclipse.swt.events.TreeListener in project eclipse.platform.swt by eclipse.
the class Test_org_eclipse_swt_widgets_Tree method test_addTreeListenerTreeCollapsedAdapterLorg_eclipse_swt_events_TreeListener.
@Test
public void test_addTreeListenerTreeCollapsedAdapterLorg_eclipse_swt_events_TreeListener() {
TreeListener listener = TreeListener.treeCollapsedAdapter(e -> eventOccurred = true);
tree.addTreeListener(listener);
eventOccurred = false;
tree.notifyListeners(SWT.Collapse, new Event());
assertTrue(eventOccurred);
eventOccurred = false;
tree.notifyListeners(SWT.Expand, new Event());
assertFalse(eventOccurred);
tree.removeTreeListener(listener);
eventOccurred = false;
tree.notifyListeners(SWT.Collapse, new Event());
assertFalse(eventOccurred);
tree.notifyListeners(SWT.Expand, new Event());
assertFalse(eventOccurred);
}
Aggregations