Example usage for org.eclipse.jface.databinding.viewers ViewerProperties singleSelection

List of usage examples for org.eclipse.jface.databinding.viewers ViewerProperties singleSelection

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.viewers ViewerProperties singleSelection.

Prototype

public static IViewerValueProperty singleSelection() 

Source Link

Document

Returns a value property for observing the single selection of a ISelectionProvider .

Usage

From source file:org.kalypso.ui.editor.styleeditor.placement.LinePlacementComposite.java

License:Open Source License

private void createPlacementControl(final Composite parent) {
    final FormToolkit toolkit = getToolkit();

    toolkit.createLabel(parent, Messages.getString("LinePlacementComposite_0")); //$NON-NLS-1$

    final ComboViewer typeViewer = new ComboViewer(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    typeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final LinePlacementControlValue handler = new LinePlacementControlValue(m_input);
    handler.configureViewer(typeViewer);

    final IViewerObservableValue target = ViewerProperties.singleSelection().observe(typeViewer);
    m_binding.bindValue(target, handler);
}

From source file:org.kalypso.ui.editor.styleeditor.stroke.StrokeComposite.java

License:Open Source License

private void createLineJoinControl(final FormToolkit toolkit, final Composite parent) {
    toolkit.createLabel(parent, Messages.getString("StrokeComposite.1")); //$NON-NLS-1$

    final ComboViewer lineJoinChooser = new ComboViewer(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    toolkit.adapt(lineJoinChooser.getControl(), true, true);
    lineJoinChooser.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    final StrokeLineJoinValue model = new StrokeLineJoinValue(m_input);
    model.configureViewer(lineJoinChooser);

    final IObservableValue target = ViewerProperties.singleSelection().observe(lineJoinChooser);
    m_binding.bindValue(target, model);/*from   w w w .  j a  v  a 2  s .  c  o  m*/
}

From source file:org.kalypso.ui.editor.styleeditor.stroke.StrokeComposite.java

License:Open Source License

private void createLineCapControl(final FormToolkit toolkit, final Composite parent) {
    toolkit.createLabel(parent, Messages.getString("StrokeComposite.2")); //$NON-NLS-1$

    final ComboViewer lineCapChooser = new ComboViewer(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
    toolkit.adapt(lineCapChooser.getControl(), true, true);
    lineCapChooser.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));

    final StrokeLineCapValue model = new StrokeLineCapValue(m_input);
    model.configureViewer(lineCapChooser);

    final IObservableValue target = ViewerProperties.singleSelection().observe(lineCapChooser);
    m_binding.bindValue(target, model);/*from w  w w .jav a 2  s .co m*/
}

From source file:org.kalypso.ui.editor.styleeditor.symbolizer.AbstractSymbolizerComposite.java

License:Open Source License

private Control createGeometryControl(final FormToolkit toolkit, final Composite parent) {
    final SectionPart sectionPart = new SectionPart(parent, toolkit,
            ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | Section.DESCRIPTION);
    final Section section = sectionPart.getSection();
    section.setText(Messages.getString("AbstractSymbolizerComposite_0")); //$NON-NLS-1$
    section.setDescription(Messages.getString("AbstractSymbolizerComposite_1")); //$NON-NLS-1$

    final ComboViewer geometryChooser = new ComboViewer(section, SWT.DROP_DOWN | SWT.READ_ONLY);
    section.setClient(geometryChooser.getControl());

    final GeometryValue<S> geometryHandler = new GeometryValue<>(m_input);
    geometryHandler.configureViewer(geometryChooser);

    final IViewerObservableValue target = ViewerProperties.singleSelection().observe(geometryChooser);
    m_binding.bindValue(target, geometryHandler);

    return section;
}

From source file:org.kalypso.ui.rrm.internal.results.view.tree.filter.ResultParameterTypeFilterControl.java

License:Open Source License

private void createParameterTypeCombo(final Composite parent) {
    m_viewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.SINGLE);
    m_viewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    m_viewer.setLabelProvider(new LabelProvider());
    m_viewer.setContentProvider(new ArrayContentProvider());
    m_viewer.setInput(m_parameterTypes.toArray());

    final IViewerObservableValue targetValue = ViewerProperties.singleSelection().observe(m_viewer);
    final IObservableValue modelValue = PojoObservables.observeValue(m_filter,
            ResultParameterTypeFilter.PROPERTY_TYPE);

    m_binding.bindValue(targetValue, modelValue);

    m_viewer.setSelection(new StructuredSelection(StringUtils.EMPTY));
}

From source file:org.kalypso.ui.rrm.internal.timeseries.view.filter.TimeseriesBrowserParameterTypeFilterControl.java

License:Open Source License

