Example usage for org.eclipse.jface.databinding.swt WidgetProperties selection

List of usage examples for org.eclipse.jface.databinding.swt WidgetProperties selection

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.swt WidgetProperties selection.

Prototype

public static IWidgetValueProperty selection() 

Source Link

Document

Returns a value property for observing the selection state of a Button , CCombo , Combo , DateTime , List , MenuItem (since 1.5), Scale , Slider (since 1.5) or Spinner .

Usage

From source file:org.jboss.tools.livereload.internal.configuration.LiveReloadLaunchWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    setControl(container);/*  w ww .  j a  v  a 2  s.c om*/
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).margins(10, 10).applyTo(container);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, true).applyTo(container);

    // Web sockets port
    final Label websocketPortLabel = new Label(container, SWT.NONE);
    websocketPortLabel.setText(WEBSOCKET_SERVER_PORT_LABEL);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(websocketPortLabel);
    final Text websocketPortText = new Text(container, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(websocketPortText);
    final IObservableValue websocketPortTextObservable = WidgetProperties.text(SWT.Modify)
            .observe(websocketPortText);
    final IObservableValue websocketPortModelObservable = BeanProperties
            .value(LiveReloadLaunchWizardModel.PROPERTY_WEBSOCKET_SERVER_PORT).observe(wizardModel);
    ValueBindingBuilder.bind(websocketPortTextObservable).to(websocketPortModelObservable).in(dbc);

    // Proxy Server enablement
    final Button useProxyServerBtn = new Button(container, SWT.CHECK);
    useProxyServerBtn.setText(PROXY_SERVER_CHECKBOX);
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(useProxyServerBtn);
    final IObservableValue useProxyServerModelObservable = BeanProperties
            .value(LiveReloadLaunchWizardModel.PROPERTY_USE_PROXY_SERVER).observe(wizardModel);
    final IObservableValue useProxyServerSelection = WidgetProperties.selection().observe(useProxyServerBtn);
    dbc.bindValue(useProxyServerSelection, useProxyServerModelObservable);

    // Proxy Server port
    final Label proxyPortLabel = new Label(container, SWT.NONE);
    proxyPortLabel.setText(PROXY_SERVER_PORT_LABEL);
    GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(10, 0).applyTo(proxyPortLabel);
    final Text proxyPortText = new Text(container, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(proxyPortText);
    final IObservableValue proxyPortTextObservable = WidgetProperties.text(SWT.Modify).observe(proxyPortText);
    final IObservableValue proxyPortModelObservable = BeanProperties
            .value(LiveReloadLaunchWizardModel.PROPERTY_PROXY_SERVER_PORT).observe(wizardModel);
    ValueBindingBuilder.bind(proxyPortTextObservable).to(proxyPortModelObservable).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(proxyPortText))
            .notUpdating(useProxyServerModelObservable).in(dbc);

    // Proxy Server brief description
    final Link proxyServerDescription = new Link(container, SWT.WRAP);
    proxyServerDescription.setText(PROXY_SERVER_DESCRIPTION);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).hint(100, SWT.DEFAULT).indent(00, 10).span(2, 1)
            .applyTo(proxyServerDescription);
    GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(container);
    proxyServerDescription.addSelectionListener(onBrowse());

    // validation
    final ServerPortsValidator validationStatusProvider = new ServerPortsValidator(websocketPortTextObservable,
            useProxyServerSelection, proxyPortTextObservable);
    dbc.addValidationStatusProvider(validationStatusProvider);

}

From source file:org.jboss.tools.openshift.express.internal.core.portforward.ApplicationPortForwardingWizardPage.java

License:Open Source License

