Search in sources :

Example 1 with RequiredStringValidator

use of org.jboss.tools.openshift.internal.common.ui.databinding.RequiredStringValidator in project jbosstools-openshift by jbosstools.

the class OAuthDetailView method bindWidgetsToInternalModel.

private void bindWidgetsToInternalModel(DataBindingContext dbc) {
    IValidator validator = new RequiredStringValidator("token");
    this.tokenBinding = ValueBindingBuilder.bind(WidgetProperties.text(SWT.Modify).observe(tokenText)).converting(new TrimmingStringConverter()).validatingAfterConvert(validator).to(tokenObservable).validatingBeforeSet(validator).in(dbc);
    ControlDecorationSupport.create(tokenBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
    org.jboss.tools.common.ui.databinding.DataBindingUtils.addDisposableValueChangeListener(changeListener, tokenObservable, tokenText);
}
Also used : RequiredControlDecorationUpdater(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater) TrimmingStringConverter(org.jboss.tools.openshift.internal.common.ui.databinding.TrimmingStringConverter) IValidator(org.eclipse.core.databinding.validation.IValidator) RequiredStringValidator(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredStringValidator)

Example 2 with RequiredStringValidator

use of org.jboss.tools.openshift.internal.common.ui.databinding.RequiredStringValidator in project jbosstools-openshift by jbosstools.

the class BasicAuthenticationDetailView method bindWidgetsToInternalModel.

private void bindWidgetsToInternalModel(DataBindingContext dbc) {
    // username
    this.usernameBinding = ValueBindingBuilder.bind(WidgetProperties.text(SWT.Modify).observe(usernameText)).converting(new TrimmingStringConverter()).validatingAfterConvert(new RequiredStringValidator("v3 username")).to(usernameObservable).in(dbc);
    ControlDecorationSupport.create(usernameBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
    org.jboss.tools.common.ui.databinding.DataBindingUtils.addDisposableValueChangeListener(changeListener, usernameObservable, usernameText);
    // password
    this.passwordBinding = ValueBindingBuilder.bind(WidgetProperties.text(SWT.Modify).observe(passwordText)).converting(new TrimmingStringConverter()).validatingAfterConvert(new RequiredStringValidator("v3 password")).to(passwordObservable).in(dbc);
    ControlDecorationSupport.create(passwordBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
    org.jboss.tools.common.ui.databinding.DataBindingUtils.addDisposableValueChangeListener(changeListener, passwordObservable, passwordText);
    connectionAuthProvider = new ConnectionAuthenticationProvider();
}
Also used : RequiredControlDecorationUpdater(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater) TrimmingStringConverter(org.jboss.tools.openshift.internal.common.ui.databinding.TrimmingStringConverter) IConnectionAuthenticationProvider(org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizardPageModel.IConnectionAuthenticationProvider) RequiredStringValidator(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredStringValidator)

Aggregations

RequiredControlDecorationUpdater (org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater)2 RequiredStringValidator (org.jboss.tools.openshift.internal.common.ui.databinding.RequiredStringValidator)2 TrimmingStringConverter (org.jboss.tools.openshift.internal.common.ui.databinding.TrimmingStringConverter)2 IValidator (org.eclipse.core.databinding.validation.IValidator)1 IConnectionAuthenticationProvider (org.jboss.tools.openshift.internal.common.ui.connection.ConnectionWizardPageModel.IConnectionAuthenticationProvider)1