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

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

Introduction

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

Prototype

public static IWidgetValueProperty text() 

Source Link

Document

Returns a value property for observing the text of a Button , CCombo , CLabel , Combo , Item , Label , Link , Shell , Group , StyledText or Text .

Usage

From source file:org.eclipse.emfforms.internal.editor.ecore.controls.DataTypeControl.java

License:Open Source License

@Override
protected Binding[] createBindings(final Viewer viewer) throws DatabindingFailedException {
    final Binding binding = getDataBindingContext().bindValue(
            WidgetProperties.text().observe(((ComboViewer) viewer).getCombo()), getModelValue(),
            new EMFUpdateValueStrategy().setConverter(new Converter(String.class, EClassifier.class) {
                @Override// w w  w  . j av a2 s. c o m
                public Object convert(Object fromObject) {
                    // We want the result for such a request to be null, not a DataType with null name (can occur)
                    if (fromObject == null) {
                        return null;
                    }

                    final Object[] classifiers = (Object[]) ((ComboViewer) viewer).getInput();
                    for (int i = 0; i < classifiers.length; i++) {
                        if (fromObject.equals(((EClassifier) classifiers[i]).getName())) {
                            return classifiers[i];
                        }
                    }

                    // If we haven't found the DataType yet, Try adding an E to the Input and search again.
                    // So we find EString even if String was searched.
                    final String fromStringWithE = "E" + fromObject.toString();
                    for (int i = 0; i < classifiers.length; i++) {
                        if (fromStringWithE.equals(((EClassifier) classifiers[i]).getName())) {
                            return classifiers[i];
                        }
                    }

                    return null;
                }
            }), new EMFUpdateValueStrategy().setConverter(new Converter(EClassifier.class, String.class) {
                @Override
                public Object convert(Object fromObject) {
                    if (fromObject == null) {
                        return "";
                    }
                    return ((EClassifier) fromObject).getName();
                }
            }));
    // TODO: this update creates a nasty usability bug!
    /*
     * ((ComboViewer)viewer).getCombo().addFocusListener(new FocusListener() {
     * @Override
     * public void focusLost(FocusEvent e) {
     * binding.updateModelToTarget();
     * }
     * @Override
     * public void focusGained(FocusEvent e) {
     * }
     * });
     */
    return new Binding[] { binding };
}

From source file:org.eclipse.emfforms.internal.swt.control.text.autocomplete.renderer.AutocompleteTextControlSWTRenderer.java

License:Open Source License

/**
 * {@inheritDoc}//  ww  w.  jav a2  s  .c  o m
 *
 * @see org.eclipse.emf.ecp.view.spi.core.swt.SimpleControlJFaceViewerSWTRenderer#createBindings(org.eclipse.jface.viewers.Viewer)
 */
@Override
protected Binding[] createBindings(Viewer viewer) throws DatabindingFailedException {
    final ISWTObservableValue targetObservable = WidgetProperties.text()
            .observe(ComboViewer.class.cast(viewer).getCombo());
    final IObservableValue modelObservable = getModelValue();
    final Binding binding = getDataBindingContext().bindValue(targetObservable, modelObservable);
    return new Binding[] { binding };
}

From source file:org.eclipse.emfforms.spi.swt.table.TableViewerComposite.java

License:Open Source License