@Override
protected void doCreateControls(Composite parent, DataBindingContext dbc) {
    GridLayoutFactory.fillDefaults().margins(6, 6).applyTo(parent);
    Composite container = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);

    Composite tableContainer = new Composite(container, SWT.NONE);
    this.viewer = createTable(tableContainer, dbc);
    GridDataFactory.fillDefaults().span(1, 3).align(SWT.FILL, SWT.FILL).grab(true, true)
            .applyTo(tableContainer);//from  w  w  w  . j  a  v  a2  s . c  o m

    refreshButton = new Button(container, SWT.PUSH);
    refreshButton.setText("Refresh");
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(refreshButton);
    refreshButton.addSelectionListener(onRefreshPorts());

    startButton = new Button(container, SWT.PUSH);
    startButton.setText("Start All");
    startButton.setEnabled(wizardModel.hasForwardablePorts());
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(startButton);
    startButton.addSelectionListener(onStartPortForwarding());

    stopButton = new Button(container, SWT.PUSH);
    stopButton.setText("Stop All");
    stopButton.setEnabled(false);
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(stopButton);
    stopButton.addSelectionListener(onStopPortForwarding());

    // checkbox to use the default "127.0.0.1" local IP address
    final Button useLocalIpAddressButton = new Button(container, SWT.CHECK);
    useLocalIpAddressButton.setText("Use '127.0.0.1' as the local address for all Services");
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(useLocalIpAddressButton);
    final IObservableValue useLocalIpAddressObservable = BeanProperties
            .value(ApplicationPortForwardingWizardModel.PROPERTY_USE_DEFAULT_LOCAL_IP_ADDRESS)
            .observe(wizardModel);
    final IObservableValue useLocalIpAddressButtonSelection = WidgetProperties.selection()
            .observe(useLocalIpAddressButton);
    dbc.bindValue(useLocalIpAddressButtonSelection, useLocalIpAddressObservable);
    useLocalIpAddressObservable.addValueChangeListener(new IValueChangeListener() {
        @Override
        public void handleValueChange(ValueChangeEvent event) {
            refreshViewerInput();
        }
    });

    // checkbox to use the default "127.0.0.1" local IP address
    final Button findFreesPortButton = new Button(container, SWT.CHECK);
    findFreesPortButton.setText("Find free ports for all Services");
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(findFreesPortButton);
    final IObservableValue findFreePortsButtonObservable = BeanProperties
            .value(ApplicationPortForwardingWizardModel.PROPERTY_USE_FREE_PORTS).observe(wizardModel);
    final IObservableValue findFreePortsButtonSelection = WidgetProperties.selection()
            .observe(findFreesPortButton);
    dbc.bindValue(findFreePortsButtonSelection, findFreePortsButtonObservable);
    findFreePortsButtonObservable.addValueChangeListener(new IValueChangeListener() {
        @Override
        public void handleValueChange(ValueChangeEvent event) {
            refreshViewerInput();
        }
    });

    // enabling/disabling controls
    IObservableValue portForwardingStartedObservable = BeanProperties
            .value(ApplicationPortForwardingWizardModel.PROPERTY_PORT_FORWARDING).observe(wizardModel);

    IObservableValue forwardablePortsExistObservable = BeanProperties
            .value(ApplicationPortForwardingWizardModel.PROPERTY_FORWARDABLE_PORTS).observe(wizardModel);

    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(startButton))
            .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);

    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(startButton))
            .notUpdating(forwardablePortsExistObservable).converting(new Converter(List.class, Boolean.class) {

                @Override
                public Object convert(Object fromObject) {
                    if (fromObject instanceof List<?>) {
                        return !((List<?>) fromObject).isEmpty();
                    }
                    return Boolean.FALSE;
                }
            }).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(stopButton))
            .notUpdating(portForwardingStartedObservable).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(useLocalIpAddressButton))
            .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(findFreesPortButton))
            .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);

}

From source file:org.jboss.tools.openshift.express.internal.ui.portforward.PortForwardingWizardPage.java

License:Open Source License

@Override
protected void doCreateControls(Composite parent, DataBindingContext dbc) {
    GridLayoutFactory.fillDefaults().margins(6, 6).applyTo(parent);
    Composite container = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(container);

    Composite tableContainer = new Composite(container, SWT.NONE);
    this.viewer = createTable(tableContainer, dbc);
    GridDataFactory.fillDefaults().span(1, 3).align(SWT.FILL, SWT.FILL).grab(true, true)
            .applyTo(tableContainer);/*from  ww  w .j  av  a  2s. c  o m*/

    refreshButton = new Button(container, SWT.PUSH);
    refreshButton.setText("Refresh");
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(refreshButton);
    refreshButton.addSelectionListener(onRefreshPorts());

    startButton = new Button(container, SWT.PUSH);
    startButton.setText("Start All");
    startButton.setEnabled(wizardModel.hasForwardablePorts());
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(startButton);
    startButton.addSelectionListener(onStartPortForwarding());

    stopButton = new Button(container, SWT.PUSH);
    stopButton.setText("Stop All");
    stopButton.setEnabled(false);
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).align(SWT.FILL, SWT.TOP).applyTo(stopButton);
    stopButton.addSelectionListener(onStopPortForwarding());

    // checkbox to use the default "127.0.0.1" local IP address
    final Button useLocalIpAddressButton = new Button(container, SWT.CHECK);
    useLocalIpAddressButton.setText("Use '127.0.0.1' as the local address for all Services");
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(useLocalIpAddressButton);
    final IObservableValue useLocalIpAddressObservable = BeanProperties
            .value(PortForwardingWizardModel.PROPERTY_USE_DEFAULT_LOCAL_IP_ADDRESS).observe(wizardModel);
    final IObservableValue useLocalIpAddressButtonSelection = WidgetProperties.selection()
            .observe(useLocalIpAddressButton);
    dbc.bindValue(useLocalIpAddressButtonSelection, useLocalIpAddressObservable);
    useLocalIpAddressObservable.addValueChangeListener(new IValueChangeListener() {
        @Override
        public void handleValueChange(ValueChangeEvent event) {
            refreshViewerInput(wizardModel.getForwardablePorts());
        }
    });

    // checkbox to use the default "127.0.0.1" local IP address
    final Button findFreesPortButton = new Button(container, SWT.CHECK);
    findFreesPortButton.setText("Find free ports for all Services");
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(findFreesPortButton);
    final IObservableValue findFreePortsButtonObservable = BeanProperties
            .value(PortForwardingWizardModel.PROPERTY_USE_FREE_PORTS).observe(wizardModel);
    final IObservableValue findFreePortsButtonSelection = WidgetProperties.selection()
            .observe(findFreesPortButton);
    dbc.bindValue(findFreePortsButtonSelection, findFreePortsButtonObservable);
    findFreePortsButtonObservable.addValueChangeListener(new IValueChangeListener() {
        @Override
        public void handleValueChange(ValueChangeEvent event) {
            refreshViewerInput(wizardModel.getForwardablePorts());
        }
    });

    // enabling/disabling controls
    IObservableValue portForwardingStartedObservable = BeanProperties
            .value(PortForwardingWizardModel.PROPERTY_PORT_FORWARDING).observe(wizardModel);

    IObservableValue forwardablePortsExistObservable = BeanProperties
            .value(PortForwardingWizardModel.PROPERTY_FORWARDABLE_PORTS).observe(wizardModel);

    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(startButton))
            .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);

    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(startButton))
            .notUpdating(forwardablePortsExistObservable).converting(new Converter(List.class, Boolean.class) {

                @Override
                public Object convert(Object fromObject) {
                    if (fromObject instanceof List<?>) {
                        return !((List<?>) fromObject).isEmpty();
                    }
                    return Boolean.FALSE;
                }
            }).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(stopButton))
            .notUpdating(portForwardingStartedObservable).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(useLocalIpAddressButton))
            .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(findFreesPortButton))
            .notUpdating(portForwardingStartedObservable).converting(new InvertingBooleanConverter()).in(dbc);

}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ApplicationConfigurationWizardPage.java

