Author: adietish
Date: 2011-10-03 12:24:34 -0400 (Mon, 03 Oct 2011)
New Revision: 35287
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/DataBindingUtils.java
Log:
[JBIDE-9805] moved DatabindingUtils to org.jboss.tools.common.ui
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 2011-10-03
15:37:20 UTC (rev 35286)
+++
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/databinding/DataBindingUtils.java 2011-10-03
16:24:34 UTC (rev 35287)
@@ -14,10 +14,10 @@
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.ValidationStatusProvider;
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.IObservableValue;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
@@ -45,7 +45,8 @@
* the data binding context to use when binding
*/
public static void bindButtonEnablementToValidationStatus(final Button button,
- IObservableCollection validationStatusProviders, DataBindingContext dbc) {
+ DataBindingContext dbc, Binding... bindings) {
+ IObservableCollection validationStatusProviders = toObservableCollection(bindings);
dbc.bindValue(
WidgetProperties.enabled().observe(button),
createAggregateValidationStatus(validationStatusProviders, dbc),
@@ -77,16 +78,16 @@
}
/**
- * Returns an observable collection for a given array of observable values.
+ * Returns an observable collection for a given array of validation status providers.
*
* @param observableValue
* the array of observable values
* @return an observable collection
*/
- public static IObservableCollection toObservableCollection(IObservableValue...
observableValues) {
+ private static IObservableCollection toObservableCollection(ValidationStatusProvider...
validationStatusProviders) {
WritableList observableCollection = new WritableList();
- for (IObservableValue observableValue : observableValues) {
- observableCollection.add(observableValue);
+ for (ValidationStatusProvider validationStatusProvider : validationStatusProviders) {
+ observableCollection.add(validationStatusProvider);
}
return observableCollection;
}
Show replies by date