use of org.jboss.tools.common.ui.databinding.InvertingBooleanConverter in project jbosstools-openshift by jbosstools.
the class ServerSettingsWizardPage method createResourcePathControls.
@SuppressWarnings("unchecked")
private void createResourcePathControls(Composite parent, ServerSettingsWizardPageModel model, DataBindingContext dbc) {
Composite container = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, true).applyTo(container);
GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).applyTo(container);
Button useInferredPodPathButton = new Button(container, SWT.CHECK);
useInferredPodPathButton.setText("&Use inferred Pod Deployment Path");
GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).applyTo(useInferredPodPathButton);
ISWTObservableValue useInferredPodPathObservable = WidgetProperties.selection().observe(useInferredPodPathButton);
ValueBindingBuilder.bind(useInferredPodPathObservable).to(BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_USE_INFERRED_POD_PATH).observe(model)).in(dbc);
Label podPathLabel = new Label(container, SWT.NONE);
podPathLabel.setText("Pod Deployment Path: ");
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(podPathLabel);
Text podPathText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(podPathText);
ISWTObservableValue podPathObservable = WidgetProperties.text(SWT.Modify).observe(podPathText);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(podPathText)).notUpdatingParticipant().to(useInferredPodPathObservable).converting(new InvertingBooleanConverter()).in(dbc);
ValueBindingBuilder.bind(WidgetProperties.enabled().observe(podPathLabel)).notUpdatingParticipant().to(useInferredPodPathObservable).converting(new InvertingBooleanConverter()).in(dbc);
ValueBindingBuilder.bind(podPathObservable).to(BeanProperties.value(OpenShiftServerEditorModel.PROPERTY_POD_PATH).observe(model)).in(dbc);
PodPathValidator podPathValidator = new PodPathValidator(useInferredPodPathObservable, podPathObservable);
ControlDecorationSupport.create(podPathValidator, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater(true));
dbc.addValidationStatusProvider(podPathValidator);
}
Aggregations