private static void addColumns(TableViewerSWTCustomization customization, TableViewer tableViewer,
        EMFDataBindingContext emfDataBindingContext) {
    for (final ColumnDescription columnDescription : customization.getColumns()) {
        /* create column */
        // TODO move TableViewerColumnBuilder?
        @SuppressWarnings("restriction")
        final TableViewerColumn column = org.eclipse.emf.ecp.edit.internal.swt.controls.TableViewerColumnBuilder
                .create().setData(RESIZABLE, columnDescription.isResizeable())
                .setMoveable(columnDescription.isMoveable()).setStyle(columnDescription.getStyleBits())
                .setData(WEIGHT, columnDescription.getWeight())
                .setData(MIN_WIDTH, columnDescription.getMinWidth()).build(tableViewer);

        /* bind text and tooltip */
        final IObservableValue text = columnDescription.getColumnText();
        emfDataBindingContext.bindValue(WidgetProperties.text().observe(column.getColumn()), text);
        final IObservableValue tooltipText = columnDescription.getColumnTooltip();
        emfDataBindingContext.bindValue(WidgetProperties.tooltipText().observe(column.getColumn()),
                tooltipText);/*  www  .  j av a2 s .c o m*/

        /* set label provider */
        column.setLabelProvider(columnDescription.createLabelProvider(tableViewer));

        /* set editing support */
        final Optional<EditingSupport> editingSupport = columnDescription.createEditingSupport(tableViewer);
        if (editingSupport.isPresent()) {
            column.setEditingSupport(editingSupport.get());
        }

        if (columnDescription.getColumnImage().isPresent()) {
            column.getColumn().setImage(columnDescription.getColumnImage().get());
        }

        /* setup drag&drop */
        if (customization.hasDND()) {
            tableViewer.addDragSupport(customization.getDragOperations(), customization.getDragTransferTypes(),
                    customization.getDragListener(tableViewer));
            tableViewer.addDropSupport(customization.getDropOperations(), customization.getDropTransferTypes(),
                    customization.getDropListener(tableViewer));
        }

    }
}

From source file:org.eclipse.emfforms.spi.swt.table.TableViewerComposite.java

License:Open Source License

private static void initTitleLabel(Label label, IObservableValue title, IObservableValue tooltip,
        EMFDataBindingContext emfDatabindingContext) {
    emfDatabindingContext.bindValue(WidgetProperties.text().observe(label), title);
    emfDatabindingContext.bindValue(WidgetProperties.tooltipText().observe(label), tooltip);
}

