Bug 242017 [DataBinding] ButtonObservableValue does bot store the inital value during init causing the next change to be dropped
Build ID: 3.4.0 - I20080617-2000 Steps To Reproduce: 1. Create a Check Box button whose initial value is CHECKED 2. Create a Text Box 2. Create a binding with checkbox's selection as the model with Text Box's enablement as the target 3. Watch the enablement change by checking, unchecking the check box The text box's enablement does not change when the check box is unchecked first. More information: This is due to the fact that the ButtonObservableValue in its init method does not store the initial selection status pf the button. Therefore the first change, transition to unchecked stated is falsely equal with the *current* state of the writable value. Therefore change is dropped and further bindings processing is terminated. Initializing the default current state with: this.selectionValue = button.getSelection(); at the end of the init method fixes the problem. Regards, Hasan Ceylan
bundles/org.eclipse.jface.databinding/src/org/eclipse/jface/internal/databinding/swt/ButtonObservableValue.java
/*******************************************************************************
 * Copyright (c) 2005, 2008 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
 *     Brad Reynolds - bug 164653
 *     Ashley Cambrell - bug 198904
 *******************************************************************************/
package org.eclipse.jface.internal.databinding.swt;
import org.eclipse.core.databinding.observable.Diffs;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.jface.internal.databinding.provisional.swt.AbstractSWTObservableValue;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
/**
 * @since 1.0
 * 
 */
public class ButtonObservableValue extends AbstractSWTObservableValue {