Example usage for org.eclipse.jface.databinding.swt SWTObservables observeText

List of usage examples for org.eclipse.jface.databinding.swt SWTObservables observeText

Introduction

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

Prototype

@Deprecated
public static ISWTObservableValue observeText(Control control) 

Source Link

Document

Returns an observable observing the text attribute of the provided control.

Usage

From source file:com.amazonaws.eclipse.elasticbeanstalk.server.ui.configEditor.basic.AdvancedEnvironmentTypeConfigEditorSection.java

License:Apache License

/**
 * Create a read only label instead of combo
 *//*from  www. j  a  v  a2s  . c o m*/
@Override
protected void createCombo(Composite parent, ConfigurationOptionDescription option) {
    Label label = createLabel(toolkit, parent, option);
    label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
    final Label typeLabel = new Label(parent, SWT.READ_ONLY);
    IObservableValue modelv = model.observeEntry(option);
    ISWTObservableValue widget = SWTObservables.observeText(typeLabel);
    parentEditor.getDataBindingContext().bindValue(widget, modelv,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE));

}

From source file:com.amazonaws.eclipse.lambda.project.wizard.util.LambdaFunctionGroup.java

License:Open Source License

public void createLambdaHandlerControl() {
    // create handler type control
    newFillingLabel(inputComposite, "Handler Type");
    handlerTypeCombo = createHandlerTypeCombo(inputComposite, 1);
    handlerTypeDescriptionLink = newLink(inputComposite, UrlConstants.webLinkListener, "", 1);
    setItalicFont(handlerTypeDescriptionLink);

    // create input type control
    newFillingLabel(inputComposite, "Input Type:");
    predefinedHandlerInputCombo = createPredefinedHandlerInputTypeCombo(inputComposite, 1);
    customHandlerInputTypeText = newText(inputComposite, "", 1);
    customHandlerInputTypeTextDecoration = newControlDecoration(customHandlerInputTypeText, "");

    // create output type control
    newFillingLabel(inputComposite, "Output Type:");
    handlerOutputTypeText = newText(inputComposite, "", 2);
    handlerOutputTypeTextDecoration = newControlDecoration(handlerOutputTypeText, "");

    // bind handler type control to data model
    handlerTypeComboObservable = SWTObservables.observeText(handlerTypeCombo);
    bindingContext.bindValue(handlerTypeComboObservable,
            PojoObservables.observeValue(dataModel, P_HANDLER_TYPE));

    // bind input type control to data model
    customHandlerInputTypeTextObservable = SWTObservables.observeText(customHandlerInputTypeText, SWT.Modify);
    bindingContext.bindValue(customHandlerInputTypeTextObservable,
            PojoObservables.observeValue(dataModel, P_CUSTOM_HANDLER_INPUT_TYPE));

    // bind output type control to data model
    handlerOutputTypeTextObservable = SWTObservables.observeText(handlerOutputTypeText, SWT.Modify);
    bindingContext.bindValue(handlerOutputTypeTextObservable,
            PojoObservables.observeValue(dataModel, P_HANDLER_OUTPUT_TYPE));

    // bind validation of input type
    ChainValidator<String> customHandlerInputChainValidator = new ChainValidator<String>(
            customHandlerInputTypeTextObservable, enableCustomHandlerInputTypeValidation, //enabler
            new NotEmptyValidator("Please provide a valid input type"));
    bindingContext.addValidationStatusProvider(customHandlerInputChainValidator);
    new DecorationChangeListener(customHandlerInputTypeTextDecoration,
            customHandlerInputChainValidator.getValidationStatus());

    // bind validation of output type
    ChainValidator<String> handlerOutputChainValidator = new ChainValidator<String>(
            handlerOutputTypeTextObservable, new NotEmptyValidator("Please provide a valid output type"));
    bindingContext.addValidationStatusProvider(handlerOutputChainValidator);
    new DecorationChangeListener(handlerOutputTypeTextDecoration,
            handlerOutputChainValidator.getValidationStatus());

    // bind validation of SDK installed
    ChainValidator<Boolean> sdkInstalledValidator = new ChainValidator<Boolean>(sdkInstalledObservable,
            enableSdkInstalledValidation, // enabler
            new BooleanValidator("The selected input type requires the AWS Java SDK dependency. "
                    + "Please install the SDK first "
                    + "(Window -> Preference -> AWS Toolkit -> AWS SDK for Java) " + "and then retry."));
    bindingContext.addValidationStatusProvider(sdkInstalledValidator);
}