License:Open Source License

private Composite createApplicationSelectionGroup(Composite container, DataBindingContext dbc) {
    Composite existingAppSelectionGroup = new Composite(container, SWT.NONE);
    // projectGroup.setText("Project");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(existingAppSelectionGroup);
    GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(existingAppSelectionGroup);

    // existing app checkbox
    useExistingAppBtn = new Button(existingAppSelectionGroup, SWT.CHECK);
    useExistingAppBtn.setText("Use existing application:");
    useExistingAppBtn.setToolTipText("Select an existing application or uncheck to create a new one.");
    useExistingAppBtn.setFocus();/*from   w  ww.  java  2  s . c  o  m*/
    GridDataFactory.fillDefaults().span(1, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(useExistingAppBtn);
    IObservableValue useExistingAppObservable = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_USE_EXISTING_APPLICATION)
            .observe(pageModel);
    final IObservableValue useExistingAppBtnSelection = WidgetProperties.selection().observe(useExistingAppBtn);
    dbc.bindValue(useExistingAppBtnSelection, useExistingAppObservable);

    // existing app name
    this.existingAppNameText = new Text(existingAppSelectionGroup, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false)
            .applyTo(existingAppNameText);
    IObservableValue existingAppNameTextObservable = WidgetProperties.text(SWT.Modify)
            .observe(existingAppNameText);
    IObservableValue existingAppNameModelObservable = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_EXISTING_APPLICATION_NAME)
            .observe(pageModel);
    ValueBindingBuilder.bind(existingAppNameTextObservable).to(existingAppNameModelObservable).in(dbc);
    UIUtils.focusOnSelection(useExistingAppBtn, existingAppNameText);
    createExistingAppNameContentAssist();
    useExistingAppBtnSelection.addValueChangeListener(
            onUseExistingApplication(newAppConfigurationGroup, existingAppNameText, browseAppsButton));

    this.browseAppsButton = new Button(existingAppSelectionGroup, SWT.NONE);
    browseAppsButton.setText("Browse...");
    browseAppsButton.addSelectionListener(onBrowseApps(dbc));
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).span(1, 1)
            .grab(false, false).applyTo(browseAppsButton);
    // observe the list of application, get notified once they have been
    IObservableValue existingApplicationsLoaded = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_EXISTING_APPLICATIONS_LOADED)
            .observe(pageModel);
    final ApplicationToSelectNameValidator existingAppValidator = new ApplicationToSelectNameValidator(
            useExistingAppBtnSelection, existingAppNameTextObservable, existingApplicationsLoaded);
    dbc.addValidationStatusProvider(existingAppValidator);
    ControlDecorationSupport.create(existingAppValidator, SWT.LEFT | SWT.TOP, null,
            new RequiredControlDecorationUpdater(false));
    return existingAppSelectionGroup;
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ApplicationConfigurationWizardPage.java

License:Open Source License

