Bug 147530 [DataBinding] Provide event objects for change listeners
Before data binding goes 1.0 it would be wise to provide EventObjects for the following listeners to ensure that the API doesn't preclude future expansion of the values supplied to listeners. Interfaces that would be affected: * IValueChangeListener * IValueChangingListener * IListChangeListener * ISetChangeListener * IMappingChangeListener
tests/org.eclipse.jface.tests.databinding/src/org/eclipse/jface/tests/internal/databinding/provisional/viewers/SelectionObservableValueTest.java
public void testSetValue() throws Exception {
        Shell shell = new Shell();
        ListViewer viewer = new ListViewer(shell);
        String[] items = new String[] {"1", "2", "3"};
        viewer.setContentProvider(new ArrayContentProvider());
        viewer.setInput(items);
        
        IObservableValue observable = ViewersObservables.observeSingleSelection(viewer);
        ValueChangeListener listener = new ValueChangeListener();
        observable.addValueChangeListener(listener);
        
        assertNull(observable.getValue());
        assertEquals(StructuredSelection.EMPTY, viewer.getSelection());
        assertEquals(0, listener.count);
        
        observable.setValue(items[0]);
        assertEquals("observable value", items[0], observable.getValue());
        assertEquals("viewer selection", items[0], ((StructuredSelection) viewer.getSelection()).getFirstElement());
        assertEquals("value change event", 1, listener.count);
        
        observable.setValue(items[0]);
        assertEquals("value did not change, event should not have fired", 1, listener.count);
        
        observable.setValue(null);
        assertNull(observable.getValue());
        assertEquals("viewer selection should be empty", StructuredSelection.EMPTY, viewer.getSelection());
        assertEquals("value change event did not fire", 2, listener.count);
    }
    
    private static class ValueChangeListener implements IValueChangeListener {