Example usage for org.eclipse.jface.databinding.swt SWTObservables observeTooltipText

List of usage examples for org.eclipse.jface.databinding.swt SWTObservables observeTooltipText

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.swt SWTObservables observeTooltipText.

Prototype

@Deprecated
public static ISWTObservableValue observeTooltipText(Control control) 

Source Link

Document

Returns an observable value tracking the tooltip text of the given control

Usage

From source file:com.rcpcompany.uibindings.uiAttributes.SimpleUIAttribute.java

License:Open Source License

@Override
public IObservableValue getTooltipValue() {
    Assert.isTrue(!isDisposed());/*from  ww w .j  ava  2s .  c  o  m*/
    if (myWidget instanceof Control) {
        final Control c = (Control) myWidget;
        return addObservable(SWTObservables.observeTooltipText(c));
    }
    return null;
}

From source file:org.eclipse.scada.ui.chart.viewer.controller.actions.ScaleActionController.java

License:Open Source License

public ScaleActionController(final ControllerManager controllerManager, final ChartContext chartContext,
        final ScaleAction controller) {
    super(controllerManager.getContext(), chartContext, controller);

    final DataBindingContext ctx = controllerManager.getContext();

    final Composite space = chartContext.getExtensionSpaceProvider().getExtensionSpace();
    if (space != null) {
        this.button = new Button(space, SWT.PUSH);
        this.button.addSelectionListener(new SelectionAdapter() {
            @Override//from  www  . j a  v a2 s.c  o  m
            public void widgetSelected(final SelectionEvent e) {
                action();
            };
        });

        addBinding(ctx.bindValue(PojoObservables.observeValue(this, "milliseconds"), //$NON-NLS-1$
                EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__TIMESPAN)));
        addBinding(ctx.bindValue(SWTObservables.observeText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__LABEL)));
        addBinding(ctx.bindValue(SWTObservables.observeTooltipText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__DESCRIPTION)));

        this.layoutListener = new IValueChangeListener() {

            @Override
            public void handleValueChange(final ValueChangeEvent event) {
                space.layout();
            }
        };

        this.labelProperty = EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__LABEL);
        this.labelProperty.addValueChangeListener(this.layoutListener);

        space.layout();
    } else {
        this.button = null;
    }
}

From source file:org.eclipse.scada.ui.chart.viewer.controller.actions.TimeShiftActionController.java

License:Open Source License

public TimeShiftActionController(final ControllerManager controllerManager, final ChartContext chartContext,
        final TimeShiftAction controller) {
    super(controllerManager.getContext(), chartContext, controller);

    final DataBindingContext ctx = controllerManager.getContext();

    final Composite space = chartContext.getExtensionSpaceProvider().getExtensionSpace();
    if (space != null) {
        this.button = new Button(space, SWT.PUSH);
        this.button.addSelectionListener(new SelectionAdapter() {
            @Override/* w ww .j  av a  2  s.c o  m*/
            public void widgetSelected(final SelectionEvent e) {
                action();
            };
        });
        addBinding(ctx.bindValue(PojoObservables.observeValue(this, "milliseconds"), //$NON-NLS-1$
                EMFObservables.observeValue(controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DIFF)));
        addBinding(ctx.bindValue(SWTObservables.observeText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL)));
        addBinding(ctx.bindValue(SWTObservables.observeTooltipText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DESCRIPTION)));

        this.layoutListener = new IValueChangeListener() {

            @Override
            public void handleValueChange(final ValueChangeEvent event) {
                space.layout();
            }
        };

        this.labelProperty = EMFObservables.observeValue(controller,
                ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL);
        this.labelProperty.addValueChangeListener(this.layoutListener);

        space.layout();
    } else {
        this.button = null;
    }
}

From source file:org.openscada.ui.chart.viewer.controller.actions.ScaleActionController.java

License:Open Source License