From source file:org.eclipse.rcptt.ui.panels.main.ControlPanelWindow.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Q7UIPlugin.getDisplay().addFilter(SWT.KeyUp, keyListener);

    createToolBar(parent);/*from w w w.jav a 2  s . com*/
    createTabFolder(parent);

    ITestCase model = getModel();
    Q7InternalTestCase internalModel = new Q7InternalTestCase(ModelManager.getModelManager().getModel(),
            "recording_snippet", scenario);

    scriptPart = new ScriptComposite(internalModel, model != null ? (IFile) getModel().getResource() : null,
            getShell(), SWT.SCROLL_LOCK);
    ComputedValue recordingMode = new ComputedValue() {
        @Override
        protected Object calculate() {
            return recordingSupport.getMode();
        }
    };
    dbc.bindValue(scriptPart.observeRecordingMode(), recordingMode);
    script = tabFolder.addTab(scriptPart);
    try {
        contextsTable = new ContextsTable(internalModel);
    } catch (ModelException e) {
        Q7UIPlugin.log(e);
    }
    contextsTable.setProject(getSavedProject());
    dbc.bindValue(contextsTable.observeRecordingMode(), recordingMode);
    tabFolder.addTab(contextsTable);

    try {
        verificationsTable = new VerificationsTable(internalModel);
    } catch (ModelException e) {
        Q7UIPlugin.log(e);
    }
    verificationsTable.setProject(getSavedProject());
    dbc.bindValue(verificationsTable.observeRecordingMode(), recordingMode);
    tabFolder.addTab(verificationsTable);

    DescriptionComposite descPart = new DescriptionComposite(scenario);
    dbc.bindValue(descPart.observeRecordingMode(), recordingMode);
    tabFolder.addTab(descPart);
    OptionsComposite optionsComposite = new OptionsComposite();
    tabFolder.addTab(optionsComposite);
    optionsComposite.setOptionChangeCallback(new Runnable() {
        public void run() {
            if (recordingSupport.getMode() == RecordingMode.Recording) {
                recordingSupport.sendFeatures();
            }
        }
    });

    selectTab(script);

    statusBar = new StatusBarComposite() {
        @Override
        protected void layout() {
            super.layout();
            tabFolder.layout(true);
        }

        @Override
        protected void handleError(final String taskMessage, Throwable e) {
            if (e instanceof CoreException && (e.getMessage().equals("Connection reset") || e //$NON-NLS-1$
                    .getMessage().equals("Connection refused: connect"))) { //$NON-NLS-1$
                return; // Ignore connection lost exception, this situation
                        // handled in RecordingSupport class
            }
            if (e instanceof CoreException) {
                final IStatus status = ((CoreException) e).getStatus();
                if (status instanceof ExecutionStatus && PlatformUI.isWorkbenchRunning()) {
                    WorkbenchUtils.uiRun(new Runnable() {
                        public void run() {
                            displayExecutionFailure((ExecutionStatus) status);
                        }
                    });
                    return;
                }
            }
            super.handleError(taskMessage, e);
        };
    };
    statusBar.createControl(parent);
    // statusBar.getControl().addKeyListener(keyListener);
    dbc.bindValue(WidgetProperties.text().observe(getShell()), new ComputedValue() {
        @Override
        protected Object calculate() {
            StringBuilder text = new StringBuilder(Messages.ControlPanelWindow_Title);
            ITestCase model = getModel();
            if (model != null && model.exists()) {
                try {
                    text.append(" - ").append(model.getElementName()); //$NON-NLS-1$
                    text.append(" (") //$NON-NLS-1$
                            .append(model.getQ7Project().getName()).append(")"); //$NON-NLS-1$
                } catch (ModelException e) {
                    Q7UIPlugin.log(e);
                }
            }
            AutLaunch aut = recordingSupport.getAUT();
            if (aut != null) {
                text.append(" - ").append(aut.getAut().getName()); //$NON-NLS-1$
            }
            switch (recordingSupport.getMode()) {
            case Connecting:
                text.append(Messages.ControlPanelWindow_StatusConnection);
                break;
            case Recording:
                text.append(Messages.ControlPanelWindow_StatusRecording);
                break;
            case Asserting:
                text.append(Messages.ControlPanelWindow_StatusAsserting);
                break;
            case ImageRecognition:
                text.append(Messages.ControlPanelWindow_StatusImageRecognition);
                break;
            case Replaying:
                text.append(Messages.ControlPanelWindow_StatusReplaying);
                break;
            case WaitingForAUTRestart:
                text.append(Messages.ControlPanelWindow_StatusWaitingAUTToRestart);
                break;
            default:
                break;
            }
            return text.toString();
        }
    });

    tabFolder.setFocus();

    return tabFolder;
}

From source file:org.eclipse.reddeer.swt.test.impl.button.DataBindingRadioButtonTest.java

License:Open Source License