private void createApplicationConfigurationGroup(Composite parent, DataBindingContext dbc) {
    this.newAppConfigurationGroup = new Group(parent, SWT.NONE);
    newAppConfigurationGroup.setText("New application");
    GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(newAppConfigurationGroup);
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(newAppConfigurationGroup);

    final Label newAppNameLabel = new Label(newAppConfigurationGroup, SWT.NONE);
    newAppNameLabel.setText("Name:");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(newAppNameLabel);

    // application name
    this.newAppNameText = new Text(newAppConfigurationGroup, SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, false).span(2, 1).align(SWT.FILL, SWT.FILL)
            .applyTo(newAppNameText);/*from  w  ww  .  j a va 2 s.  c om*/
    UIUtils.selectAllOnFocus(newAppNameText);
    final IObservableValue applicationNameTextObservable = WidgetProperties.text(SWT.Modify)
            .observe(newAppNameText);
    final IObservableValue applicationNameModelObservable = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_APPLICATION_NAME).observe(pageModel);
    ValueBindingBuilder.bind(applicationNameTextObservable).to(applicationNameModelObservable).in(dbc);

    final ISWTObservableValue useExistingAppBtnSelection = WidgetProperties.selection()
            .observe(useExistingAppBtn);
    final NewApplicationNameValidator newApplicationNameValidator = new NewApplicationNameValidator(
            useExistingAppBtnSelection, applicationNameTextObservable);
    dbc.addValidationStatusProvider(newApplicationNameValidator);
    ControlDecorationSupport.create(newApplicationNameValidator, SWT.LEFT | SWT.TOP, null,
            new RequiredControlDecorationUpdater());

    // application type
    final Label newAppTypeLabel = new Label(newAppConfigurationGroup, SWT.NONE);
    newAppTypeLabel.setText("Type:");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).applyTo(newAppTypeLabel);
    this.newAppCartridgeCombo = new Combo(newAppConfigurationGroup, SWT.BORDER | SWT.READ_ONLY);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).grab(true, false)
            .applyTo(newAppCartridgeCombo);

    dbc.bindList(WidgetProperties.items().observe(newAppCartridgeCombo),
            BeanProperties.list(ApplicationConfigurationWizardPageModel.PROPERTY_CARTRIDGES).observe(pageModel),
            new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER),
            new UpdateListStrategy().setConverter(new CartridgeToStringConverter()));

    final ISWTObservableValue selectedCartridgeIndexObservable = WidgetProperties.singleSelectionIndex()
            .observe(newAppCartridgeCombo);
    final IObservableValue selectedCartridgeModelObservable = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_SELECTED_CARTRIDGE).observe(pageModel);
    ValueBindingBuilder.bind(selectedCartridgeIndexObservable).converting(new CartridgesIndexToCartridge())
            .to(selectedCartridgeModelObservable).converting(new CartridgeToCartridgesIndex()).in(dbc);

    // gear profile
    final Label gearProfileLabel = new Label(newAppConfigurationGroup, SWT.NONE);
    gearProfileLabel.setText("Gear profile:");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).applyTo(gearProfileLabel);
    this.gearProfilesCombo = new Combo(newAppConfigurationGroup, SWT.BORDER | SWT.READ_ONLY);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false)
            .applyTo(gearProfilesCombo);
    dbc.bindList(WidgetProperties.items().observe(gearProfilesCombo),
            BeanProperties.list(ApplicationConfigurationWizardPageModel.PROPERTY_GEAR_PROFILES)
                    .observe(pageModel),
            new UpdateListStrategy(UpdateListStrategy.POLICY_NEVER), new UpdateListStrategy() {

                /**
                * Needed to avoid buggy list update strategy in
                * ListBinding. The bug appears if the model list changes
                * its ordering and the strategy then tries to apply the
                * move in the target (widget). It does not apply the
                * conversion and ends up in a class cast exception when
                * updating the target (widget) items list.
                * 
                * @see https://issues.jboss.org/browse/JBIDE-11954
                */
                protected boolean useMoveAndReplace() {
                    return false;
                }

            }.setConverter(new GearProfileToStringConverter()));

    final ISWTObservableValue selectedGearProfileComboObservable = WidgetProperties.selection()
            .observe(gearProfilesCombo);
    final IObservableValue selectedGearProfileModelObservable = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_SELECTED_GEAR_PROFILE).observe(pageModel);
    ValueBindingBuilder.bind(selectedGearProfileComboObservable).converting(new StringToGearProfileConverter())
            .to(selectedGearProfileModelObservable).converting(new GearProfileToStringConverter()).in(dbc);

    // scaling
    this.enableScalingButton = new Button(newAppConfigurationGroup, SWT.CHECK);
    enableScalingButton.setText("Enable scaling");
    IObservableValue enableScalingModelObservable = BeanProperties
            .value(ApplicationConfigurationWizardPageModel.PROPERTY_APPLICATION_SCALE).observe(pageModel);
    final IObservableValue enableScalingButtonSelection = WidgetProperties.selection()
            .observe(enableScalingButton);
    ValueBindingBuilder.bind(enableScalingButtonSelection).converting(new BooleanToApplicationScaleConverter())
            .to(enableScalingModelObservable).converting(new ApplicationScaleToBooleanConverter()).in(dbc);

    final NewApplicationTypeValidator newApplicationTypeValidator = new NewApplicationTypeValidator(
            useExistingAppBtnSelection, selectedCartridgeIndexObservable);
    dbc.addValidationStatusProvider(newApplicationTypeValidator);
    ControlDecorationSupport.create(newApplicationTypeValidator, SWT.LEFT | SWT.TOP, null,
            new RequiredControlDecorationUpdater());

    // embeddable cartridges
    this.newAppEmbeddableCartridgesGroup = new Group(newAppConfigurationGroup, SWT.NONE);
    newAppEmbeddableCartridgesGroup.setText("Embeddable Cartridges");
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).span(3, 1)
            .applyTo(newAppEmbeddableCartridgesGroup);
    GridLayoutFactory.fillDefaults().numColumns(2).margins(6, 6).applyTo(newAppEmbeddableCartridgesGroup);

    Composite tableContainer = new Composite(newAppEmbeddableCartridgesGroup, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).span(1, 2).hint(400, 250)
            .applyTo(tableContainer);
    this.viewer = createTable(tableContainer);
    dbc.bindSet(ViewerProperties.checkedElements(IEmbeddableCartridge.class).observe(viewer),
            BeanProperties.set(ApplicationConfigurationWizardPageModel.PROPERTY_SELECTED_EMBEDDABLE_CARTRIDGES)
                    .observe(pageModel));
    // strategy has to be attached after the binding, so that the binding
    // can still add the checked cartridge and the strategy can correct
    viewer.addCheckStateListener(new EmbedCartridgeStrategyAdapter(pageModel, this));

    this.checkAllButton = new Button(newAppEmbeddableCartridgesGroup, SWT.PUSH);
    checkAllButton.setText("&Select All");
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).grab(false, false).align(SWT.FILL, SWT.TOP)
            .applyTo(checkAllButton);
    checkAllButton.addSelectionListener(onCheckAll());

    this.uncheckAllButton = new Button(newAppEmbeddableCartridgesGroup, SWT.PUSH);
    uncheckAllButton.setText("&Deselect All");
    GridDataFactory.fillDefaults().hint(110, SWT.DEFAULT).grab(false, true).align(SWT.FILL, SWT.TOP)
            .applyTo(uncheckAllButton);
    uncheckAllButton.addSelectionListener(onUncheckAll());

    // bottom filler
    Composite spacer = new Composite(newAppConfigurationGroup, SWT.NONE);
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(spacer);
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ApplicationTemplateWizardPage.java