public ScaleActionController(final ControllerManager controllerManager, final ChartContext chartContext,
        final ScaleAction controller) {
    super(controllerManager.getContext(), chartContext, controller);

    final DataBindingContext ctx = controllerManager.getContext();

    final Composite space = chartContext.getExtensionSpaceProvider().getExtensionSpace();
    if (space != null) {
        this.button = new Button(space, SWT.PUSH);
        this.button.addSelectionListener(new SelectionAdapter() {
            @Override/*from w  w  w  .  j  a va 2 s.c om*/
            public void widgetSelected(final SelectionEvent e) {
                action();
            };
        });
        addBinding(ctx.bindValue(PojoObservables.observeValue(this, "milliseconds"), //$NON-NLS-1$
                EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__TIMESPAN)));
        addBinding(ctx.bindValue(SWTObservables.observeText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__LABEL)));
        addBinding(ctx.bindValue(SWTObservables.observeTooltipText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.SCALE_ACTION__DESCRIPTION)));
        space.layout();
    } else {
        this.button = null;
    }
}

From source file:org.openscada.ui.chart.viewer.controller.actions.TimeShiftActionController.java

License:Open Source License

public TimeShiftActionController(final ControllerManager controllerManager, final ChartContext chartContext,
        final TimeShiftAction controller) {
    super(controllerManager.getContext(), chartContext, controller);

    final DataBindingContext ctx = controllerManager.getContext();

    final Composite space = chartContext.getExtensionSpaceProvider().getExtensionSpace();
    if (space != null) {
        this.button = new Button(space, SWT.PUSH);
        this.button.addSelectionListener(new SelectionAdapter() {
            @Override//from w  w w  .  ja va 2s .co  m
            public void widgetSelected(final SelectionEvent e) {
                action();
            };
        });
        addBinding(ctx.bindValue(PojoObservables.observeValue(this, "milliseconds"), //$NON-NLS-1$
                EMFObservables.observeValue(controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DIFF)));
        addBinding(ctx.bindValue(SWTObservables.observeText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.TIME_SHIFT_ACTION__LABEL)));
        addBinding(ctx.bindValue(SWTObservables.observeTooltipText(this.button),
                EMFObservables.observeValue(controller, ChartPackage.Literals.TIME_SHIFT_ACTION__DESCRIPTION)));
        space.layout();
    } else {
        this.button = null;
    }
}

From source file:org.reap.internal.core.binding.BindingManager.java

License:Open Source License

private IObservable createSWTObservable(final Control control, final BindingConfig binding) {
    IObservable obs = null;// w  ww  .  j  a  v  a2 s  . co  m
    switch (binding.getType()) {
    case BACKGROUND:
        obs = SWTObservables.observeBackground(control);
        break;
    case EDITABLE:
        obs = SWTObservables.observeEditable(control);
        break;
    case ENABLED:
        obs = SWTObservables.observeEnabled(control);
        break;
    case FONT:
        obs = SWTObservables.observeFont(control);
        break;
    case FOREGROUND:
        obs = SWTObservables.observeForeground(control);
        break;
    case ITEMS:
        obs = SWTObservables.observeItems(control);
        break;
    case MAX:
        obs = SWTObservables.observeMax(control);
        break;
    case MIN:
        obs = SWTObservables.observeMin(control);
        break;
    case SELECTION:
        obs = SWTObservables.observeSelection(control);
        break;
    case SINGLESELECTIONINDEX:
        obs = SWTObservables.observeSingleSelectionIndex(control);
        break;
    case TEXT:
        obs = SWTObservables.observeText(control);
        break;
    case TEXTFOCUSOUT:
        obs = SWTObservables.observeText(control, SWT.FocusOut);
        break;
    case TEXTMODIFY:
        obs = SWTObservables.observeText(control, SWT.Modify);
        break;
    case TEXTNONE:
        obs = SWTObservables.observeText(control, SWT.None);
        break;
    case TOOLTIPTEXT:
        obs = SWTObservables.observeTooltipText(control);
        break;
    case VISIBLE:
        obs = SWTObservables.observeVisible(control);
        break;
    default:
        throw new IllegalArgumentException();
    }
    return obs;
}