diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings index 33be2d7a21a1c9fc530116dd7becaa0f28b84380..5fc05483d0dd0ef2199071ef2e556e06f801f25d 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/.ratings @@ -1,7 +1,7 @@ ActionUtils.java 4553e487264e3d1f86f4767da4a7400cce4b9a5d GREEN ConstraintsUIUtils.java 69d5e08bbf768baf2790380e36f1020ef826a33e GREEN CopyPasteUtils.java bbc5cf9c9dc03ebf8dc75d42c919fe6eb60b388e GREEN -DataBindingUtils.java 6ae66457694227b69c13c092ef62babdd4a2a137 GREEN +DataBindingUtils.java 631c47881caa13fc567679a7e4416eb777af0713 GREEN DragAndDropUtils.java 7aab91518aa12d76533a345bf6ed0be9ac7ff0e5 GREEN EObjectSelectionUtils.java 128cf8f96c6b9478171dff3deda662d5934f5f44 GREEN HierarchicalNameViewerComparator.java 199d82e392d4e437810cc65c0fc521dab52038e0 GREEN diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java index 6ae66457694227b69c13c092ef62babdd4a2a137..631c47881caa13fc567679a7e4416eb777af0713 100644 --- a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java +++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/util/DataBindingUtils.java @@ -29,6 +29,7 @@ import org.eclipse.jface.databinding.swt.WidgetProperties; import org.eclipse.jface.fieldassist.ControlDecoration; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Widget; /** * Utility methods for data binding support. @@ -214,12 +215,38 @@ public final class DataBindingUtils { * @param control * the source {@link Control} * @return an observable value observing this value property on the given - * widget + * {@link Control}. */ public static ISWTObservableValue observeText(Control control, final int event) { return WidgetProperties.text(event).observe(control); } + /** + * Returns an {@link ISWTObservableValue} observing this value property on + * the given {@link Widget}. + * + * @param widget + * the {@link Widget} + * @return an observable value observing this value property on the given + * {@link Widget}. + */ + public static ISWTObservableValue observeSelection(Widget widget) { + return WidgetProperties.selection().observe(widget); + } + + /** + * Returns an observable value tracking the visible state of the given + * {@link Control}. + * + * @param control + * the {@link Control} + * @return an observable value tracking the visible state of the given + * {@link Control}. + */ + public static ISWTObservableValue observeVisible(Control control) { + return WidgetProperties.visible().observe(control); + } + /** * Performs a complex binding of a cell editor control to a model element. The * validation is performed on modification (i.e. always), while model