/**
* Called when the child set changes. Should not be called directly by the viewer.
*/
public void handleSetChange(SetChangeEvent event) {
SetDiff diff = event.diff;
TreeViewer viewer = this.contentProvider.getViewer();
if (viewer != null) {
Control control = viewer.getControl();
if (control != null) {
if (control.isDisposed()) {
// If the widgetry was disposed without notifying the content provider, then
// dispose the content provider now and stop processing events.
contentProvider.dispose();
return;
}
}
}
boolean shouldHavePendingNode = children.isEmpty() && children.isStale();
Set additions = diff.getAdditions();
// Check if we should add the pending node
if (shouldHavePendingNode && !hasPendingNode) {
HashSet newAdditions = new HashSet();
newAdditions.addAll(additions);
newAdditions.add(contentProvider.getPendingNode());
additions = newAdditions;
hasPendingNode = true;
}
Set removals = diff.getRemovals();
// Check if we should remove the pending node
if (!shouldHavePendingNode && hasPendingNode) {
HashSet newRemovals = new HashSet();
newRemovals.addAll(removals);
newRemovals.add(contentProvider.getPendingNode());