use of org.jboss.tools.openshift.internal.ui.validator.ProjectDisplayNameValidator in project jbosstools-openshift by jbosstools.
the class NewProjectWizardPage method doCreateControls.
@Override
protected void doCreateControls(Composite parent, DataBindingContext dbc) {
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(parent);
GridLayoutFactory.fillDefaults().margins(6, 6).numColumns(2).applyTo(parent);
// project name
Label lblName = new Label(parent, SWT.NONE);
lblName.setText(OpenShiftUIMessages.Name);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(lblName);
lblName.setToolTipText(ProjectNameValidator.projectNameDescription);
Text txtName = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(txtName);
IObservableValue nameTextObservable = WidgetProperties.text(SWT.Modify).observe(txtName);
Binding nameBinding = ValueBindingBuilder.bind(nameTextObservable).validatingAfterConvert(new ProjectNameValidator(getDescription(), model.getUnavailableNames())).to(BeanProperties.value(NewProjectWizardModel.PROPERTY_PROJECT_NAME).observe(model)).in(dbc);
ControlDecorationSupport.create(nameBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
// display name
Label lblDisplayName = new Label(parent, SWT.NONE);
lblDisplayName.setText(OpenShiftUIMessages.DisplayName);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(lblDisplayName);
Text txtDispalayName = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(txtDispalayName);
ValueBindingBuilder.bind(WidgetProperties.text(SWT.Modify).observe(txtDispalayName)).validatingAfterConvert(new ProjectDisplayNameValidator()).to(BeanProperties.value(NewProjectWizardModel.PROPERTY_DISPLAY_NAME).observe(model)).in(dbc);
// description
Label lblDescription = new Label(parent, SWT.NONE);
lblDescription.setText(OpenShiftUIMessages.Description);
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(lblDisplayName);
Text txtDescription = new Text(parent, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(txtDescription);
ValueBindingBuilder.bind(WidgetProperties.text(SWT.Modify).observe(txtDescription)).to(BeanProperties.value(NewProjectWizardModel.PROPERTY_DESCRIPTION).observe(model)).in(dbc);
}
Aggregations