From source file:com.ebmwebsourcing.petals.services.cdk.editor.CDK5JBIEndpointUIHelper.java

License:Open Source License

/**
 * Creates the specific UI for "consume" blocks in the JBI editor (with CDK 5 fields).
 * @param endpoint/* ww  w. j  a  v  a 2 s  . c o  m*/
 * @param toolkit
 * @param cdkComposite
 * @param ise
 * @param parent
 * @param commonUiBean
 */
public static void createConsumesUI(final AbstractEndpoint endpoint, final FormToolkit toolkit,
        final Composite parent, final ISharedEdition ise, final CommonUIBean commonUiBean) {

    Color blueFont = parent.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE);

    // The controls
    SwtFactory
            .createLabel(parent, "Operation Namespace:",
                    "The QName of the operation (should match an operation declared in a WSDL)")
            .setForeground(blueFont);
    final Text opNamespaceText = SwtFactory.createSimpleTextField(parent, true);

    SwtFactory
            .createLabel(parent, "Operation Name:",
                    "The QName of the operation (should match an operation declared in a WSDL)")
            .setForeground(blueFont);
    final Text opNameText = SwtFactory.createSimpleTextField(parent, true);

    SwtFactory
            .createLabel(parent, "Invocation MEP *:", "The Message Exchange Pattern to use for the invocation")
            .setForeground(blueFont);
    ComboViewer mepViewer = SwtFactory.createDefaultComboViewer(parent, false, true, Mep.values());
    toolkit.adapt(mepViewer.getCombo());

    // Add the helpers
    toolkit.createLabel(parent, "");
    Hyperlink selectLink = toolkit.createHyperlink(parent, "Select a Petals service and an operation to invoke",
            SWT.NONE);
    selectLink.setToolTipText("Select the service and the operation to invoke from the known Petals services");

    // The data-binding
    ise.getDataBindingContext().bindValue(SWTObservables.observeText(opNameText),
            EObjectUIHelper.createCustomEmfEditObservable(ise.getEditingDomain(), endpoint,
                    Cdk5Package.Literals.CDK5_CONSUMES__OPERATION),
            null, new UpdateValueStrategy().setConverter(new LocalQNameToStringConverter()));

    ise.getDataBindingContext().bindValue(SWTObservables.observeText(opNamespaceText),
            EObjectUIHelper.createCustomEmfEditObservable(ise.getEditingDomain(), endpoint,
                    Cdk5Package.Literals.CDK5_CONSUMES__OPERATION),
            null, new UpdateValueStrategy().setConverter(new NamespaceQNameToStringConverter()));

    ise.getDataBindingContext().bindValue(ViewersObservables.observeSingleSelection(mepViewer),
            EObjectUIHelper.createCustomEmfEditObservable(ise.getEditingDomain(), endpoint,
                    Cdk5Package.Literals.CDK5_CONSUMES__MEP),
            new UpdateValueStrategy().setConverter(new MepToStringConverter()),
            new UpdateValueStrategy().setConverter(new StringToMepConverter()));

    // The data-binding handles the "model to target (widget)" parts. But not ALL the "widget to model" parts.
    // For QNames, in fact, the data-binding cannot be applied in this sense. We have to use a modify listener for this.
    final ActivableListener activableListener = JBIEndpointUIHelpers.createModifyListenerForQname(
            ise.getEditingDomain(), endpoint, opNamespaceText, opNameText,
            Cdk5Package.Literals.CDK5_CONSUMES__OPERATION, true);

    // Deal with the helper listener
    selectLink.addHyperlinkListener(new PetalsHyperlinkListener() {
        @Override
        public void linkActivated(HyperlinkEvent e) {

            final EnhancedConsumeDialog dlg = new EnhancedConsumeDialog(parent.getShell(), toolkit);
            if (dlg.open() == Window.OK) {

                // Prepare the model update
                CompoundCommand compositeCommand = new CompoundCommand();
                EditingDomain editDomain = ise.getEditingDomain();

                QName q = dlg.getItfToInvoke();
                Command command = new SetCommand(editDomain, endpoint,
                        JbiPackage.Literals.ABSTRACT_ENDPOINT__INTERFACE_NAME, q);
                compositeCommand.append(command);

                q = dlg.getSrvToInvoke();
                command = new SetCommand(editDomain, endpoint,
                        JbiPackage.Literals.ABSTRACT_ENDPOINT__SERVICE_NAME, q);
                compositeCommand.append(command);

                String edpt = dlg.getEdptToInvoke();
                command = new SetCommand(editDomain, endpoint,
                        JbiPackage.Literals.ABSTRACT_ENDPOINT__ENDPOINT_NAME, edpt);
                compositeCommand.append(command);

                command = EObjectUIHelper.createCustomSetCommand(editDomain, endpoint,
                        Cdk5Package.Literals.CDK5_CONSUMES__OPERATION, dlg.getOperationToInvoke());
                compositeCommand.append(command);

                String mep = dlg.getInvocationMep() == Mep.UNKNOWN ? null : dlg.getInvocationMep().toString();
                command = EObjectUIHelper.createCustomSetCommand(editDomain, endpoint,
                        Cdk5Package.Literals.CDK5_CONSUMES__MEP, mep);
                compositeCommand.append(command);

                // Identify the listeners to disable, so that all the fields are correctly set
                List<ActivableListener> theListeners = new ArrayList<ActivableListener>();
                theListeners.add(activableListener);
                for (Text t : new Text[] { commonUiBean.itfNameText, commonUiBean.srvNameText }) {
                    for (Listener ml : t.getListeners(SWT.Modify)) {
                        if (ml instanceof ActivableListener)
                            theListeners.add((ActivableListener) ml);
                    }
                }

                // Perform the update carefully
                for (ActivableListener ml : theListeners)
                    ml.setEnabled(false);

                editDomain.getCommandStack().execute(compositeCommand);
                for (ActivableListener ml : theListeners)
                    ml.setEnabled(true);
            }
        }
    });
}

