Search in sources :

Example 6 with InvertingBooleanConverter

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);
}
Also used : RequiredControlDecorationUpdater(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Button(org.eclipse.swt.widgets.Button) InvertingBooleanConverter(org.jboss.tools.common.ui.databinding.InvertingBooleanConverter) ISWTObservableValue(org.eclipse.jface.databinding.swt.ISWTObservableValue) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Aggregations

Button (org.eclipse.swt.widgets.Button)6 Label (org.eclipse.swt.widgets.Label)6 InvertingBooleanConverter (org.jboss.tools.common.ui.databinding.InvertingBooleanConverter)6 RequiredControlDecorationUpdater (org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater)5 Composite (org.eclipse.swt.widgets.Composite)4 Text (org.eclipse.swt.widgets.Text)4 Group (org.eclipse.swt.widgets.Group)3 ValidationStatusProvider (org.eclipse.core.databinding.ValidationStatusProvider)2 ISWTObservableValue (org.eclipse.jface.databinding.swt.ISWTObservableValue)2 ObservableListContentProvider (org.eclipse.jface.databinding.viewers.ObservableListContentProvider)2 ComboViewer (org.eclipse.jface.viewers.ComboViewer)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 DisableableMultiValitdator (org.jboss.tools.openshift.internal.common.ui.databinding.DisableableMultiValitdator)2 OpenShiftIdentifierValidator (org.jboss.tools.openshift.internal.ui.validator.OpenShiftIdentifierValidator)2 IResource (com.openshift.restclient.model.IResource)1 File (java.io.File)1 Binding (org.eclipse.core.databinding.Binding)1 Converter (org.eclipse.core.databinding.conversion.Converter)1 ComputedValue (org.eclipse.core.databinding.observable.value.ComputedValue)1