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

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

Introduction

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

Prototype

@Deprecated
public static ISWTObservableValue observeSelection(Control control) 

Source Link

Document

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

Usage

From source file:de.uniluebeck.itm.spyglass.gui.databinding.ComboBoxEditingSupport.java

License:Open Source License

@Override
protected IObservableValue doCreateCellEditorObservable(final CellEditor cellEditor) {
    return SWTObservables.observeSelection(cellEditor.getControl());

}

From source file:de.uniluebeck.itm.spyglass.gui.SelectPacketSourceDialog.java

License:Open Source License

@Override
protected Control createDialogArea(final Composite parent) {
    startArea = new Composite(parent, SWT.NONE);
    final FillLayout thisLayout = new FillLayout(org.eclipse.swt.SWT.HORIZONTAL);
    startArea.setLayout(thisLayout);/*w  w  w. j  a v  a  2  s.  co  m*/
    final GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    gridData.grabExcessVerticalSpace = true;
    startArea.setLayoutData(gridData);

    final Group group1 = new Group(startArea, SWT.NONE);
    final GridLayout group1Layout = new GridLayout();
    group1Layout.makeColumnsEqualWidth = false;
    group1Layout.numColumns = 3;
    group1.setLayout(group1Layout);
    group1.setText("Sources");

    buttoniShell = new Button(group1, SWT.RADIO);
    buttoniShell.setText("iShell");

    new Label(group1, SWT.NONE);
    new Label(group1, SWT.NONE);

    buttonWiseBed = new Button(group1, SWT.RADIO);
    buttonWiseBed.setText("Testbed");

    new Label(group1, SWT.NONE);
    new Label(group1, SWT.NONE);

    buttonFile = new Button(group1, SWT.RADIO);
    buttonFile.setText("File");

    // disable the button if we're running standalone
    if (!SpyglassEnvironment.isIshellPlugin()) {
        buttoniShell.setEnabled(false);
    }

    final Composite wrapper = new Composite(group1, SWT.BORDER);
    wrapper.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
    textPath2File = new Text(wrapper, SWT.BORDER);
    textPath2File.setEditable(false);
    final GC gc = new GC(textPath2File);
    final FontMetrics fm = gc.getFontMetrics();
    final int width = 60 * fm.getAverageCharWidth();
    final int height = fm.getHeight();
    gc.dispose();
    textPath2File.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
    textPath2File.setSize(textPath2File.computeSize(width, height));

    buttonOpenFileDialog = new Button(group1, SWT.NONE);
    buttonOpenFileDialog.setText("...");
    buttonOpenFileDialog.addListener(SWT.Selection, new Listener() {
        @SuppressWarnings("synthetic-access")
        public void handleEvent(final Event event) {
            final FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
            fd.setFilterExtensions(new String[] { "*.rec" });
            fd.setFilterPath(new File(defaultDir).getAbsoluteFile().toString());
            final String path = fd.open();
            if (path != null) {
                textPath2File.setText(path);
            }
        }
    });

    // set up data-binding
    {

        myvalues.setUseIShell(!(spyglass.getPacketReader().getSourceType().equals(SOURCE_TYPE.FILE)));
        final DataBindingContext dbc = new DataBindingContext(
                SWTObservables.getRealm(getParentShell().getDisplay()));

        // binding of select button to use a file and text file with its path
        dbc.bindValue(SWTObservables.observeSelection(buttonFile), SWTObservables.observeEnabled(textPath2File),
                null, new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));

        // binding of select button to use a file and open a file selection dialog
        dbc.bindValue(SWTObservables.observeSelection(buttonFile),
                SWTObservables.observeEnabled(buttonOpenFileDialog), null,
                new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));

        // binding of select button to use a file and the select button to use iShell
        dbc.bindValue(SWTObservables.observeSelection(buttonFile),
                SWTObservables.observeSelection(buttoniShell),
                new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                        .setConverter(new BooleanInversionConverter()),
                new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                        .setConverter(new BooleanInversionConverter()));

        // bind the button to select iShell to the corresponding property
        final IObservableValue modelObservableIsIshell = BeansObservables.observeValue(dbc.getValidationRealm(),
                myvalues, "useIShell");
        final IObservableValue modelObservableIsTestbed = BeansObservables
                .observeValue(dbc.getValidationRealm(), myvalues, "useTestbed");
        dbc.bindValue(SWTObservables.observeSelection(buttoniShell), modelObservableIsIshell, null, null);
        dbc.bindValue(SWTObservables.observeSelection(buttonWiseBed), modelObservableIsTestbed, null, null);

        // binding of the text field which contains the path to the file to the corresponding
        // string value
        final IObservableValue modelObservable1 = BeansObservables.observeValue(dbc.getValidationRealm(),
                myvalues, "path2File");
        dbc.bindValue(SWTObservables.observeText(textPath2File, SWT.Modify), modelObservable1, null, null);
    }
    initializeValues();
    group1.pack();
    startArea.pack();
    return startArea;
}