From source file:com.ebmwebsourcing.petals.services.sa.editor.SaEditionComposite.java

License:Open Source License

/**
 * Creates the section for the properties of a service assembly.
 * @param parent the parent//w w w . j  a v  a2 s  .co m
 * @return a new section
 */
private Composite createSaSection(Composite parent) {

    // Container
    FormToolkit toolkit = this.ise.getFormToolkit();
    Composite container = toolkit.createComposite(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginTop = 11;
    layout.marginLeft = 3;
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    Section section = toolkit.createSection(container,
            Section.DESCRIPTION | ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    section.clientVerticalSpacing = 10;
    section.setText("Service Assembly's Properties");
    section.setDescription("Edit the properties of the selected service assembly.");

    container = toolkit.createComposite(section, SWT.NONE);
    layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 10;
    container.setLayout(layout);
    container.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    section.setClient(container);

    // Texts
    final ServiceAssembly sa = (ServiceAssembly) this.viewerSelection;
    Label label = SwtFactory.createLabel(container, "Name:", "The name of the service assembly");
    label.setForeground(this.blueFont);

    this.saNameText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.saNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.saNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            SaEditionComposite.this.viewer.refresh(sa, true);
        }
    });

    this.ise.getDataBindingContext().bindValue(SWTObservables.observeText(this.saNameText),
            EMFEditObservables.observeValue(this.ise.getEditingDomain(), sa.getIdentification(),
                    JbiPackage.Literals.IDENTIFICATION__NAME));

    label = SwtFactory.createLabel(container, "Description:", "The description of the service assembly");
    label.setForeground(this.blueFont);
    label.setLayoutData(new GridData(SWT.DEFAULT, SWT.TOP, false, false));

    this.saDescText = toolkit.createText(container, "", SWT.MULTI | SWT.BORDER);
    GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    layoutData.heightHint = 60;
    this.saDescText.setLayoutData(layoutData);
    this.ise.getDataBindingContext().bindValue(SWTObservables.observeText(this.saDescText),
            EMFEditObservables.observeValue(this.ise.getEditingDomain(), sa.getIdentification(),
                    JbiPackage.Literals.IDENTIFICATION__DESCRIPTION));

    return section.getParent();
}