private void createParameterTypeCombo(final Composite parent) {
    m_viewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.SINGLE);
    m_viewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    m_viewer.setLabelProvider(new ParameterTypeLabelProvider() {
        @Override/*from ww w  . j a  va  2  s  .c  om*/
        public String getText(final Object element) {
            if (Objects.isNull(element) || StringUtils.isEmpty(element.toString()))
                return Messages.getString("ParameterTypeFilterControl_0"); //$NON-NLS-1$

            return super.getText(element);
        }
    });
    m_viewer.setContentProvider(new ArrayContentProvider());
    m_viewer.setInput(m_parameterTypes.toArray());

    final IViewerObservableValue targetValue = ViewerProperties.singleSelection().observe(m_viewer);
    final IObservableValue modelValue = PojoObservables.observeValue(m_filter,
            TimeseriesBrowserParameterTypeFilter.PROPERTY_TYPE);

    m_binding.bindValue(targetValue, modelValue);
    m_viewer.setSelection(new StructuredSelection(StringUtils.EMPTY));
}

From source file:org.obeonetwork.tools.snapshot.viewer.wizards.ImportXMLSnapshotWizardPage.java

License:Open Source License

protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    ///*from w  ww. j  a v  a  2 s .  c  o m*/
    IObservableValue observeTextTxtXmlFileObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtXmlFile);
    IObservableValue xmlFileInputDataObserveValue = PojoProperties.value("xmlFile").observe(inputData);
    bindingContext.bindValue(observeTextTxtXmlFileObserveWidget, xmlFileInputDataObserveValue, null, null);
    //
    IObservableValue observeTextTxtLocalProjectObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtLocalProject);
    IObservableValue localProjectNameInputDataObserveValue = PojoProperties.value("localProjectName")
            .observe(inputData);
    bindingContext.bindValue(observeTextTxtLocalProjectObserveWidget, localProjectNameInputDataObserveValue,
            null, null);
    //
    IObservableValue observeSingleSelectionComboRemoteProjectViewer = ViewerProperties.singleSelection()
            .observe(comboRemoteProjectViewer);
    IObservableValue remoteProjectURIInputDataObserveValue = PojoProperties.value("remoteProjectURI")
            .observe(inputData);
    UpdateValueStrategy strategy_1 = new UpdateValueStrategy();
    UpdateValueStrategy strategy = new UpdateValueStrategy();
    bindingContext.bindValue(observeSingleSelectionComboRemoteProjectViewer,
            remoteProjectURIInputDataObserveValue, strategy_1, strategy);
    //
    return bindingContext;
}

From source file:org.polarsys.reqcycle.predicates.ui.dialogs.NewPredicateDialog.java

License:Open Source License

protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    ///*ww  w  . java  2s . co m*/
    IObservableValue observeTextTextObserveWidget = WidgetProperties.text(SWT.Modify).observe(text);
    IObservableValue nameBeanObserveValue = PojoProperties.value("name").observe(bean);
    bindingContext.bindValue(observeTextTextObserveWidget, nameBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionComboViewer = ViewerProperties.singleSelection()
            .observe(comboViewer);
    IObservableValue rootPredicateBeanObserveValue = PojoProperties.value("rootPredicate").observe(bean);
    bindingContext.bindValue(observeSingleSelectionComboViewer, rootPredicateBeanObserveValue, null, null);
    //
    return bindingContext;
}

From source file:org.polarsys.reqcycle.repository.connector.document.ui.DocSettingPage.java

License:Open Source License

protected void doSpecificInitDataBindings(DataBindingContext bindingContext) {
    ///*from w  ww. ja va2 s .  c om*/
    IObservableValue observeTextTxtSelectedDocObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtSelectedDoc);
    IObservableValue uriBeanObserveValue = PojoProperties.value("uri").observe(bean);
    bindingContext.bindValue(observeTextTxtSelectedDocObserveWidget, uriBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionCvTypeFile = ViewerProperties.singleSelection().observe(cvTypeFile);
    IObservableValue listTypeBeanObserveValue = PojoProperties.value("fileType").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvTypeFile, listTypeBeanObserveValue, null, null);

}

From source file:org.polarsys.reqcycle.repository.connector.local.ui.dialog.CreateNewSourceComposite.java

License:Open Source License

protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    ////w  ww . j a va  2s .c  om
    IObservableValue observeTextTxtNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtName);
    IObservableValue sourceNameBeanObserveValue = PojoProperties.value("sourceName").observe(bean);
    bindingContext.bindValue(observeTextTxtNameObserveWidget, sourceNameBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionCvDataModel = ViewerProperties.singleSelection()
            .observe(cvDataModel);
    IObservableValue dataModelBeanObserveValue = PojoProperties.value("dataModel").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvDataModel, dataModelBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionCvScope = ViewerProperties.singleSelection().observe(cvScope);
    IObservableValue scopeBeanObserveValue = PojoProperties.value("scope").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvScope, scopeBeanObserveValue, null, null);
    //
    return bindingContext;
}