From source file:de.uniluebeck.itm.spyglass.plugin.imagepainter.ImagePainterOptionsComposite.java

License:Open Source License

public void setDatabinding(final DataBindingContext dbc, final ImagePainterXMLConfig config,
        final Spyglass spyglass) {

    this.dbc = dbc;
    this.config = config;

    IObservableValue obsModel;//from ww  w .j a  v  a  2  s. com
    ISWTObservableValue obsWidget;
    UpdateValueStrategy usTargetToModel;

    {
        obsWidget = SWTObservables.observeText(imageFileText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ImagePainterXMLConfig.PROPERTYNAME_IMAGE_FILE_NAME);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                .setAfterGetValidator(new FileReadableValidator());
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeText(lowerLeftXText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ImagePainterXMLConfig.PROPERTYNAME_LOWER_LEFT_X);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeText(lowerLeftYText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ImagePainterXMLConfig.PROPERTYNAME_LOWER_LEFT_Y);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeText(imageSizeWidthText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ImagePainterXMLConfig.PROPERTYNAME_IMAGE_SIZE_X);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        usTargetToModel.setAfterConvertValidator(new IntegerRangeValidator("Image Size", 0, Integer.MAX_VALUE));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeText(imageSizeHeightText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ImagePainterXMLConfig.PROPERTYNAME_IMAGE_SIZE_Y);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        usTargetToModel.setAfterConvertValidator(new IntegerRangeValidator("Image Size", 0, Integer.MAX_VALUE));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeSelection(keepProportionsButton);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ImagePainterXMLConfig.PROPERTYNAME_KEEP_PROPORTIONS);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }

    final MetricsXMLConfig metrics = spyglass.getConfigStore().getSpyglassConfig().getGeneralSettings()
            .getMetrics();
    {
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), metrics,
                MetricsXMLConfig.PROPERTYNAME_UNIT);
        dbc.bindValue(SWTObservables.observeText(xUnitLabel), obsModel, null, null);
        dbc.bindValue(SWTObservables.observeText(yUnitLabel), obsModel, null, null);
        dbc.bindValue(SWTObservables.observeText(widthUnitLabel), obsModel, null, null);
        dbc.bindValue(SWTObservables.observeText(heightUnitLabel), obsModel, null, null);
    }

    updateLock();

}

From source file:de.uniluebeck.itm.spyglass.plugin.nodesensorrange.NodeSensorRangeOptionsComposite.java

License:Open Source License

public void setDatabinding(final DataBindingContext dbc, final NodeSensorRangeXMLConfig.Config config,
        final NodeSensorRangePreferencePage page) {

    this.page = page;
    defaultConfigClone = config.clone();
    defaultConfigClone.addPropertyChangeListener(dirtyListener);

    IObservableValue obsModel;/*w  w  w  . j  a v  a2  s .com*/
    ISWTObservableValue obsWidget;
    UpdateValueStrategy usTargetToModel;
    UpdateValueStrategy usModelToTarget;
    final Realm realm = dbc.getValidationRealm();

    {
        obsWidget = SWTObservables.observeText(defaultLineWidth, SWT.Modify);
        obsModel = BeansObservables.observeValue(realm, defaultConfigClone,
                NodeSensorRangeXMLConfig.PROPERTYNAME_LINE_WIDTH);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        usTargetToModel.setAfterConvertValidator(new IntegerRangeValidator("Line Width", 1, Integer.MAX_VALUE));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeSelection(defaultRangeType);
        obsModel = BeansObservables.observeValue(realm, defaultConfigClone,
                NodeSensorRangeXMLConfig.PROPERTYNAME_RANGE_TYPE);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                .setConverter(new NodeSensorRangeTypeConverter(String.class, Enum.class));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeBackground(defaultRangeForegroundColor);
        obsModel = BeansObservables.observeValue(realm, defaultConfigClone,
                NodeSensorRangeXMLConfig.PROPERTYNAME_COLOR_R_G_B);

        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        usTargetToModel.setConverter(new ColorToRGBConverter());
        usModelToTarget = new UpdateValueStrategy();
        usModelToTarget.setConverter(new RGBToColorConverter());
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, usModelToTarget);
    }
    {
        obsWidget = SWTObservables.observeBackground(defaultRangeBackgroundColor);
        obsModel = BeansObservables.observeValue(realm, defaultConfigClone,
                NodeSensorRangeXMLConfig.PROPERTYNAME_BACKGROUND_R_G_B);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        usTargetToModel.setConverter(new ColorToRGBConverter());
        usModelToTarget = new UpdateValueStrategy();
        usModelToTarget.setConverter(new RGBToColorConverter());
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, usModelToTarget);
    }
    {
        obsWidget = SWTObservables.observeText(defaultBackgroundAlphaTransparency, SWT.Modify);
        obsModel = BeansObservables.observeValue(realm, defaultConfigClone,
                NodeSensorRangeXMLConfig.PROPERTYNAME_BACKGROUND_ALPHA);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        usTargetToModel
                .setAfterConvertValidator(new IntegerRangeValidator("Background Alpha Transparency", 0, 255));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }

    perNodeConfigurationComposite.setDataBinding(dbc, page);

}

