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/databinding/scenarios/PropertyScenarios.java
adventure.setPrice(5.0);
        fal Strg cannotBeNegativeMessage = "Price cannot be negative.";
        fal Strg mustBeCurrencyMessage = "Price must be a currency.";
        IValidator validator = new IValidator() {
            public IStatus validate(Object value) {
                Strg strgValue = (Strg) value;
                try {
                    double doubleValue = new Double(strgValue).doubleValue();
                    if (doubleValue < 0.0) {
                        return ValidationStatus.error(cannotBeNegativeMessage);
                    }
                    return Status.OK_STATUS;
                } catch (NumberFormatException ex) {
                    return ValidationStatus.error(mustBeCurrencyMessage);
                }
            }
        };
        getDbc().bdValue(SWTObservables.observeText(text, SWT.Modify),
                BeansObservables.observeValue(adventure, "price"),
                new DefaultBdSpec().setTargetValidator(validator));
        assertEquals("5.0", text.getText());
        assertTrue(((IStatus)getDbc().getValidationStatus().getValue()).isOK());
        enterText(text, "0.65");
        assertTrue(((IStatus)getDbc().getValidationStatus().getValue()).isOK());
        assertEquals(0.65, adventure.getPrice(), 0.0001);
        adventure.setPrice(42.24);
        assertEquals("42.24", text.getText());
        assertTrue(((IStatus)getDbc().getValidationStatus().getValue()).isOK());
        enterText(text, "jygt");
        assertEquals(mustBeCurrencyMessage, ((IStatus) getDbc().getValidationStatus().getValue()).getMessage());