@Override
protected void createControls(Shell shell) {
    shell.setLayout(new GridLayout(DataBindingRadioButtonTest.NUM_BUTTONS, true));

    // DBC & Model
    this.dbc = new DataBindingContext();
    this.model = new TestPageModel();

    // group//  w w w .  j  av a2s  . c o m
    org.eclipse.swt.widgets.Group group = new org.eclipse.swt.widgets.Group(shell, SWT.NONE);
    group.setText("Radio Group with Names");
    GridLayoutFactory.fillDefaults().applyTo(group);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(group);

    SelectObservableValue selectedRadioButtonObservable = new SelectObservableValue();

    // buttonA + labelA + textA
    org.eclipse.swt.widgets.Button buttonA = new org.eclipse.swt.widgets.Button(group, SWT.RADIO);
    buttonA.setText(RADIO_BUTTON_LABEL_PREFIX + "A");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).applyTo(buttonA);
    selectedRadioButtonObservable.addOption("Selected: " + "A", WidgetProperties.selection().observe(buttonA));
    org.eclipse.swt.widgets.Label labelA = new org.eclipse.swt.widgets.Label(group, SWT.NONE);
    labelA.setText("Label " + "A");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).applyTo(labelA);
    final org.eclipse.swt.widgets.Text textA = new org.eclipse.swt.widgets.Text(group, SWT.BORDER);
    textA.setText("Text " + "A");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(textA);

    // buttonB + labelB + textB
    org.eclipse.swt.widgets.Button buttonB = new org.eclipse.swt.widgets.Button(group, SWT.RADIO);
    buttonB.setText(RADIO_BUTTON_LABEL_PREFIX + "B");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).applyTo(buttonB);
    selectedRadioButtonObservable.addOption("Selected: " + "B", WidgetProperties.selection().observe(buttonB));
    org.eclipse.swt.widgets.Label labelB = new org.eclipse.swt.widgets.Label(group, SWT.NONE);
    labelB.setText("Label " + "B");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).applyTo(labelB);
    org.eclipse.swt.widgets.Text textB = new org.eclipse.swt.widgets.Text(group, SWT.BORDER);
    textB.setText("Text " + "B");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(textB);

    // buttonC + labelC + textC
    org.eclipse.swt.widgets.Button buttonC = new org.eclipse.swt.widgets.Button(group, SWT.RADIO);
    buttonC.setText(RADIO_BUTTON_LABEL_PREFIX + "C");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(COLUMNS, 1).applyTo(buttonC);
    selectedRadioButtonObservable.addOption("Selected: " + "C", WidgetProperties.selection().observe(buttonC));
    org.eclipse.swt.widgets.Label labelC = new org.eclipse.swt.widgets.Label(group, SWT.NONE);
    labelC.setText("Label " + "C");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).indent(INDENT, 0).applyTo(labelC);
    org.eclipse.swt.widgets.Text textC = new org.eclipse.swt.widgets.Text(group, SWT.BORDER);
    textC.setText("Text " + "C");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(textC);

    // label shows selected button
    org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(shell, SWT.NONE);
    GridDataFactory.fillDefaults().applyTo(label);
    ISWTObservableValue labelTextObservable = WidgetProperties.text().observe(label);

    // Observe
    final IObservableValue buttonAModeModelObservable = BeanProperties
            .value(TestPageModel.class, TestPageModel.BUTTON_A_BINDING_MODE).observe(model);
    final IObservableValue buttonATextModelObservable = BeanProperties
            .value(TestPageModel.class, TestPageModel.BUTTON_A_TEXT).observe(model);
    final IObservableValue buttonBModeModelObservable = BeanProperties
            .value(TestPageModel.class, TestPageModel.BUTTON_B_BINDING_MODE).observe(model);
    final IObservableValue buttonBTextModelObservable = BeanProperties
            .value(TestPageModel.class, TestPageModel.BUTTON_B_TEXT).observe(model);
    final IObservableValue buttonCModeModelObservable = BeanProperties
            .value(TestPageModel.class, TestPageModel.BUTTON_C_BINDING_MODE).observe(model);
    final IObservableValue buttonCTextModelObservable = BeanProperties
            .value(TestPageModel.class, TestPageModel.BUTTON_C_TEXT).observe(model);

    // group controls
    final Control[] buttonAControls = new Control[] { textA, labelA };
    final Control[] buttonBControls = new Control[] { textB, labelB };
    final Control[] buttonCControls = new Control[] { textC, labelC };
    buttonAModeModelObservable.addChangeListener(onButtonASelection(buttonAControls));
    buttonBModeModelObservable.addChangeListener(onButtonBSelection(buttonBControls));
    buttonCModeModelObservable.addChangeListener(onButtonCSelection(buttonCControls));

    // bindings
    dbc.bindValue(WidgetProperties.selection().observe(buttonA), buttonAModeModelObservable);
    dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(textA), buttonATextModelObservable);
    dbc.bindValue(WidgetProperties.selection().observe(buttonB), buttonBModeModelObservable);
    dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(textB), buttonBTextModelObservable);
    dbc.bindValue(WidgetProperties.selection().observe(buttonC), buttonCModeModelObservable);
    dbc.bindValue(WidgetProperties.text(SWT.Modify).observe(textC), buttonCTextModelObservable);

    //shows selected radio button
    dbc.bindValue(selectedRadioButtonObservable, labelTextObservable);

    // default settings and widgets update
    setDefaultSettings();
    updateWidgetsState(buttonAControls, buttonBControls, buttonCControls);

}