From source file:de.uniluebeck.itm.spyglass.plugin.objectpainter.ObjectPainterOptionsComposite.java

License:Open Source License

public void setDatabinding(final DataBindingContext dbc, final ObjectPainterXMLConfig config,
        final Spyglass spyglass, final ObjectPainterPreferencePage page) {

    this.page = page;

    IObservableValue obsModel;//from   w  w w  . j  a  v  a  2s.  c om
    ISWTObservableValue obsWidget;
    UpdateValueStrategy usTargetToModel;

    {
        obsWidget = SWTObservables.observeText(imageFileText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_IMAGE_FILE_NAME);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                .setAfterGetValidator(new FileReadableValidator());
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }

    {
        obsWidget = SWTObservables.observeText(imageSizeWidthText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_IMAGE_SIZE_X);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                .setAfterConvertValidator(new IntegerRangeValidator("Width", 0, Integer.MAX_VALUE));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeText(imageSizeHeightText, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_IMAGE_SIZE_Y);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                .setAfterConvertValidator(new IntegerRangeValidator("Height", 0, Integer.MAX_VALUE));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeSelection(this.drawLineCheckbox);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_DRAW_LINE);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        obsWidget = SWTObservables.observeSelection(keepProportionsButton);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_KEEP_PROPORTIONS);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }
    {
        final MetricsXMLConfig mConf = spyglass.getConfigStore().getSpyglassConfig().getGeneralSettings()
                .getMetrics();
        dbc.bindValue(SWTObservables.observeText(this.label3),
                BeansObservables.observeValue(dbc.getValidationRealm(), mConf, "unit"), null, null);
    }
    {
        final MetricsXMLConfig mConf = spyglass.getConfigStore().getSpyglassConfig().getGeneralSettings()
                .getMetrics();
        dbc.bindValue(SWTObservables.observeText(this.label3a),
                BeansObservables.observeValue(dbc.getValidationRealm(), mConf, "unit"), null, null);
    }
    // TODO:
    {
        final IObservableValue observableColor = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_LINE_COLOR);
        dbc.bindValue(SWTObservables.observeBackground(colorExample), observableColor,
                new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                        .setConverter(new ColorToArrayConverter()),
                new UpdateValueStrategy().setConverter(new ArrayToColorConverter(this.getDisplay())));
    }
    {
        final IObservableValue observable = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_PACKET_TYPE_3D);
        dbc.bindValue(SWTObservables.observeSelection(combo1), observable,
                new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                        .setConverter(new Converter("", true) {

                            @Override
                            public Object convert(final Object fromObject) {
                                return fromObject.equals("TrajectoryPacket3D");
                            }

                        }),
                new UpdateValueStrategy().setConverter(new Converter(true, "") {

                    @Override
                    public Object convert(final Object fromObject) {
                        return ((Boolean) fromObject) ? "TrajectoryPacket3D" : "TrajectoryPacket2D";
                    }
                }));
    }
    {
        obsWidget = SWTObservables.observeText(inteval, SWT.Modify);
        obsModel = BeansObservables.observeValue(dbc.getValidationRealm(), config,
                ObjectPainterXMLConfig.PROPERTYNAME_UPDATE_INTERVAL);
        usTargetToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                .setAfterConvertValidator(new IntegerRangeValidator("Display update interval", 50, 10000));
        dbc.bindValue(obsWidget, obsModel, usTargetToModel, null);
    }

}

