package de.afbb.bibo.databinding;

import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Text;

/**
 * utility class to hold common binding methods
 * 
 * @author dbecker
 */
public final class BindingHelper {

	private BindingHelper() {
	}

	/**
	 * creates a bidirectional binding for a text field.<br>
	 * changes in model will be instantly reflected by the target and vice versa.
	 * 
	 * @param textField
	 *            widget for input
	 * @param entity
	 *            class that holds the model informations
	 * @param entityClass
	 *            class of entity
	 * @param propertyName
	 *            name of the property that should be binded. expected to be of {@link String} type
	 * @param bindingContext
	 *            context of the binding
	 */
	public static void bindStringToTextField(final Text textField, final Object entity, final Class<?> entityClass,
			final String propertyName, final DataBindingContext bindingContext) {
		final ISWTObservableValue targetObservable = SWTObservables.observeText(textField, SWT.Modify);
		final IObservableValue modelObservable = BeanProperties.value(entityClass, propertyName).observe(entity);
		bindingContext.bindValue(targetObservable, modelObservable);
	}

}

@@ -30,16 +30,62 @@
 ing;%0D%0A%0D%0A
+import org.eclipse.core.databinding.Binding;%0D%0A
 import o
@@ -1136,16 +1136,37 @@
 inding%0D%0A
+%09 * @return binding%0D%0A
 %09 */%0D%0A%09p
@@ -1182,12 +1182,15 @@
 tic 
-void
+Binding
  bin
@@ -1564,16 +1564,23 @@
 ty);%0D%0A%09%09
+return 
 bindingC

change return type of binding method