Bug 15844 [Exception Handling] SelectionChange events and NPE
Build 20020508 Due to new global actions there are now more objects listening to selection changes send out by a JFace viewer. We now had the case that one of the listener generated a NPE. As a result all listeners registered after that one didn't receive the selection change event. StructuredViewers should be more fault tolorant to exceptions when informing listeners.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTableViewer.java
* all other nodes are to be ungrayed.
 * <p>
 * This method is typically used when restoring the interesting
 * state of a viewer captured by an earlier call to <code>getGrayedElements</code>.
 * </p>
 *
 * @param elements the array of grayed elements
 *
 * @see #getGrayedElements
 */
public void setGrayedElements(Object[] elements) {
	Set set = new HashSet(elements.length*2+1);
	for (int i = 0; i < elements.length; ++i) {
		set.add(elements[i]);
	}
	TableItem[] items = getTable().getItems();
	for (int i = 0; i < items.length; ++i) {
		TableItem item = items[i];
		Object element = item.getData();
		if (element != null) {
			boolean gray = set.contains(element);
			
			if (item.getGrayed() != gray) {
				item.setGrayed(gray);
			}
		}
	}
}
}