License:Open Source License

private void createExistingApplicationControls(Composite parent, SelectObservableValue useExitingApplication,
        IObservableValue useExistingApplication, DataBindingContext dbc) {
    // existing app radio
    Button useExistingApplicationButton = new Button(parent, SWT.RADIO);
    useExistingApplicationButton.setText("Use my existing OpenShift application:");
    useExistingApplicationButton.setToolTipText("If selected we will import your existing application.");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).grab(true, false)
            .applyTo(useExistingApplicationButton);

    useExitingApplication.addOption(Boolean.TRUE,
            WidgetProperties.selection().observe(useExistingApplicationButton));

    // existing app explanatory label
    Label existingAppLabel = new Label(parent, SWT.None);
    existingAppLabel.setText("We will clone and import your existing application to a workspace project.");
    existingAppLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(existingAppLabel);//w w w  . j  ava 2s.  com

    // existing app name
    this.existingAppNameText = new Text(parent, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(existingAppNameText);
    IObservableValue existingAppNameTextObservable = WidgetProperties.text(SWT.Modify)
            .observe(existingAppNameText);
    ValueBindingBuilder.bind(existingAppNameTextObservable).to(BeanProperties
            .value(ApplicationTemplateWizardPageModel.PROPERTY_EXISTING_APPLICATION_NAME).observe(pageModel))
            .in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(existingAppNameText)).notUpdatingParticipant()
            .to(useExistingApplication).in(dbc);
    createExistingAppNameContentAssist(existingAppNameText);

    IObservableValue existingApplicationsLoaded = BeanProperties
            .value(ApplicationTemplateWizardPageModel.PROPERTY_RESOURCES_LOADED).observe(pageModel);
    IObservableValue existingApplicationObservable = BeanProperties
            .value(ApplicationTemplateWizardPageModel.PROPERTY_EXISTING_APPLICATION).observe(pageModel);
    final ExistingApplicationNameValidator existingAppValidator = new ExistingApplicationNameValidator(
            useExitingApplication, existingAppNameTextObservable, existingApplicationObservable,
            existingApplicationsLoaded);
    dbc.addValidationStatusProvider(existingAppValidator);
    ControlDecorationSupport.create(existingAppValidator, SWT.LEFT | SWT.TOP, null,
            new RequiredControlDecorationUpdater(true));

    // browse button
    Button browseAppsButton = new Button(parent, SWT.NONE);
    browseAppsButton.setText("Browse...");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).grab(false, false)
            .applyTo(browseAppsButton);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(browseAppsButton)).notUpdatingParticipant()
            .to(useExistingApplication).in(dbc);
    browseAppsButton.addSelectionListener(onBrowseExistingApps(dbc));
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ApplicationTemplateWizardPage.java

License:Open Source License

