[jbosstools-commits] JBoss Tools SVN: r44092 - trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Sep 27 10:28:58 EDT 2012
Author: adietish
Date: 2012-09-27 10:28:58 -0400 (Thu, 27 Sep 2012)
New Revision: 44092
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/DataBindingUtils.java
Log:
added DataBindingUtils#observeAndPrintValidationState to ease tracking of validation related bugs
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/DataBindingUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/DataBindingUtils.java 2012-09-27 12:29:29 UTC (rev 44091)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/DataBindingUtils.java 2012-09-27 14:28:58 UTC (rev 44092)
@@ -18,6 +18,8 @@
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.observable.IObservableCollection;
import org.eclipse.core.databinding.observable.list.WritableList;
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
@@ -131,4 +133,26 @@
return binding;
}
+ /**
+ * Observe and print validation state changes. Utility method to ease bug
+ * tracking.
+ *
+ * @param label the label to use when printing validation state changes
+ * @param dbc the databinding context to observe for validation changes
+ */
+ public static void observeAndPrintValidationState(final String label, DataBindingContext dbc) {
+ AggregateValidationStatus status = new AggregateValidationStatus(dbc, AggregateValidationStatus.MAX_SEVERITY);
+ status.addValueChangeListener(new IValueChangeListener() {
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ System.err.println("------------------------");
+ System.err.println(label);
+ System.err.println("------------------------");
+ System.err.println(event.diff.getNewValue());
+ System.err.println("------------------------");
+ }
+ });
+ }
+
}
More information about the jbosstools-commits
mailing list