Search in sources :

Example 1 with IViewerObservable

use of org.eclipse.jface.databinding.viewers.IViewerObservable in project eclipse.platform.ui by eclipse-platform.

the class ControlDecorationSupport method findControl.

private Control findControl(IObservable target) {
    if (target instanceof ISWTObservable) {
        Widget widget = ((ISWTObservable) target).getWidget();
        if (widget instanceof Control)
            return (Control) widget;
    }
    if (target instanceof IViewerObservable) {
        Viewer viewer = ((IViewerObservable) target).getViewer();
        return viewer.getControl();
    }
    if (target instanceof IDecoratingObservable) {
        IObservable decorated = ((IDecoratingObservable) target).getDecorated();
        Control control = findControl(decorated);
        if (control != null)
            return control;
    }
    if (target instanceof IObserving) {
        Object observed = ((IObserving) target).getObserved();
        if (observed instanceof IObservable)
            return findControl((IObservable) observed);
    }
    return null;
}
Also used : Control(org.eclipse.swt.widgets.Control) IObserving(org.eclipse.core.databinding.observable.IObserving) IDecoratingObservable(org.eclipse.core.databinding.observable.IDecoratingObservable) Widget(org.eclipse.swt.widgets.Widget) IObservable(org.eclipse.core.databinding.observable.IObservable) Viewer(org.eclipse.jface.viewers.Viewer) ISWTObservable(org.eclipse.jface.databinding.swt.ISWTObservable) IViewerObservable(org.eclipse.jface.databinding.viewers.IViewerObservable)

Aggregations

IDecoratingObservable (org.eclipse.core.databinding.observable.IDecoratingObservable)1 IObservable (org.eclipse.core.databinding.observable.IObservable)1 IObserving (org.eclipse.core.databinding.observable.IObserving)1 ISWTObservable (org.eclipse.jface.databinding.swt.ISWTObservable)1 IViewerObservable (org.eclipse.jface.databinding.viewers.IViewerObservable)1 Viewer (org.eclipse.jface.viewers.Viewer)1 Control (org.eclipse.swt.widgets.Control)1 Widget (org.eclipse.swt.widgets.Widget)1