private void createNewApplicationControls(Composite parent, SelectObservableValue useExitingApplication,
        IObservableValue useExistingApplication, DataBindingContext dbc) {
    // existing app radio
    Button newApplicationButton = new Button(parent, SWT.RADIO);
    newApplicationButton.setText("Create a new OpenShift application:");
    newApplicationButton.setToolTipText("If selected we will create a new application in OpenShift.");
    GridDataFactory.fillDefaults().span(2, 1).indent(0, 8).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(newApplicationButton);

    useExitingApplication.addOption(Boolean.FALSE, WidgetProperties.selection().observe(newApplicationButton));

    // new app explanatory label
    Label existingAppLabel = new Label(parent, SWT.None);
    existingAppLabel.setText(/*w  ww.j  a v a  2s  . co m*/
            "You can create an application form scratch or handpick from existing cartridges you need.");
    existingAppLabel.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(existingAppLabel);

    Composite applicationTemplatesTreeComposite = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, true)
            .applyTo(applicationTemplatesTreeComposite);
    GridLayoutFactory.fillDefaults().spacing(2, 2).applyTo(applicationTemplatesTreeComposite);

    // filter text
    Text templateFilterText = UIUtils.createSearchText(applicationTemplatesTreeComposite);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(templateFilterText);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(templateFilterText)).notUpdatingParticipant()
            .to(useExistingApplication).converting(new InvertingBooleanConverter()).in(dbc);

    // application templates tree
    final TreeViewer applicationTemplatesViewer = createApplicationTemplatesViewer(
            applicationTemplatesTreeComposite, templateFilterText);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(400, 180)
            .applyTo(applicationTemplatesViewer.getControl());
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(applicationTemplatesViewer.getControl()))
            .notUpdatingParticipant().to(useExistingApplication).converting(new InvertingBooleanConverter())
            .in(dbc);
    templateFilterText.addModifyListener(onFilterTextModified(applicationTemplatesViewer));

    IObservableValue selectedApplicationTemplateViewerObservable = ViewerProperties.singleSelection()
            .observe(applicationTemplatesViewer);
    IObservableValue selectedApplicationTemplateModelObservable = BeanProperties
            .value(ApplicationTemplateWizardPageModel.PROPERTY_SELECTED_APPLICATION_TEMPLATE)
            .observe(pageModel);
    ValueBindingBuilder.bind(selectedApplicationTemplateViewerObservable)
            .to(selectedApplicationTemplateModelObservable).in(dbc);

    ApplicationTemplateValidator selectedApplicationTemplateValidator = new ApplicationTemplateValidator(
            useExitingApplication, selectedApplicationTemplateViewerObservable);
    dbc.addValidationStatusProvider(selectedApplicationTemplateValidator);
    ControlDecorationSupport.create(selectedApplicationTemplateValidator, SWT.LEFT | SWT.TOP, null,
            new RequiredControlDecorationUpdater(true));

    // selected application template details
    final Group detailsContainer = new Group(applicationTemplatesTreeComposite, SWT.NONE);
    detailsContainer.setText("Details");
    enableTemplateDetailsControls(detailsContainer, !pageModel.isUseExistingApplication());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, 106).applyTo(detailsContainer);
    useExistingApplication.addValueChangeListener(new IValueChangeListener() {

        @Override
        public void handleValueChange(final ValueChangeEvent event) {
            final Boolean enabled = Boolean.FALSE.equals(event.diff.getNewValue());
            enableTemplateDetailsControls(detailsContainer, enabled);
        }

    });

    new ApplicationTemplateDetailViews(selectedApplicationTemplateModelObservable, useExitingApplication,
            detailsContainer, dbc).createControls();
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.GitCloningSettingsWizardPage.java

License:Open Source License

