I want to fetch data if a specific element of a tree is expanded.
public void treeExpanded(TreeExpansionEvent event) {
Object element = event.getElement();
if (element instanceof MyClass) {
fetch.......
}
}
The problem is that the content provider seems to trigger getChildren()
before the treeExpanded()-method so I get a NullPointerException
everytime I expand the element because the content provider tries to use the data which is never fetched. How can i solve this properly?