Search in sources :

Example 1 with IObservableMap

use of org.eclipse.core.databinding.observable.map.IObservableMap in project eclipse-pmd by acanda.

the class AddRuleSetConfigurationWizardPage method initDataBindings.

private DataBindingContext initDataBindings() {
    final DataBindingContext bindingContext = new DataBindingContext();
    // 
    final IObservableValue locationObserveText = SWTObservables.observeDelayedValue(200, SWTObservables.observeText(location, SWT.Modify));
    final IObservableValue locationObserveValue = BeansObservables.observeValue(controller.getModel(), "location");
    bindingContext.bindValue(locationObserveText, locationObserveValue, null, null);
    // 
    final ObservableListContentProvider rulesContentProvider = new ObservableListContentProvider();
    final IObservableMap rulesObserveMap = PojoObservables.observeMap(rulesContentProvider.getKnownElements(), Rule.class, "name");
    tableViewer.setLabelProvider(new ObservableMapLabelProvider(rulesObserveMap));
    tableViewer.setContentProvider(rulesContentProvider);
    // 
    final IObservableList rulesObserveList = BeansObservables.observeList(Realm.getDefault(), controller.getModel(), "rules");
    tableViewer.setInput(rulesObserveList);
    // 
    final IObservableValue nameObserveTextObserveWidget = SWTObservables.observeDelayedValue(100, SWTObservables.observeText(name, SWT.Modify));
    final IObservableValue controllergetModelNameObserveValue = BeansObservables.observeValue(controller.getModel(), "name");
    bindingContext.bindValue(nameObserveTextObserveWidget, controllergetModelNameObserveValue, null, null);
    // 
    final IObservableValue observeVisibleBrowseObserveWidget = WidgetProperties.visible().observe(browse);
    final IObservableValue browseEnabledControllergetModelObserveValue = BeanProperties.value("browseEnabled").observe(controller.getModel());
    bindingContext.bindValue(observeVisibleBrowseObserveWidget, browseEnabledControllergetModelObserveValue, null, null);
    // 
    return bindingContext;
}
Also used : IObservableMap(org.eclipse.core.databinding.observable.map.IObservableMap) ObservableListContentProvider(org.eclipse.jface.databinding.viewers.ObservableListContentProvider) DataBindingContext(org.eclipse.core.databinding.DataBindingContext) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) ObservableMapLabelProvider(org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider) IObservableList(org.eclipse.core.databinding.observable.list.IObservableList)

Aggregations

DataBindingContext (org.eclipse.core.databinding.DataBindingContext)1 IObservableList (org.eclipse.core.databinding.observable.list.IObservableList)1 IObservableMap (org.eclipse.core.databinding.observable.map.IObservableMap)1 IObservableValue (org.eclipse.core.databinding.observable.value.IObservableValue)1 ObservableListContentProvider (org.eclipse.jface.databinding.viewers.ObservableListContentProvider)1 ObservableMapLabelProvider (org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider)1