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/internal/viewers/SelectionProviderSingleSelectionObservableValueTest.java
* <li>Value change events are fired with appropriate diff values</li>
     * </ul>
     */
    public void testGetSetValue() {
        SelectionProviderSingleSelectionObservableValue observable = new SelectionProviderSingleSelectionObservableValue(
                SWTObservables.getRealm(Display.getDefault()),
                selectionProvider);
        ChangeListener listener = new ChangeListener();
        observable.addValueChangeListener(listener);
        assertNull(observable.getValue());
        selectionProvider.setSelection(new StructuredSelection(model[0]));
        assertEquals(1, listener.count);
        assertNull(listener.diff.getOldValue());
        assertEquals(model[0], listener.diff.getNewValue());
        assertEquals(observable, listener.source);
        assertEquals(model[0], observable.getValue());
        selectionProvider.setSelection(new StructuredSelection(model[1]));
        assertEquals(2, listener.count);
        assertEquals(model[0], listener.diff.getOldValue());
        assertEquals(model[1], listener.diff.getNewValue());
        assertEquals(observable, listener.source);
        assertEquals(model[1], observable.getValue());
        selectionProvider.setSelection(StructuredSelection.EMPTY);
        assertEquals(3, listener.count);
        assertEquals(model[1], listener.diff.getOldValue());
        assertNull(listener.diff.getNewValue());
        assertEquals(observable, listener.source);
        assertEquals(null, observable.getValue());
    }
    private class ChangeListener implements IValueChangeListener {