Bug 198201 [DataBinding] Provide POJO observables
There have been quite a few requests on the newsgroup recently about trying to use POJOs and filling up logs with error messages about not being able to register property change event listeners. It would be nice to provide a cleaner solution than using the JavaBean support that we provide today.
tests/org.eclipse.jface.tests.databinding/src/org/eclipse/core/tests/internal/databinding/internal/beans/JavaBeanObservableSetTest.java
public void testRegistersListenerAfterFirstListenerIsAdded() throws Exception {
		assertFalse(bean.changeSupport.hasListeners(propertyName));
		observableSet.addSetChangeListener(new SetChangeListener());
		assertTrue(bean.changeSupport.hasListeners(propertyName));
	}
    
    public void testRemovesListenerAfterLastListenerIsRemoved() throws Exception {
		observableSet.addSetChangeListener(listener);
		
		assertTrue(bean.changeSupport.hasListeners(propertyName));
		observableSet.removeSetChangeListener(listener);
		assertFalse(bean.changeSupport.hasListeners(propertyName));
	}
	
	public void testFiresChangeEvents() throws Exception {
		observableSet.addSetChangeListener(listener);
		assertEquals(0, listener.count);
		bean.setSet(new HashSet(Arrays.asList(new String[] {"1"})));
		assertEquals(1, listener.count);
	}
	
	static class SetChangeListener implements ISetChangeListener {
		int count;
		public void handleSetChange(SetChangeEvent event) {
			count++;
		}
	}
}