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/CheckboxTreeViewer.java
* setGrayed and setChecked as an optimization.
 * @param element the item being checked
 * @param state a boolean indicating selection or deselection
 * @return boolean indicating success or failure.
 */
public boolean setGrayChecked(Object element, boolean state) {
	Widget widget = internalExpand(element, false);
	if (widget instanceof TreeItem) {
		TreeItem item = (TreeItem) widget;
		item.setChecked(state);
		item.setGrayed(state);
		return true;
	}
	return false;
}
/**
 * Sets which elements are grayed in this viewer's tree.
 * The given list contains the elements that are to be grayed;
 * all other elements 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 grayedElements = new HashSet(elements.length*2+1);