From source file:com.ebmwebsourcing.petals.services.sa.editor.SaEditionComposite.java

License:Open Source License

/**
 * Creates the section for the properties of a service unit.
 * @param parent the parent// w w  w . j  a  va  2  s. com
 * @return a new section
 */
private Composite createSuSection(Composite parent) {

    // Container
    FormToolkit toolkit = this.ise.getFormToolkit();
    Composite container = toolkit.createComposite(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginTop = 11;
    layout.marginLeft = 3;
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    Section section = toolkit.createSection(container,
            Section.DESCRIPTION | ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
    section.setLayoutData(new GridData(GridData.FILL_BOTH));
    section.clientVerticalSpacing = 10;
    section.setText("Service Unit's Properties");
    section.setDescription("Edit the properties of the selected service unit.");

    container = toolkit.createComposite(section, SWT.NONE);
    layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 10;
    container.setLayout(layout);
    container.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
    section.setClient(container);

    // Texts
    final ServiceUnit su = (ServiceUnit) this.viewerSelection;
    Label label = SwtFactory.createLabel(container, "Name:", "The name of the service assembly");
    label.setForeground(this.blueFont);

    this.suNameText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.suNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.suNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            SaEditionComposite.this.viewer.refresh(su, true);
        }
    });

    this.ise.getDataBindingContext().bindValue(SWTObservables.observeText(this.suNameText),
            EMFEditObservables.observeValue(this.ise.getEditingDomain(), su.getIdentification(),
                    JbiPackage.Literals.IDENTIFICATION__NAME));

    label = SwtFactory.createLabel(container, "Description:", "The description of the service assembly");
    label.setForeground(this.blueFont);
    label.setLayoutData(new GridData(SWT.DEFAULT, SWT.TOP, false, false));

    this.suDescText = toolkit.createText(container, "", SWT.MULTI | SWT.BORDER);
    GridData layoutData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    layoutData.heightHint = 60;
    this.suDescText.setLayoutData(layoutData);
    this.ise.getDataBindingContext().bindValue(SWTObservables.observeText(this.suDescText),
            EMFEditObservables.observeValue(this.ise.getEditingDomain(), su.getIdentification(),
                    JbiPackage.Literals.IDENTIFICATION__DESCRIPTION));

    label = SwtFactory.createLabel(container, "Zip Artifact:", "The name of the *.zip artifact");
    label.setForeground(this.blueFont);

    this.suArtifactsText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.suArtifactsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.ise.getDataBindingContext().bindValue(SWTObservables.observeText(this.suArtifactsText),
            EMFEditObservables.observeValue(this.ise.getEditingDomain(), su.getTarget(),
                    JbiPackage.Literals.TARGET__ARTIFACTS_ZIP));

    label = SwtFactory.createLabel(container, "Component name:", "The name of the target component");
    label.setForeground(this.blueFont);

    this.suComponentText = toolkit.createText(container, "", SWT.SINGLE | SWT.BORDER);
    this.suComponentText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.ise.getDataBindingContext().bindValue(SWTObservables.observeText(this.suComponentText),
            EMFEditObservables.observeValue(this.ise.getEditingDomain(), su.getTarget(),
                    JbiPackage.Literals.TARGET__COMPONENT_NAME));

    return section.getParent();
}

From source file:com.ebmwebsourcing.petals.services.su.editor.su.JBIEndpointUIHelpers.java

License:Open Source License

/**
 * Creates the common widgets for the main tab in the JBI editor.
 * @param endpoint//w w  w .  ja v  a 2 s  . co m
 * @param toolkit
 * @param generalDetails
 * @param ise
 */
