Search in sources :

Example 1 with UIValueListener

use of org.springsource.ide.eclipse.commons.livexp.core.UIValueListener in project eclipse-integration-commons by spring-projects.

the class SwtConnect method connect.

public static void connect(Label widget, LiveExpression<String> model) {
    ValueListener<String> modelListener = new UIValueListener<String>() {

        @Override
        protected void uiGotValue(LiveExpression<String> exp, String value) {
            String newText = model.getValue();
            if (newText == null) {
                newText = "";
            }
            widget.setText(newText);
        }
    };
    model.addListener(modelListener);
    widget.addDisposeListener(xx -> model.removeListener(modelListener));
}
Also used : StyledString(org.eclipse.jface.viewers.StyledString) LiveExpression(org.springsource.ide.eclipse.commons.livexp.core.LiveExpression) UIValueListener(org.springsource.ide.eclipse.commons.livexp.core.UIValueListener)

Aggregations

StyledString (org.eclipse.jface.viewers.StyledString)1 LiveExpression (org.springsource.ide.eclipse.commons.livexp.core.LiveExpression)1 UIValueListener (org.springsource.ide.eclipse.commons.livexp.core.UIValueListener)1