From source file:org.eclipse.riena.sample.snippets.SnippetDateTimeRidget001.java

License:Open Source License

public static void main(final String[] args) {
    final Display display = new Display();
    new DefaultRealm();
    final Shell shell = UIControlsFactory.createShell(display);
    shell.setLayout(new GridLayout(2, false));

    final TypedBean<Date> value = new TypedBean<Date>(new Date());

    final GridDataFactory fill = GridDataFactory.fillDefaults();

    UIControlsFactory.createLabel(shell, "Value:"); //$NON-NLS-1$
    final Text txtValue = UIControlsFactory.createText(shell, SWT.READ_ONLY);
    txtValue.setEnabled(false);// ww w .j  a  va  2 s  .  c  o  m
    fill.applyTo(txtValue);

    UIControlsFactory.createLabel(shell, "Date:"); //$NON-NLS-1$
    final DateTime dtDate = UIControlsFactory.createDate(shell, SWT.MEDIUM);
    fill.applyTo(dtDate);
    final IDateTimeRidget dtDateRidget = (IDateTimeRidget) SwtRidgetFactory.createRidget(dtDate);
    dtDateRidget.bindToModel(value, TypedBean.PROP_VALUE);
    dtDateRidget.updateFromModel();

    UIControlsFactory.createLabel(shell, "Time:"); //$NON-NLS-1$
    final DateTime dtTime = UIControlsFactory.createTime(shell, SWT.MEDIUM);
    fill.applyTo(dtTime);
    final IDateTimeRidget dtTimeRidget = (IDateTimeRidget) SwtRidgetFactory.createRidget(dtTime);
    dtTimeRidget.bindToModel(value, TypedBean.PROP_VALUE);
    dtTimeRidget.updateFromModel();

    final Button btnSync = UIControlsFactory.createButton(shell);
    btnSync.setText("Sync"); //$NON-NLS-1$
    GridDataFactory.fillDefaults().span(2, 1).applyTo(btnSync);
    final IActionRidget btnSyncRidget = (IActionRidget) SwtRidgetFactory.createRidget(btnSync);
    btnSyncRidget.addListener(new IActionListener() {
        private long days = 0;

        public void callback() {
            days++;
            final long millis = System.currentTimeMillis() + (days * 24 * 3600 * 1000);
            value.setValue(new Date(millis));
            dtDateRidget.updateFromModel();
            dtTimeRidget.updateFromModel();
        }
    });

    final DataBindingContext dbc = new DataBindingContext();
    dbc.bindValue(WidgetProperties.text().observe(txtValue),
            BeansObservables.observeValue(value, TypedBean.PROP_VALUE), null,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:org.eclipse.scada.ca.ui.editor.forms.common.ConfigurationFormToolkit.java

License:Open Source License

public void createStandardCombo(final Composite parent, final String attributeName, final String label,
        final String[] items, final IObservableMap data, final Object valueType) {
    this.toolkit.createLabel(parent, label + ":");

    final Combo combo = new Combo(parent, SWT.DROP_DOWN);

    combo.setItems(items);//from  w ww. j a v  a2  s .c om
    this.toolkit.adapt(combo);

    final GridData gd = new GridData(GridData.FILL, GridData.BEGINNING, true, true);
    gd.horizontalSpan = 2;
    combo.setLayoutData(gd);

    final IObservableValue value = Observables.observeMapEntry(data, attributeName, valueType);
    this.dbc.bindValue(WidgetProperties.text().observe(combo), value);
}

From source file:org.fusesource.ide.sap.ui.properties.AuthenticationPropertySection.java

License:Open Source License

protected DataBindingContext initDataBindings() {

    DataBindingContext bindingContext = super.initDataBindings();

    ///*ww  w. jav  a 2 s . c  o  m*/
    IObservableValue observeTextAuthTypeComboObserveWidget = WidgetProperties.text().observe(authTypeCombo);
    IObservableValue managedConnectionFactoryAuthTypeObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__AUTH_TYPE))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextAuthTypeComboObserveWidget,
            managedConnectionFactoryAuthTypeObserveValue, null, null);
    //
    IObservableValue observeTextClientText2ObserveWidget = WidgetProperties.text(SWT.FocusOut)
            .observe(clientText2);
    IObservableValue managedConnectionFactoryClientObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__CLIENT))
            .observe(destinationDataStoreEntry);
    UpdateValueStrategy clientStrategy2 = new UpdateValueStrategy();
    clientStrategy2.setBeforeSetValidator(new ClientNumberValidator());
    clientBinding2 = bindingContext.bindValue(observeTextClientText2ObserveWidget,
            managedConnectionFactoryClientObserveValue, clientStrategy2, null);
    //
    IObservableValue observeTextUserText2ObserveWidget = WidgetProperties.text(SWT.FocusOut).observe(userText2);
    IObservableValue managedConnectionFactoryUserObserveValue = EMFEditProperties.value(editingDomain,
            FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__USER))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextUserText2ObserveWidget, managedConnectionFactoryUserObserveValue, null,
            null);
    //
    IObservableValue observeTextUserAliasObserveWidget = WidgetProperties.text(SWT.FocusOut).observe(userAlias);
    IObservableValue managedConnectionFactoryAliasUserObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__ALIAS_USER))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextUserAliasObserveWidget, managedConnectionFactoryAliasUserObserveValue,
            null, null);
    //
    IObservableValue observeTextPasswordText2ObserveWidget = WidgetProperties.text(SWT.FocusOut)
            .observe(passwordText2);
    IObservableValue managedConnectionFactoryPasswordObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__PASSWORD))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextPasswordText2ObserveWidget,
            managedConnectionFactoryPasswordObserveValue, null, null);
    //
    IObservableValue observeTextMysapsso2TextObserveWidget = WidgetProperties.text(SWT.FocusOut)
            .observe(mysapsso2Text);
    IObservableValue managedConnectionFactoryMysapsso2ObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__MYSAPSSO2))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextMysapsso2TextObserveWidget,
            managedConnectionFactoryMysapsso2ObserveValue, null, null);
    //
    IObservableValue observeTextX509certTextObserveWidget = WidgetProperties.text(SWT.FocusOut)
            .observe(x509certText);
    IObservableValue managedConnectionFactoryX509certObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__X509CERT))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextX509certTextObserveWidget, managedConnectionFactoryX509certObserveValue,
            null, null);
    //
    IObservableValue observeTextLanguageText2ObserveWidget = WidgetProperties.text(SWT.FocusOut)
            .observe(languageText2);
    IObservableValue managedConnectionFactoryLangObserveValue = EMFEditProperties.value(editingDomain,
            FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__LANG))
            .observe(destinationDataStoreEntry);
    UpdateValueStrategy strategy_3 = new UpdateValueStrategy();
    strategy_3.setBeforeSetValidator(new LanguageValidator());
    langBinding2 = bindingContext.bindValue(observeTextLanguageText2ObserveWidget,
            managedConnectionFactoryLangObserveValue, strategy_3, null);

    clientDecorator = ControlDecorationSupport.create(clientBinding2, SWT.TOP | SWT.LEFT);
    langDecorator = ControlDecorationSupport.create(langBinding2, SWT.TOP | SWT.LEFT);

    return bindingContext;
}

