Bug 198519 [DataBinding] JavaBeanObservableValue may cause NPE when used with ComputedValue
Build ID: I20070625-1500 Steps To Reproduce: Simple case: new ComputedValue() { final IObservableValue name = BeansObservables.observeValue(dto, "name"); //$NON-NLS-1$ @Override protected Object calculate() { return name.getValue() != null; } }; More information: When ComputedValue recalculates the value, it calls the makeDirty() and then stopListening() methods which, in turn, may result in call to lastListenerRemoved() (if there are no other listeners attached) in the JavaBeanObservableValue class, causing listenerSupport.dispose() call. From now on, adding new listeners (which happens next during the calculate call) will cause NullPointerException.
tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/internal/beans/JavaBeanObservableValueTest.java
public void testGetPropertyDescriptor() throws Exception {
    	assertEquals(propertyDescriptor, observableValue.getPropertyDescriptor());
	}
    
    public void testRegistersListenerAfterFirstListenerIsAdded() throws Exception {
		assertFalse(bean.changeSupport.hasListeners(propertyName));
		observableValue.addValueChangeListener(new ValueChangeEventTracker());
		assertTrue(bean.changeSupport.hasListeners(propertyName));
	}
    
    public void testRemovesListenerAfterLastListenerIsRemoved() throws Exception {
    	ValueChangeEventTracker listener = new ValueChangeEventTracker();
		observableValue.addValueChangeListener(listener);
		
		assertTrue(bean.changeSupport.hasListeners(propertyName));
		observableValue.removeValueChangeListener(listener);
		assertFalse(bean.changeSupport.hasListeners(propertyName));
	}
    
    public void testFiresValueChangeEvents() throws Exception {
    	ValueChangeEventTracker listener = new ValueChangeEventTracker();
    	observableValue.addValueChangeListener(listener);
    	
    	assertEquals(0, listener.count);
    	bean.setValue(bean.getValue() + bean.getValue());
    	assertEquals(1, listener.count);
	}
	public void testSetValueThrowsExceptionThrownByBean() throws Exception {
		ThrowsSetException temp = new ThrowsSetException();