public static CommonUIBean createCommonEndpointUI(final AbstractEndpoint endpoint, FormToolkit toolkit,
        final Composite container, final ISharedEdition ise) {

    // Controls
    String end = endpoint instanceof Provides ? " *:" : ":";
    Color blueFont = container.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE);

    SwtFactory.createLabel(container, "Interface Namespace *:", "The qualified name of the service contract")
            .setForeground(blueFont);
    final Text itfNamespaceText = SwtFactory.createSimpleTextField(container, true);

    SwtFactory.createLabel(container, "Interface Name *:", "The qualified name of the service contract")
            .setForeground(blueFont);
    final Text itfNameText = SwtFactory.createSimpleTextField(container, true);

    SwtFactory.createLabel(container, "Service Namespace" + end,
            "The qualified name of the service implementation").setForeground(blueFont);
    final Text srvNamespaceText = SwtFactory.createSimpleTextField(container, true);

    SwtFactory.createLabel(container, "Service Name" + end, "The qualified name of the service implementation")
            .setForeground(blueFont);
    final Text srvNameText = SwtFactory.createSimpleTextField(container, true);

    Label edptLabel = SwtFactory.createLabel(container, "End-point Name" + end,
            "The name of the service deployment point");
    edptLabel.setForeground(blueFont);
    Text edptText = SwtFactory.createSimpleTextField(container, true);

    // Data-binding
    ise.getDataBindingContext().bindValue(SWTObservables.observeText(itfNameText),
            EMFEditObservables.observeValue(ise.getEditingDomain(), endpoint,
                    JbiPackage.Literals.ABSTRACT_ENDPOINT__INTERFACE_NAME),
            null, new UpdateValueStrategy().setConverter(new LocalQNameToStringConverter()));

    ise.getDataBindingContext().bindValue(SWTObservables.observeText(itfNamespaceText),
            EMFEditObservables.observeValue(ise.getEditingDomain(), endpoint,
                    JbiPackage.Literals.ABSTRACT_ENDPOINT__INTERFACE_NAME),
            null, new UpdateValueStrategy().setConverter(new NamespaceQNameToStringConverter()));

    ise.getDataBindingContext().bindValue(SWTObservables.observeText(srvNameText),
            EMFEditObservables.observeValue(ise.getEditingDomain(), endpoint,
                    JbiPackage.Literals.ABSTRACT_ENDPOINT__SERVICE_NAME),
            null, new UpdateValueStrategy().setConverter(new LocalQNameToStringConverter()));

    ise.getDataBindingContext().bindValue(SWTObservables.observeText(srvNamespaceText),
            EMFEditObservables.observeValue(ise.getEditingDomain(), endpoint,
                    JbiPackage.Literals.ABSTRACT_ENDPOINT__SERVICE_NAME),
            null, new UpdateValueStrategy().setConverter(new NamespaceQNameToStringConverter()));

    ise.getDataBindingContext().bindValue(
            SWTObservables.observeDelayedValue(200, SWTObservables.observeText(edptText, SWT.Modify)),
            EMFEditObservables.observeValue(ise.getEditingDomain(), endpoint,
                    JbiPackage.Literals.ABSTRACT_ENDPOINT__ENDPOINT_NAME));

    // The data-binding handles the "model to target (widget)" parts. But not ALL the "widget to model" parts.
    // For QNames, in fact, the data-binding cannot be applied in this sense. We have to use a modify listener for this.
    createModifyListenerForQname(ise.getEditingDomain(), endpoint, itfNamespaceText, itfNameText,
            JbiPackage.Literals.ABSTRACT_ENDPOINT__INTERFACE_NAME, false);

    createModifyListenerForQname(ise.getEditingDomain(), endpoint, srvNamespaceText, srvNameText,
            JbiPackage.Literals.ABSTRACT_ENDPOINT__SERVICE_NAME, false);

    // PETALSSTUD-268: Wrong handling of empty end-point name
    // Do not set an empty end-point name in the model
    edptText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {

            String value = ((Text) e.widget).getText().trim();
            if (value.length() > 0)
                return;

            Command cmd = EObjectUIHelper.createCustomSetCommand(ise.getEditingDomain(), endpoint,
                    JbiPackage.Literals.ABSTRACT_ENDPOINT__ENDPOINT_NAME, null);
            ise.getEditingDomain().getCommandStack().execute(cmd);
        }
    });
    // PETALSSTUD-268

    // Complete the UI effects
    final ModifyListener sameNsModifyListener = new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            String serviceNs = srvNamespaceText.getText();
            String interfaceNs = itfNamespaceText.getText();

            Color fgColor;
            if (serviceNs.trim().length() > 0 && serviceNs.equals(interfaceNs))
                fgColor = container.getDisplay().getSystemColor(SWT.COLOR_DARK_GREEN);
            else
                fgColor = container.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);

            srvNamespaceText.setForeground(fgColor);
            itfNamespaceText.setForeground(fgColor);
        }
    };

    FocusListener nsFocusListener = new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            ((Text) e.widget).addModifyListener(sameNsModifyListener);
            ((Text) e.widget).notifyListeners(SWT.Modify, new Event());
        }

        @Override
        public void focusLost(FocusEvent e) {
            ((Text) e.widget).removeModifyListener(sameNsModifyListener);
            Color fgColor = container.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
            srvNamespaceText.setForeground(fgColor);
            itfNamespaceText.setForeground(fgColor);
        }
    };

    itfNamespaceText.addFocusListener(nsFocusListener);
    srvNamespaceText.addFocusListener(nsFocusListener);

    // Prepare the result
    CommonUIBean result = new CommonUIBean();
    result.edptText = edptText;
    result.itfNameText = itfNameText;
    result.itfNamespaceText = itfNamespaceText;
    result.srvNameText = srvNameText;
    result.srvNamespaceText = srvNamespaceText;
    result.edptLabel = edptLabel;

    return result;
}