private Composite createCloneGroup(Composite parent, DataBindingContext dbc) {
    Group cloneGroup = new Group(parent, SWT.NONE);
    cloneGroup.setText("Cloning settings");
    cloneGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).margins(10, 10).applyTo(cloneGroup);

    // Repo Path Management
    useDefaultRepoPathButton = new Button(cloneGroup, SWT.CHECK);
    useDefaultRepoPathButton.setText("Use default location");
    useDefaultRepoPathButton.setToolTipText("Uncheck if you want to use a custom location for your project");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).applyTo(useDefaultRepoPathButton);
    Label labelForRepoPath = new Label(cloneGroup, SWT.NONE);
    labelForRepoPath.setText("Location:");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).indent(10, 0)
            .applyTo(labelForRepoPath);/*ww  w.j  a v  a 2  s  .  c o  m*/
    final Text repoPathText = new Text(cloneGroup, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(repoPathText);
    final IObservableValue repoPathObservable = WidgetProperties.text(SWT.Modify).observe(repoPathText);
    final IObservableValue repoPathModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_REPO_PATH).observe(pageModel);
    ValueBindingBuilder.bind(repoPathObservable).to(repoPathModelObservable).in(dbc);

    Button browseRepoPathButton = new Button(cloneGroup, SWT.PUSH);
    browseRepoPathButton.setText("Browse...");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT)
            .applyTo(browseRepoPathButton);
    browseRepoPathButton.addSelectionListener(onRepoPath());

    final IObservableValue isDefaultRepoObservable = WidgetProperties.selection()
            .observe(useDefaultRepoPathButton);
    final IObservableValue useDefaultRepoModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_USE_DEFAULT_REPO_PATH).observe(pageModel);
    ValueBindingBuilder.bind(isDefaultRepoObservable).to(useDefaultRepoModelObservable).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(repoPathText))
            .notUpdating(useDefaultRepoModelObservable).converting(new InvertingBooleanConverter()).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(browseRepoPathButton))
            .notUpdating(useDefaultRepoModelObservable).converting(new InvertingBooleanConverter()).in(dbc);
    // move focus to the project location text control when not choosing the
    // 'Use default location' option.
    UIUtils.focusOnSelection(useDefaultRepoPathButton, repoPathText);

    final IObservableValue applicationNameModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_APPLICATION_NAME).observe(pageModel);
    final IObservableValue newProjectModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_NEW_PROJECT).observe(pageModel);
    this.repoPathValidator = new RepoPathValidationStatusProvider(repoPathObservable,
            applicationNameModelObservable, newProjectModelObservable);
    dbc.addValidationStatusProvider(repoPathValidator);
    ControlDecorationSupport.create(repoPathValidator, SWT.LEFT | SWT.TOP);

    // Remote Name Management
    useDefaultRemoteNameButton = new Button(cloneGroup, SWT.CHECK);
    useDefaultRemoteNameButton.setText("Use default remote name");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).applyTo(useDefaultRemoteNameButton);

    this.remoteNameLabel = new Label(cloneGroup, SWT.NONE);
    remoteNameLabel.setText("Remote name:");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).indent(10, 0)
            .applyTo(remoteNameLabel);
    remoteNameText = new Text(cloneGroup, SWT.BORDER);
    GridDataFactory.fillDefaults().span(1, 1).align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER)
            .grab(true, false).applyTo(remoteNameText);

    final IObservableValue remoteNameTextObservable = WidgetProperties.text(SWT.Modify).observe(remoteNameText);
    final IObservableValue remoteNameModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_REMOTE_NAME).observe(pageModel);
    ValueBindingBuilder.bind(remoteNameTextObservable).to(remoteNameModelObservable).in(dbc);

    final IObservableValue useDefaultRemoteNameModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_USE_DEFAULT_REMOTE_NAME).observe(pageModel);
    final IObservableValue useDefaultRemoteNameObservable = WidgetProperties.selection()
            .observe(useDefaultRemoteNameButton);
    ValueBindingBuilder.bind(useDefaultRemoteNameObservable).to(useDefaultRemoteNameModelObservable).in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(remoteNameText))
            .notUpdating(useDefaultRemoteNameModelObservable).converting(new InvertingBooleanConverter())
            .in(dbc);
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(remoteNameLabel))
            .notUpdating(useDefaultRemoteNameModelObservable).converting(new InvertingBooleanConverter())
            .in(dbc);
    // move focus to the project name text control when choosing the 'Use an
    // existing project' option.
    useDefaultRemoteNameButton.addSelectionListener(onDefaultRemoteNameUnchecked());
    final IObservableValue projectNameModelObservable = BeanProperties
            .value(IOpenShiftExpressWizardModel.PROJECT_NAME).observe(wizardModel);

    dbc.addValidationStatusProvider(
            new RemoteNameValidationStatusProvider(remoteNameTextObservable, projectNameModelObservable));

    this.sshLink = new Link(parent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).indent(10, 0).applyTo(sshLink);
    sshLink.addSelectionListener(onSshPrefs("SSH2 Preferences"));
    sshLink.addSelectionListener(onManageSSHKeys("SSH Keys wizard", dbc));

    // we need a binding to have validation setting wizard validation status
    Label dummyLabel = new Label(parent, SWT.None);
    dummyLabel.setVisible(false);
    GridDataFactory.fillDefaults().exclude(true).applyTo(dummyLabel);
    ValueBindingBuilder
            .bind(WidgetProperties.text().observe(dummyLabel)).notUpdating(BeanProperties
                    .value(GitCloningSettingsWizardPageModel.PROPERTY_HAS_REMOTEKEYS).observe(pageModel))
            .validatingAfterGet(new IValidator() {

                @Override
                public IStatus validate(Object value) {
                    if (!(value instanceof Boolean)) {
                        return ValidationStatus.ok();
                    }
                    Boolean hasRemoteKeys = (Boolean) value;
                    if (hasRemoteKeys) {
                        return ValidationStatus.ok();
                    } else {
                        return ValidationStatus
                                .error("No public keys found in your account. Please use the SSH keys wizard.");
                    }
                }
            }).in(dbc);
    refreshHasRemoteKeys(dbc);
    return cloneGroup;
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ProjectAndServerAdapterSettingsWizardPage.java

License:Open Source License

