Java Code Examples for org.eclipse.core.databinding.DataBindingContext#bindList()
The following examples show how to use
org.eclipse.core.databinding.DataBindingContext#bindList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: N4JSTestedProjectWizardPage.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public void createControl(Composite parent) { Composite listComposite = new Composite(parent, NONE); listComposite.setLayout(new FillLayout()); ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI); projectListViewer.setContentProvider(ArrayContentProvider.getInstance()); projectListViewer.setInput(getNonTestProjects()); // Data binding DataBindingContext databindingContext = new DataBindingContext(); parent.addDisposeListener(e -> databindingContext.dispose()); databindingContext.bindList(ViewerProperties.multipleSelection().observe(projectListViewer), PojoProperties.list(N4JSProjectInfo.class, N4JSProjectInfo.TESTED_PROJECT_PROP_NAME) .observe(projectInfo)); setControl(listComposite); }
Example 2
Source File: IndexEditionControl.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void bindIndexedFieldObservableLists(DataBindingContext ctx, IObservableList<Field> actualsFieldsObservable) { ctx.bindList(indexedFieldsObservable, indexedFieldNameObservable, UpdateStrategyFactory.updateListStrategyFactory() .withConverter(ConverterBuilder.<Field, String> newConverter() .fromType(Field.class) .toType(String.class) .withConvertFunction(Field::getName) .create()) .create(), UpdateStrategyFactory.updateListStrategyFactory() .withConverter(ConverterBuilder.<String, Field> newConverter() .fromType(String.class) .toType(Field.class) .withConvertFunction(fieldName -> actualsFieldsObservable .stream() .filter(aField -> Objects.equals(fieldName, aField.getName())) .findFirst() .orElseThrow(() -> new IllegalArgumentException( String.format("The field %s doesn't exists.", fieldName)))) .create()) .create()); }
Example 3
Source File: MouseControllerImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public MouseControllerImpl ( final ControllerManager controllerManager, final ChartContext chartContext, final MouseController controller ) { this.chartContext = chartContext; final Chart chart = chartContext.getChart (); final DataBindingContext ctx = controllerManager.getContext (); ctx.bindList ( this.selectedXAxis, EMFObservables.observeList ( chart, ChartPackage.Literals.CHART__SELECTED_XAXIS ), null, new UpdateListStrategy ().setConverter ( new AxisConverter<> ( XAxis.class, org.eclipse.scada.chart.XAxis.class, chartContext.getxAxisLocator () ) ) ); ctx.bindList ( this.selectedYAxis, EMFObservables.observeList ( chart, ChartPackage.Literals.CHART__SELECTED_YAXIS ), null, new UpdateListStrategy ().setConverter ( new AxisConverter<> ( YAxis.class, org.eclipse.scada.chart.YAxis.class, chartContext.getyAxisLocator () ) ) ); this.mouseTransformer = new MouseTransformer ( this.chartContext.getChartRenderer (), this.selectedXAxis, this.selectedYAxis ); this.mouseDragZoomer = new MouseDragZoomer ( this.chartContext.getChartRenderer (), this.selectedXAxis, this.selectedYAxis ); this.mouseWheelZoomer = new MouseWheelZoomer ( this.chartContext.getChartRenderer (), this.selectedXAxis, this.selectedYAxis ); }
Example 4
Source File: ConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the format dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$ // final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType"); // dbc.bindValue(SWTObservables.observeSelection(formatCombo), format); // bind the source encoding dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 5
Source File: ReverseConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the target encoding dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 6
Source File: ConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the format dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$ // final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType"); // dbc.bindValue(SWTObservables.observeSelection(formatCombo), format); // bind the source encoding dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 7
Source File: ReverseConversionWizardPage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the target encoding dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 8
Source File: ConversionWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the format dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$ // final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType"); // dbc.bindValue(SWTObservables.observeSelection(formatCombo), format); // bind the source encoding dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 9
Source File: ReverseConversionWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the target encoding dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 10
Source File: ConversionWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the format dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$ // final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType"); // dbc.bindValue(SWTObservables.observeSelection(formatCombo), format); // bind the source encoding dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 11
Source File: ReverseConversionWizardPage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 对 UI 和 View Model 进行绑定 ; */ private void bindValue() { DataBindingContext dbc = new DataBindingContext(); WizardPageSupport.create(this, dbc); ConversionConfigBean configBean = conversionConfigBeans.get(0); // bind the target encoding dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ }
Example 12
Source File: CategorySelectionDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { final Composite mainComposite = new Composite(parent, SWT.NONE) ; mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).create()) ; mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10,10).create()) ; context = new DataBindingContext() ; categoryViewer = new TreeViewer(mainComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION) ; categoryViewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; categoryViewer.setContentProvider(new DefinitionCategoryContentProvider()) ; categoryViewer.setLabelProvider(new ConnectorDefinitionTreeLabelProvider(messageProvider)) ; categoryViewer.setInput(getAllCategories()) ; final IViewerObservableList observeSelection = ViewerProperties.multipleSelection().observe(categoryViewer); MultiValidator validator = new MultiValidator() { @Override protected IStatus validate() { if(observeSelection.isEmpty()){ return ValidationStatus.error(""); } return ValidationStatus.ok(); } }; context.addValidationStatusProvider(validator); context.bindList(observeSelection, validator.observeValidatedList(PojoProperties.list("categories").observe(this)), null,new UpdateListStrategy()) ; DialogSupport.create(this,context); return mainComposite ; }
Example 13
Source File: OpenApplicationPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) { Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); mainComposite.setLayout(GridLayoutFactory.fillDefaults().create()); TableViewer applicationsTableViewer = new TableViewer(mainComposite); applicationsTableViewer.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, true).hint(TABLE_WIDTH_HINT, SWT.DEFAULT).create()); applicationsTableViewer.setContentProvider(ArrayContentProvider.getInstance()); applicationsTableViewer.setLabelProvider(new ApplicationFileStoreLabelProvider()); applicationsTableViewer .setInput(repositoryAccessor.getRepositoryStore(ApplicationRepositoryStore.class).getChildren()); ColumnViewerToolTipSupport.enableFor(applicationsTableViewer); ctx.bindList(ViewersObservables.observeMultiSelection(applicationsTableViewer), applicationFileStoreObservable); ctx.addValidationStatusProvider(new org.eclipse.core.databinding.validation.MultiValidator() { @Override protected IStatus validate() { return applicationFileStoreObservable.isEmpty() ? ValidationStatus.error("No selection") : ValidationStatus.ok(); } }); return mainComposite; }
Example 14
Source File: AbstractManageDiagramWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected Composite doCreateControl(final Composite parent, final DataBindingContext context) { final Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayout(fillDefaults().numColumns(2).equalWidth(true).create()); diagramTree = new FilteredTree(mainComposite, SWT.MULTI | SWT.BORDER, new PatternFilter(), false); final TreeViewer treeViewer = diagramTree.getViewer(); treeViewer.getTree().setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_OPEN_DIAGRAM_TREE_ID); diagramTree .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).hint(SWT.DEFAULT, 250).create()); treeViewer.setContentProvider( new ObservableListTreeContentProvider(diagramListObservableFactory(), diagramTreeStructure())); treeViewer.setLabelProvider(new DiagramLabelProvider(new FileStoreLabelProvider())); final IObservableList selectionObservable = PojoObservables.observeList(this, "selectedDiagrams"); context.bindList(ViewersObservables.observeMultiSelection(diagramTree.getViewer()), selectionObservable); context.addValidationStatusProvider(new MultiValidator() { @Override protected IStatus validate() { return selectionObservable.isEmpty() ? ValidationStatus.error(Messages.noDiagramSelected) : ValidationStatus.ok(); } }); treeViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(final DoubleClickEvent arg0) { final IWizard wizard = getWizard(); if (wizard.canFinish() && wizard.performFinish() && wizard.getContainer() instanceof WizardDialog) { ((WizardDialog) wizard.getContainer()).close(); } } }); treeViewer.setInput(diagramRepositoryStore); treeViewer.getTree().setFocus(); defaultSelection(selectionObservable); return mainComposite; }
Example 15
Source File: N4JSNewProjectWizardCreationPage.java From n4js with Eclipse Public License 1.0 | 4 votes |
private void initApiViewerBinding(DataBindingContext dbc, ListViewer apiViewer) { dbc.bindList( ViewerProperties.multipleSelection().observe(apiViewer), PojoProperties.list(N4JSProjectInfo.class, IMPLEMENTED_PROJECTS_PROP_NAME).observe(projectInfo)); }