From source file:com.jaspersoft.studio.data.hive.HiveDataAdapterComposite.java

License:Open Source License

@Override
protected void bindWidgets(DataAdapter dataAdapter) {
    bindingContext.bindValue(SWTObservables.observeText(urlCombo),
            PojoObservables.observeValue(dataAdapter, "url")); //$NON-NLS-1$
    bindingContext.bindValue(SWTObservables.observeText(usernameField, SWT.Modify),
            PojoObservables.observeValue(dataAdapter, "username")); //$NON-NLS-1$
    bindingContext.bindValue(SWTObservables.observeText(passwordField, SWT.Modify),
            PojoObservables.observeValue(dataAdapter, "password")); //$NON-NLS-1$
}

From source file:com.jaspersoft.studio.server.properties.QuerySection.java

License:Open Source License

@Override
protected void bind() {
    bindingContext.bindValue(SWTObservables.observeText(clang),
            PojoObservables.observeValue(getProxy(res.getValue()), "language"));
    bindingContext.bindValue(SWTObservables.observeText(tsql, SWT.Modify),
            PojoObservables.observeValue(res.getValue(), "sql"));
}

From source file:com.netxforge.netxstudio.screens.f4.NewEditMappingColumn.java

License:Open Source License

private void initDataBindingHeaderMappingColumn(EMFDataBindingContext context) {

    // ///////////////////////////
    // WRITABLE OBSERVABLES MAPPING COLUMN KIND
    // ///////////////////////////

    btnIdentifierWritableValue = new WritableValue();
    btnDateTimeWritableValue = new WritableValue();
    btnDateWritableValue = new WritableValue();
    btnTimeWritableValue = new WritableValue();
    btnIntervalWritableValue = new WritableValue();

    identifierObservable = SWTObservables.observeSelection(btnIdentifier);
    dateTimeObservable = SWTObservables.observeSelection(btnDatetime);
    dateObservable = SWTObservables.observeSelection(btnDate);
    timeObservable = SWTObservables.observeSelection(btnTime);
    intervalObservable = SWTObservables.observeSelection(this.btnInterval);

    context.bindValue(identifierObservable, btnIdentifierWritableValue, null, null);
    context.bindValue(dateTimeObservable, btnDateTimeWritableValue, null, null);
    context.bindValue(dateObservable, btnDateWritableValue, null, null);
    context.bindValue(timeObservable, btnTimeWritableValue, null, null);
    context.bindValue(intervalObservable, btnIntervalWritableValue, null, null);

    // ///////////////////////////
    // PATTERN FIELD OBSERVABLES
    // ///////////////////////////
    dateTimePatternObservable = SWTObservables.observeText(this.cmbDateTimePattern);
    datePatternObservable = SWTObservables.observeText(this.cmbDatePattern);
    timePatternObservable = SWTObservables.observeText(this.cmbTimePattern);

    // ///////////////////////////
    // IDENTIFIER BINDING
    // ///////////////////////////

    IObservableValue identifierPatternObservable = SWTObservables.observeDelayedValue(400,
            SWTObservables.observeText(this.txtIdentifierPattern, SWT.Modify));

    IObservableValue objectKindObservable = SWTObservables.observeText(this.txtObject, SWT.Modify);

    IObservableValue objectAttributeObservable = SWTObservables.observeText(this.txtObjectAttribute,
            SWT.Modify);/*from   w  w  w.  jav  a  2s .c o  m*/

    IEMFEditValueProperty objectPatternProperty = EMFEditProperties.value(editingService.getEditingDomain(),
            FeaturePath.fromList(MetricsPackage.Literals.MAPPING_COLUMN__DATA_TYPE,
                    MetricsPackage.Literals.IDENTIFIER_DATA_KIND__PATTERN));

    IEMFEditValueProperty objectKindProperty = EMFEditProperties.value(editingService.getEditingDomain(),
            FeaturePath.fromList(MetricsPackage.Literals.MAPPING_COLUMN__DATA_TYPE,
                    MetricsPackage.Literals.IDENTIFIER_DATA_KIND__OBJECT_KIND));

    IEMFEditValueProperty objectAttributeProperty = EMFEditProperties.value(editingService.getEditingDomain(),
            FeaturePath.fromList(MetricsPackage.Literals.MAPPING_COLUMN__DATA_TYPE,
                    MetricsPackage.Literals.IDENTIFIER_DATA_KIND__OBJECT_PROPERTY));

    context.bindValue(identifierPatternObservable, objectPatternProperty.observe(mxlsColumn));

    EMFUpdateValueStrategy mttObjectKindStrategy = new EMFUpdateValueStrategy();
    mttObjectKindStrategy.setConverter(new MTTObjectKindStrategy());

    EMFUpdateValueStrategy ttmObjectKindStrategy = new EMFUpdateValueStrategy();
    ttmObjectKindStrategy.setConverter(new TTMObjectKindStrategy());

    context.bindValue(objectKindObservable, objectKindProperty.observe(mxlsColumn), ttmObjectKindStrategy,
            mttObjectKindStrategy);

    /*
     * A default strategy to delegate to the default converter, for non
     * specific cases.
     */
    EMFUpdateValueStrategy mttObjectAttributeStrategy = new EMFUpdateValueStrategy();
    mttObjectAttributeStrategy.setConverter(new MTTObjectAttributeStrategy());

    EMFUpdateValueStrategy ttmObjectAttributeStrategy = new EMFUpdateValueStrategy();
    ttmObjectAttributeStrategy.setConverter(new TTMObjectAttributeConverter());

    context.bindValue(objectAttributeObservable, objectAttributeProperty.observe(mxlsColumn),
            ttmObjectAttributeStrategy, mttObjectAttributeStrategy);

}

From source file:com.rcpcompany.uibindings.internal.uiAttributeFactories.TextUIAttributeFactory.java

License:Open Source License

@Override
public IUIAttribute create(Widget widget, String attribute) {
    final boolean changeable = (widget instanceof Combo) || (widget instanceof CCombo);
    if (widget instanceof Button)
        return new SimpleUIAttribute(widget, attribute, new ButtonTextObservableValue((Button) widget),
                changeable);//from  w w  w.  j  ava  2 s.  c  o  m
    else
        return new SimpleUIAttribute(widget, attribute, SWTObservables.observeText((Control) widget),
                changeable);
}