From source file:de.uniluebeck.itm.spyglass.plugin.simpleglobalinformation.SimpleGlobalInformationOptionsComposite.java

License:Open Source License

/**
 * Sets the parameters necessary for data binding
 * /* www  . j  av  a 2  s  . c  o  m*/
 * @param dbc
 *            the data binding context
 * @param config
 *            the configuration
 */
public void setDatabinding(final DataBindingContext dbc, final SimpleGlobalInformationXMLConfig config) {

    stringFormatter.setDataBinding(dbc);

    // show the total number of available nodes

    final IObservableValue observableshowNN = BeansObservables.observeValue(dbc.getValidationRealm(), config,
            "showNumNodes");
    dbc.bindValue(SWTObservables.observeSelection(this.showNumNodes), observableshowNN,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT), null);

    // semantic types
    {
        final IObservableValue modelObservable2 = BeansObservables.observeValue(dbc.getValidationRealm(),
                config, "semanticTypes4Neighborhoods");
        final UpdateValueStrategy strFromModel = new UpdateValueStrategy();
        strFromModel.setConverter(new IntListToStringConverter());
        final UpdateValueStrategy strToModel = new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT);
        strToModel.setConverter(new StringToIntListConverter());
        strToModel.setAfterConvertValidator(new IntegerRangeValidator("Semantic types", -1, 255));
        strToModel.setAfterGetValidator(new StringToIntListValidator("Semantic types"));
        dbc.bindValue(SWTObservables.observeText(this.semanticTypes, SWT.Modify), modelObservable2, strToModel,
                strFromModel);
    }

    // show the average node degree
    final IObservableValue observableshowAVGND = BeansObservables.observeValue(dbc.getValidationRealm(), config,
            "showNodeDegree");
    dbc.bindValue(SWTObservables.observeSelection(this.showAVGNodeDegree), observableshowAVGND,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT), null);

    // if the average node degree is not to be shown, disable the semantic types field
    {
        dbc.bindValue(SWTObservables.observeSelection(this.showAVGNodeDegree),
                SWTObservables.observeEnabled(this.semanticTypes), null,
                new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));

        semanticTypes.setEnabled(showAVGNodeDegree.getSelection());
    }

}

From source file:de.uniluebeck.itm.spyglass.plugin.simplenodepainter.OptionsComposite.java

License:Open Source License

/**
 * Sets the parameters necessary for data binding
 * /*from w ww. j  a  v a 2  s .c o  m*/
 * @param dbc
 *            the data binding context
 * @param config
 *            the configuration
 * @param page
 *            the plug-in's preference page
 */
public void setDatabinding(final DataBindingContext dbc, final PluginXMLConfig config,
        final SimpleNodePainterPreferencePage page) {

    this.page = page;

    // line width

    final IObservableValue modelObservable = BeansObservables.observeValue(dbc.getValidationRealm(), config,
            SimpleNodePainterXMLConfig.PROPERTYNAME_LINE_WIDTH);
    dbc.bindValue(SWTObservables.observeText(this.lineWidth, SWT.Modify), modelObservable,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT), null);

    // extended inf

    final IObservableValue observableExtInf = BeansObservables.observeValue(dbc.getValidationRealm(), config,
            SimpleNodePainterXMLConfig.PROPERTYNAME_EXTENDED_DEFAULT_VALUE);
    dbc.bindValue(SWTObservables.observeSelection(this.showExtInf), observableExtInf,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT), null);

    // node indertifier representation

    final IObservableValue observableNodeRepr = BeansObservables.observeValue(dbc.getValidationRealm(), config,
            SimpleNodePainterXMLConfig.PROPERTYNAME_NODE_IDS_AS_HEX);
    dbc.bindValue(SWTObservables.observeSelection(this.nodeIDsAsHex), observableNodeRepr,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT), null);

    // line color

    final IObservableValue observableColor = BeansObservables.observeValue(dbc.getValidationRealm(), config,
            SimpleNodePainterXMLConfig.PROPERTYNAME_LINE_COLOR_R_G_B);
    dbc.bindValue(SWTObservables.observeBackground(colorExample), observableColor,
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_CONVERT)
                    .setConverter(new ColorToArrayConverter()),
            new UpdateValueStrategy().setConverter(new ArrayToColorConverter(this.getDisplay())));

    stringFormatter.setDataBinding(dbc, config);

}

