Search in sources :

Example 1 with ResourceNameValidator

use of org.jboss.tools.openshift.internal.ui.validator.ResourceNameValidator in project jbosstools-openshift by jbosstools.

the class ResourceNameControl method doCreateControl.

@SuppressWarnings({ "rawtypes", "unchecked" })
public void doCreateControl(Composite parent, DataBindingContext dbc, Object model) {
    // Resource Name
    final Label resourceNameLabel = new Label(parent, SWT.NONE);
    resourceNameLabel.setText(label);
    resourceNameLabel.setToolTipText("The name used to identify the resources that will support the deployed image.");
    layoutLabel(resourceNameLabel);
    final Text resourceNameText = new Text(parent, SWT.BORDER);
    layoutText(resourceNameText);
    final IObservableValue resourceNameTextObservable = WidgetProperties.text(SWT.Modify).observe(resourceNameText);
    ResourceNameValidator validator = new ResourceNameValidator(resourceNameTextObservable);
    final Binding nameBinding = ValueBindingBuilder.bind(resourceNameTextObservable).validatingAfterConvert(validator).to(BeanProperties.value(PROPERTY_RESOURCE_NAME).observe(model)).in(dbc);
    dbc.addValidationStatusProvider(validator);
    ControlDecorationSupport.create(nameBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater(true));
}
Also used : Binding(org.eclipse.core.databinding.Binding) RequiredControlDecorationUpdater(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) ResourceNameValidator(org.jboss.tools.openshift.internal.ui.validator.ResourceNameValidator)

Aggregations

Binding (org.eclipse.core.databinding.Binding)1 IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 RequiredControlDecorationUpdater (org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater)1 ResourceNameValidator (org.jboss.tools.openshift.internal.ui.validator.ResourceNameValidator)1