From source file:org.fusesource.ide.sap.ui.properties.uicreator.AuthenticationDestinationDataUICreator.java

License:Open Source License

@Override
public void initDataBindings(DataBindingContext bindingContext, EditingDomain editingDomain,
        DestinationDataStoreEntryImpl destinationDataStoreEntry) {
    ///*from   w  w  w  .java2 s  .  c  o m*/
    IObservableValue observeTextAuthTypeComboObserveWidget = WidgetProperties.text().observe(authTypeCombo);
    IObservableValue managedConnectionFactoryAuthTypeObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__AUTH_TYPE))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextAuthTypeComboObserveWidget,
            managedConnectionFactoryAuthTypeObserveValue);
    //
    IObservableValue observeTextClientText2ObserveWidget = WidgetProperties.text(SWT.Modify).observeDelayed(300,
            clientText2);
    IObservableValue managedConnectionFactoryClientObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__CLIENT))
            .observe(destinationDataStoreEntry);
    UpdateValueStrategy clientStrategy2 = new UpdateValueStrategy();
    clientStrategy2.setBeforeSetValidator(new ClientNumberValidator());
    Binding clientBinding2 = bindingContext.bindValue(observeTextClientText2ObserveWidget,
            managedConnectionFactoryClientObserveValue, clientStrategy2, null);
    //
    IObservableValue observeTextUserText2ObserveWidget = WidgetProperties.text(SWT.Modify).observeDelayed(300,
            userText2);
    IObservableValue managedConnectionFactoryUserObserveValue = EMFEditProperties.value(editingDomain,
            FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__USER))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextUserText2ObserveWidget, managedConnectionFactoryUserObserveValue);
    //
    IObservableValue observeTextUserAliasObserveWidget = WidgetProperties.text(SWT.Modify).observeDelayed(300,
            userAlias);
    IObservableValue managedConnectionFactoryAliasUserObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__ALIAS_USER))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextUserAliasObserveWidget, managedConnectionFactoryAliasUserObserveValue);
    //
    IObservableValue observeTextPasswordText2ObserveWidget = WidgetProperties.text(SWT.Modify)
            .observeDelayed(300, passwordText2);
    IObservableValue managedConnectionFactoryPasswordObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__PASSWORD))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextPasswordText2ObserveWidget,
            managedConnectionFactoryPasswordObserveValue);
    //
    IObservableValue observeTextMysapsso2TextObserveWidget = WidgetProperties.text(SWT.Modify)
            .observeDelayed(300, mysapsso2Text);
    IObservableValue managedConnectionFactoryMysapsso2ObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__MYSAPSSO2))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextMysapsso2TextObserveWidget,
            managedConnectionFactoryMysapsso2ObserveValue);
    //
    IObservableValue observeTextX509certTextObserveWidget = WidgetProperties.text(SWT.Modify)
            .observeDelayed(300, x509certText);
    IObservableValue managedConnectionFactoryX509certObserveValue = EMFEditProperties
            .value(editingDomain, FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE,
                    Literals.DESTINATION_DATA__X509CERT))
            .observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextX509certTextObserveWidget,
            managedConnectionFactoryX509certObserveValue);
    //
    IObservableValue observeTextLanguageText2ObserveWidget = WidgetProperties.text(SWT.Modify)
            .observeDelayed(300, languageText2);
    IObservableValue managedConnectionFactoryLangObserveValue = EMFEditProperties.value(editingDomain,
            FeaturePath.fromList(Literals.DESTINATION_DATA_STORE_ENTRY__VALUE, Literals.DESTINATION_DATA__LANG))
            .observe(destinationDataStoreEntry);
    UpdateValueStrategy strategy_3 = new UpdateValueStrategy();
    strategy_3.setBeforeSetValidator(new LanguageValidator());
    Binding langBinding2 = bindingContext.bindValue(observeTextLanguageText2ObserveWidget,
            managedConnectionFactoryLangObserveValue, strategy_3, null);

    ControlDecorationSupport.create(clientBinding2, SWT.TOP | SWT.LEFT);
    ControlDecorationSupport.create(langBinding2, SWT.TOP | SWT.LEFT);
}