private Composite createProjectGroup(Composite parent, DataBindingContext dbc) {
    Composite projectGroup = new Composite(parent, SWT.NONE);
    // projectGroup.setText("Project");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(projectGroup);//from   w w  w. ja  v a2s  .co  m
    GridLayoutFactory.fillDefaults().numColumns(3).margins(6, 6).applyTo(projectGroup);

    // new project checkbox
    Button newProjectRadioBtn = new Button(projectGroup, SWT.CHECK);
    newProjectRadioBtn.setText("Create a new project");
    newProjectRadioBtn.setToolTipText(
            "The OpenShift application code will be pulled into the newly created project or merged into the selected one.");
    newProjectRadioBtn.setFocus();
    GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(false, false)
            .applyTo(newProjectRadioBtn);
    final IObservableValue newProjectObservable = BeanProperties
            .value(ProjectAndServerAdapterSettingsWizardPageModel.PROPERTY_IS_NEW_PROJECT).observe(pageModel);
    final ISWTObservableValue newProjectRadioBtnSelection = WidgetProperties.selection()
            .observe(newProjectRadioBtn);
    dbc.bindValue(newProjectRadioBtnSelection, newProjectObservable);

    // existing project
    Label existingProjectLabel = new Label(projectGroup, SWT.NONE);
    existingProjectLabel.setText("Use existing project:");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(false, false).indent(10, 0)
            .applyTo(existingProjectLabel);

    existingProjectNameText = new Text(projectGroup, SWT.BORDER);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(true, false)
            .applyTo(existingProjectNameText);
    final IObservableValue projectNameModelObservable = BeanProperties
            .value(ProjectAndServerAdapterSettingsWizardPageModel.PROPERTY_PROJECT_NAME).observe(pageModel);
    final ISWTObservableValue existingProjectNameTextObservable = WidgetProperties.text(SWT.Modify)
            .observe(existingProjectNameText);
    ValueBindingBuilder.bind(existingProjectNameTextObservable).to(projectNameModelObservable).in(dbc);
    // disable the project name text when the model state is set to 'new project'
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(existingProjectNameText))
            .notUpdating(newProjectObservable).converting(new InvertingBooleanConverter()).in(dbc);
    // move focus to the project name text control when choosing the 'Use an existing project' option.
    newProjectRadioBtn.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            existingProjectNameText.setFocus();
            existingProjectNameText.selectAll();
        }
    });
    // let's provide content assist on the existing project name
    ControlDecoration dec = new ControlDecoration(existingProjectNameText, SWT.TOP | SWT.LEFT);
    FieldDecoration contentProposalFieldIndicator = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
    dec.setImage(contentProposalFieldIndicator.getImage());
    dec.setDescriptionText("Auto-completion is enabled when you start typing a project name.");
    dec.setShowOnlyOnFocus(true);

    AutoCompleteField adapter = new AutoCompleteField(existingProjectNameText, new TextContentAdapter(),
            new String[] {});

    adapter.setProposals(getOpenProjectsInWorkspace());

    Button browseProjectsButton = new Button(projectGroup, SWT.NONE);
    browseProjectsButton.setText("Browse...");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).hint(100, SWT.DEFAULT).span(1, 1)
            .grab(false, false).applyTo(browseProjectsButton);
    browseProjectsButton.addSelectionListener(onBrowseProjects());
    ValueBindingBuilder.bind(WidgetProperties.enabled().observe(browseProjectsButton))
            .notUpdating(newProjectObservable).converting(new InvertingBooleanConverter()).in(dbc);

    final IObservableValue applicationNameModelObservable = BeanProperties
            .value(GitCloningSettingsWizardPageModel.PROPERTY_APPLICATION_NAME).observe(pageModel);
    final UseExistingOpenProjectValidator existingProjectValidator = new UseExistingOpenProjectValidator(
            applicationNameModelObservable, newProjectObservable, projectNameModelObservable);
    dbc.addValidationStatusProvider(existingProjectValidator);
    ControlDecorationSupport.create(existingProjectValidator, SWT.LEFT | SWT.TOP);

    return projectGroup;
}

From source file:org.jboss.tools.openshift.express.internal.ui.wizard.application.ProjectAndServerAdapterSettingsWizardPage.java

License:Open Source License

private Group createServerAdapterGroup(Composite container, DataBindingContext dbc) {
    Group serverAdapterGroup = new Group(container, SWT.NONE);
    serverAdapterGroup.setText("Server Adapter");
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(serverAdapterGroup);
    GridLayoutFactory.fillDefaults().margins(10, 10).applyTo(serverAdapterGroup);

    Composite c = new Composite(serverAdapterGroup, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(c);
    GridLayoutFactory.fillDefaults().numColumns(3).spacing(12, 8).applyTo(c);

    final Button serverAdapterCheckbox = new Button(c, SWT.CHECK);
    serverAdapterCheckbox.setText("Create and setup a server for easy publishing");
    serverAdapterCheckbox.setToolTipText(
            "This Server Adapter will let you publish your local changes onto OpenShift, right from your Eclipse workbench.");
    GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false)
            .applyTo(serverAdapterCheckbox);
    final IObservableValue serverAdapterCheckboxObservable = WidgetProperties.selection()
            .observe(serverAdapterCheckbox);
    final IObservableValue serverAdapterModelObservable = BeanProperties
            .value(ProjectAndServerAdapterSettingsWizardPageModel.PROPERTY_CREATE_SERVER_ADAPTER)
            .observe(pageModel);/*from  www.j  a v a 2  s .  c o  m*/
    ValueBindingBuilder.bind(serverAdapterCheckboxObservable).to(serverAdapterModelObservable).in(dbc);
    return serverAdapterGroup;
}