Bug 137877 [DataBinding] StructuredViewerObservableValue javadoc and code cleanup
I started looking at this class to see what it was doing and noticed a potential problem if anyone was to extend this class and this snowballed into adding javadoc, cleaning up the code a bit, and writing tests. Changes made: * documented doGetValue() and the constructor to warn of subclassing issues. see explanation below... * changed doGetValue() from public to protected. I'm assuming since this is a template method it is only meant for the eyes of subclasses and other package classes. * removed the 'attribute' parameter from the constructor because the constructor wouldn't allow but one value for attribute and would throw an IAE if it wasn't correct. Every method was then checking this variable for the same value and because it was only set at construction and only one value was allowed it seemed redundant. * removed 'attribute' from the class and from every method because of the removal of it from the constructor. * added validation for constructor parameters doGetValue() is public and if someone was to extend this class and override doGetValue() this method would get invoked before their subclass was fully initialized because their constructor would not have ran yet. Because this class extends from AbstractObservableValue and doGetValue() is declared as protected it didn't seem like much could be done about changing this so I ended up documenting it thoroughly in the constructor javadoc and the javadoc for doGetValue(). The constructor signature change and the validation the constructor parameter are both nonpassive changes. I also was wanting to rename the class to StructuredViewerSingleSelectionObservableValue but didn't do so in order to be able to provide a patch that allowed for the easy viewing of the changes made. Because of the constructor change I had to change ViewersObservableFactory as well when constructing the object.
bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/internal/viewers/StructuredViewerObservableValue.java
/*******************************************************************************
 * Copyright (c) 2005, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.internal.databinding.internal.viewers;
import org.eclipse.jface.internal.databinding.provisional.observable.Diffs;
import org.eclipse.jface.internal.databinding.provisional.observable.value.AbstractObservableValue;
import org.eclipse.jface.internal.databinding.provisional.viewers.ViewersProperties;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
/**
 * @since 3.2
 * 
 */
public class StructuredViewerObservableValue extends AbstractObservableValue {
	private final StructuredViewer viewer;