use of org.eclipse.core.internal.databinding.conversion.ObjectToStringConverter in project jbosstools-openshift by jbosstools.
the class DeployImagePage method createDockerConnectionInfoControl.
private void createDockerConnectionInfoControl(Composite parent, DataBindingContext dbc) {
Label lblConnection = createDockerConnectionLabel(parent);
final Text connectionText = new Text(parent, SWT.READ_ONLY | SWT.NO_FOCUS);
connectionText.setBackground(lblConnection.getBackground());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(NUM_COLUMS - 1, 1).grab(true, false).applyTo(connectionText);
final IObservableValue<String> connnectionTextObservable = WidgetProperties.text(SWT.None).observe(connectionText);
final IObservableValue<IDockerConnection> connnectionObservable = BeanProperties.value(IDeployImagePageModel.PROPERTY_DOCKER_CONNECTION).observe(model);
ValueBindingBuilder.bind(connnectionTextObservable).notUpdatingParticipant().to(connnectionObservable).converting(new ObjectToStringConverter(IDockerConnection.class) {
ConnectionColumLabelProvider labelProvider = new ConnectionColumLabelProvider();
@Override
public Object convert(Object source) {
return (source instanceof IDockerConnection) ? dockerConnectionToString((IDockerConnection) source) : "";
}
}).in(dbc);
}
use of org.eclipse.core.internal.databinding.conversion.ObjectToStringConverter in project jbosstools-openshift by jbosstools.
the class DeployImagePage method createOpenShiftConnectionControl.
private void createOpenShiftConnectionControl(Composite parent, DataBindingContext dbc) {
Label lblConnection = new Label(parent, SWT.NONE);
lblConnection.setText("OpenShift Connection: ");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(lblConnection);
final Text connectionText = new Text(parent, SWT.READ_ONLY | SWT.NO_FOCUS);
connectionText.setBackground(lblConnection.getBackground());
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(NUM_COLUMS - 1, 1).grab(true, false).applyTo(connectionText);
final IObservableValue<String> connnectionTextObservable = WidgetProperties.text(SWT.None).observe(connectionText);
final IObservableValue<IConnection> connnectionObservable = BeanProperties.value(IDeployImagePageModel.PROPERTY_CONNECTION).observe(model);
ValueBindingBuilder.bind(connnectionTextObservable).notUpdatingParticipant().to(connnectionObservable).converting(new ObjectToStringConverter(Connection.class) {
ConnectionColumLabelProvider labelProvider = new ConnectionColumLabelProvider();
@Override
public Object convert(Object source) {
return source == null ? "" : labelProvider.getText(source);
}
}).in(dbc);
}
Aggregations