From source file:de.walware.docmlet.tex.internal.ui.preferences.TexEditorPreferencePage.java

License:Open Source License

@Override
protected void addBindings(final DataBindingSupport db) {
    db.getContext().bindValue(SWTObservables.observeSelection(fSmartInsertControl),
            createObservable(TexEditorOptions.SMARTINSERT_BYDEFAULT_ENABLED_PREF));
    db.getContext().bindValue(ViewersObservables.observeSingleSelection(fSmartInsertTabActionControl),
            createObservable(TexEditorOptions.SMARTINSERT_TAB_ACTION_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(fSmartInsertCloseBracketsControl),
            createObservable(TexEditorOptions.SMARTINSERT_CLOSEBRACKETS_ENABLED_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(fSmartInsertCloseParenthesisControl),
            createObservable(TexEditorOptions.SMARTINSERT_CLOSEPARENTHESIS_ENABLED_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(fSmartInsertCloseMathDollarControl),
            createObservable(TexEditorOptions.SMARTINSERT_CLOSEMATHDOLLAR_ENABLED_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(fSmartInsertHardWrapTextControl),
            createObservable(TexEditorOptions.SMARTINSERT_HARDWRAP_TEXT_ENABLED_PREF));

    db.getContext().bindValue(SWTObservables.observeSelection(fFoldingEnableControl),
            createObservable(TexEditorOptions.FOLDING_ENABLED_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(fFoldingRestoreStateControl),
            createObservable(TexEditorOptions.FOLDING_RESTORE_STATE_ENABLED_PREF));

    db.getContext().bindValue(SWTObservables.observeSelection(fMarkOccurrencesControl),
            createObservable(TexEditorOptions.MARKOCCURRENCES_ENABLED_PREF));

    db.getContext().bindValue(SWTObservables.observeSelection(fProblemsEnableControl),
            createObservable(LtxEditorBuild.PROBLEMCHECKING_ENABLED_PREF));
}

From source file:de.walware.eutils.yaml.internal.ui.config.YamlEditorPreferencePage.java

License:Open Source License

@Override
protected void addBindings(final DataBindingSupport db) {
    db.getContext().bindValue(SWTObservables.observeSelection(this.smartInsertControl),
            createObservable(YamlEditingSettings.SMARTINSERT_BYDEFAULT_ENABLED_PREF));
    db.getContext().bindValue(ViewersObservables.observeSingleSelection(this.smartInsertTabActionControl),
            createObservable(YamlEditingSettings.SMARTINSERT_TAB_ACTION_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(this.smartInsertCloseBracketsControl),
            createObservable(YamlEditingSettings.SMARTINSERT_CLOSEBRACKETS_ENABLED_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(this.smartInsertCloseQuotesControl),
            createObservable(YamlEditingSettings.SMARTINSERT_CLOSEQUOTES_ENABLED_PREF));

    db.getContext().bindValue(SWTObservables.observeSelection(this.foldingEnableControl),
            createObservable(YamlEditingSettings.FOLDING_ENABLED_PREF));
    db.getContext().bindValue(SWTObservables.observeSelection(this.foldingRestoreStateControl),
            createObservable(YamlEditingSettings.FOLDING_RESTORE_STATE_ENABLED_PREF));

    db.getContext().bindValue(SWTObservables.observeSelection(this.markOccurrencesControl),
            createObservable(YamlEditingSettings.MARKOCCURRENCES_ENABLED_PREF));

    db.getContext().bindValue(SWTObservables.observeSelection(this.problemsEnableControl),
            createObservable(YamlEditorBuild.PROBLEMCHECKING_ENABLED_PREF));
}

From source file:de.walware.statet.base.internal.ui.preferences.EditorsPreferencePage.java

License:Open Source License

@Override
protected void addBindings(final DataBindingSupport db) {
    db.getContext().bindValue(SWTObservables.observeSelection(fCodeAssistAutoSingleControl),
            createObservable(fCodeAssistAutoSinglePref), null, null);
    db.getContext().bindValue(SWTObservables.observeSelection(fCodeAssistAutoCommonControl),
            createObservable(fCodeAssistAutoCommonPref), null, null);
}