本文整理汇总了Java中org.eclipse.jface.databinding.viewers.ViewersObservables类的典型用法代码示例。如果您正苦于以下问题:Java ViewersObservables类的具体用法?Java ViewersObservables怎么用?Java ViewersObservables使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewersObservables类属于org.eclipse.jface.databinding.viewers包,在下文中一共展示了ViewersObservables类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@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(ViewersObservables.observeMultiSelection(projectListViewer),
PojoProperties.list(N4MFProjectInfo.class, N4MFProjectInfo.TESTED_PROJECT_PROP_NAME)
.observe(projectInfo));
setControl(listComposite);
}
示例2: bindAlgoParamValues
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
private void bindAlgoParamValues() {
DataBindingContext ctx = new DataBindingContext();
IObservableSet modelSet = BeansObservables.observeSet(
Realm.getDefault(), selectedAlgorithm, "algorithms");
// ViewerSupport.bind(checkboxTableViewer, modelSet,
// BeanProperties.value(Algorithm.class, "name"));
IObservableSet widgetSet = ViewersObservables.observeCheckedElements(
algorithmTableViewer, Algorithm.class);
// modelSet = BeansObservables.obser(Realm.getDefault(),
// selectedAlgorithm, "algorithms");
ctx.bindSet(widgetSet, modelSet);
// .observe(key);
// ctx.bindSet(widgetSet, modelSet);
// IObservableValue modelValue = BeanProperties.value(
// AlgorithmParameter.class, btnBindding.get(key)).observe(
// algoPara);
}
示例3: createIntervalCombo
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
private void createIntervalCombo() {
final ComboViewer intervalComboViewer = new ComboViewer(this, SWT.NONE);
intervalComboViewer.setContentProvider(ArrayContentProvider.getInstance());
intervalComboViewer.setInput(TimeRange.values());
final IViewerObservableValue intervalComboViewerObservable = ViewersObservables.observeSingleSelection(intervalComboViewer);
DataBindings.createBinding(intervalComboViewerObservable, viewModel.getVisibleRange(), VisibleRangeViewModel.PROPERTY__RANGE);
}
示例4: bindValue
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
/**
* 对下拉列表和转换器列表进行绑定
* @param context
* @param comboViewer
* @param model
* ;
*/
public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null);
context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE));
}
示例5: initDataBindings
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
private void initDataBindings() {
DataBindingContext ctx = new DataBindingContext();
IObservableValue widgetValue = ViewersObservables.observeSingleSelection(srcLangComboViewer);
IObservableValue modelValue = BeanProperties.value(ProjectInfoBean.class, "sourceLang").observe(projCfgBean);
ctx.bindValue(widgetValue, modelValue, null, null);
}
示例6: bindValue
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
public static void bindValue(DataBindingContext context,ComboViewer comboViewer,
ConverterViewModel model) {
// ViewerSupport.bind(comboViewer, BeansObservables.observeList(
// model, "supportTypes", String.class),
// Properties.selfValue(String.class));
//
//
// context.bindValue(ViewersObservables
// .observeSingleSelection(comboViewer), BeansObservables
// .observeValue(model,
// "selectedType"));
// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider();
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setComparator(new ViewerComparator());
// IObservableMap[] attributeMaps = BeansObservables.observeMaps(
// viewerContentProvider.getKnownElements(),
// ConverterBean.class, new String[] { "description" });
// comboViewer.setLabelProvider(new ObservableMapLabelProvider(
// attributeMaps));
// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class));
comboViewer.setInput(model.getSupportTypes());
IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer);
IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class);
context.bindValue(observableValue, BeansObservables
.observeValue(model,
"selectedType"));
}
示例7: bindMetricParamValues
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
private void bindMetricParamValues() {
DataBindingContext ctx = new DataBindingContext();
IObservableSet modelSet = BeansObservables.observeSet(
Realm.getDefault(), selectedMetric, "metrics");
IObservableSet widgetSet = ViewersObservables.observeCheckedElements(
metricTableViewer, Metric.class);
ctx.bindSet(widgetSet, modelSet);
}
示例8: initDataBinding
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
private void initDataBinding(){
transientConditionValue = new WritableValue();
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue targetObservable =
ViewersObservables.observeSingleSelection(statusViewer);
IObservableValue modelObservable = PojoObservables
.observeDetailValue(transientConditionValue, "status", TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(startTxt, SWT.Modify);
modelObservable = PojoObservables.observeDetailValue(transientConditionValue, "start",
TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(endTxt, SWT.Modify);
modelObservable = PojoObservables.observeDetailValue(transientConditionValue, "end",
TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(textTxt, SWT.Modify);
modelObservable =
PojoObservables.observeDetailValue(transientConditionValue, "text",
TransientCondition.class);
bindingContext.bindValue(targetObservable, modelObservable);
setCondition(null);
}
示例9: initApiViewerBinding
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void initApiViewerBinding(DataBindingContext dbc, ListViewer apiViewer) {
dbc.bindList(
ViewersObservables.observeMultiSelection(apiViewer),
PojoProperties.list(N4MFProjectInfo.class, IMPLEMENTED_PROJECTS_PROP_NAME).observe(projectInfo));
}
示例10: createDataModel
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
protected void createDataModel ( final TreeViewer viewer )
{
final DataBindingContext dbc = new DataBindingContext ();
final IObservableFactory listFactory = new IObservableFactory () {
@Override
public IObservable createObservable ( final Object target )
{
if ( target instanceof IObservableList )
{
return (IObservableList)target;
}
else if ( target instanceof World )
{
return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.WORLD__NODES );
}
else if ( target instanceof SystemNode )
{
return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.SYSTEM_NODE__DRIVERS );
}
return null;
}
};
final AdapterFactory adapterFactory = new InfrastructureItemProviderAdapterFactory ();
final AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider ( adapterFactory );
final ObservableListTreeContentProvider cp = new ObservableListTreeContentProvider ( listFactory, null );
viewer.setContentProvider ( cp );
viewer.setLabelProvider ( labelProvider );
viewer.setInput ( EMFObservables.observeList ( this.world, InfrastructurePackage.Literals.WORLD__NODES ) );
dbc.bindValue ( ViewersObservables.observeSingleSelection ( viewer ), this.driverValue );
this.driverValue.addValueChangeListener ( new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
update ();
}
} );
viewer.getControl ().addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
dbc.dispose ();
}
} );
}
示例11: loadSelectConfigWidget
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
private void loadSelectConfigWidget(BTSConfigItem itemConfig2,
BTSPassportEntry entry) {
Label label = new Label(this, SWT.NONE);
label.setText(getLabel(itemConfig));
label.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER / 2, 1));
((GridData) label.getLayoutData()).verticalIndent = 2;
// label.pack();
combo = new Combo(this, SWT.NONE | SWT.READ_ONLY); // SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER / 2, 1));
((GridData) combo.getLayoutData()).horizontalIndent = 7;
if (itemConfig2.getDescription() != null
&& !itemConfig2.getDescription().getLanguages().isEmpty()) {
final ControlDecoration deco = new ControlDecoration(combo,
SWT.BOTTOM | SWT.LEFT);
// re-use an existing image
Image image = FieldDecorationRegistry
.getDefault()
.getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION)
.getImage();
// set description and image
deco.setDescriptionText(itemConfig2.getDescription()
.getTranslation(lang));
deco.setImage(image);
}
ComboViewer selectComboViewer = new ComboViewer(combo);
ComposedAdapterFactory factory = new ComposedAdapterFactory(
ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider(
factory);
AdapterFactoryContentProvider contentProvider = new AdapterFactoryContentProvider(
factory);
selectComboViewer.setContentProvider(contentProvider);
selectComboViewer.setLabelProvider(labelProvider);
selectComboViewer.setInput(passportConfigurationController
.getPathConfigItemProcessedClones(itemConfig2, corpusObject));
DataBindingContext bindingContext = new DataBindingContext();
EMFUpdateValueStrategy targetToModel = new EMFUpdateValueStrategy();
targetToModel.setConverter(new BTSConfigItemToStringConverter());
if (itemConfig.getPassportEditorConfig().isRequired()) {
targetToModel.setBeforeSetValidator(new StringNotEmptyValidator());
}
EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy();
modelToTarget.setConverter(new BTSStringToConfigItemConverter(
selectComboViewer));
IObservableValue target_type_viewer = ViewersObservables
.observeSingleSelection(selectComboViewer);
Binding binding = bindingContext.bindValue(
target_type_viewer,
EMFEditProperties.value(editingDomain,
BtsCorpusModelPackage.Literals.BTS_PASSPORT_ENTRY__VALUE)
.observe(entry), targetToModel, modelToTarget);
if (itemConfig.getPassportEditorConfig().isRequired()) {
bindingContext.addValidationStatusProvider(binding);
BackgroundControlDecorationSupport.create(binding, SWT.TOP
| SWT.LEFT);
}
//remove focus after selection to avoid mousewheel errors
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getParent().setFocus();
}
});
}
示例12: init
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
protected void init() {
prefs = ConfigurationScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
IEclipsePreferences defaultpref = DefaultScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
default_visibility = prefs.get(BTSCorpusConstants.PREF_LEMMA_DEFAULT_VISIBILITY, null);
default_reviewState = prefs.get(BTSCorpusConstants.PREF_LEMMA_DEFAULT_REVIEWSTATE, null);
object = BtsCorpusModelFactory.eINSTANCE.createBTSTCObject();
object.setVisibility(default_visibility);
object.setRevisionState(default_reviewState);
DataBindingContext bindingContext = new DataBindingContext();
// visibility
EMFUpdateValueStrategy targetToModel_vis = new EMFUpdateValueStrategy();
targetToModel_vis.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_vis = new EMFUpdateValueStrategy();
modelToTarget_vis.setConverter(new BTSStringToConfigItemConverter(
visibility_viewer));
IObservableValue target_vis_viewer = ViewersObservables
.observeSingleSelection(visibility_viewer);
Binding binding_vis = bindingContext
.bindValue(
target_vis_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__VISIBILITY)
.observe(object), targetToModel_vis,
modelToTarget_vis);
// review status
EMFUpdateValueStrategy targetToModel_rev = new EMFUpdateValueStrategy();
targetToModel_rev.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_rev = new EMFUpdateValueStrategy();
modelToTarget_rev.setConverter(new BTSStringToConfigItemConverter(
reviewState_viewer));
IObservableValue target_rev_viewer = ViewersObservables
.observeSingleSelection(reviewState_viewer);
Binding binding_rev = bindingContext
.bindValue(
target_rev_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__REVISION_STATE)
.observe(object), targetToModel_rev,
modelToTarget_rev);
super.initialize();
}
示例13: init
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
protected void init() {
prefs = ConfigurationScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
IEclipsePreferences defaultpref = DefaultScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
default_visibility = prefs.get(BTSCorpusConstants.PREF_ATEXT_DEFAULT_VISIBILITY, null);
default_reviewState = prefs.get(BTSCorpusConstants.PREF_ATEXT_DEFAULT_REVIEWSTATE, null);
object = BtsCorpusModelFactory.eINSTANCE.createBTSTCObject();
object.setVisibility(default_visibility);
object.setRevisionState(default_reviewState);
DataBindingContext bindingContext = new DataBindingContext();
// visibility
EMFUpdateValueStrategy targetToModel_vis = new EMFUpdateValueStrategy();
targetToModel_vis.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_vis = new EMFUpdateValueStrategy();
modelToTarget_vis.setConverter(new BTSStringToConfigItemConverter(
visibility_viewer));
IObservableValue target_vis_viewer = ViewersObservables
.observeSingleSelection(visibility_viewer);
Binding binding_vis = bindingContext
.bindValue(
target_vis_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__VISIBILITY)
.observe(object), targetToModel_vis,
modelToTarget_vis);
// review status
EMFUpdateValueStrategy targetToModel_rev = new EMFUpdateValueStrategy();
targetToModel_rev.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_rev = new EMFUpdateValueStrategy();
modelToTarget_rev.setConverter(new BTSStringToConfigItemConverter(
reviewState_viewer));
IObservableValue target_rev_viewer = ViewersObservables
.observeSingleSelection(reviewState_viewer);
Binding binding_rev = bindingContext
.bindValue(
target_rev_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__REVISION_STATE)
.observe(object), targetToModel_rev,
modelToTarget_rev);
super.initialize();
}
示例14: init
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
protected void init() {
prefs = ConfigurationScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
IEclipsePreferences defaultpref = DefaultScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
default_visibility = prefs.get(BTSCorpusConstants.PREF_CORPUS_DEFAULT_VISIBILITY, null);
default_reviewState = prefs.get(BTSCorpusConstants.PREF_CORPUS_DEFAULT_REVIEWSTATE, null);
object = BtsCorpusModelFactory.eINSTANCE.createBTSTCObject();
object.setVisibility(default_visibility);
object.setRevisionState(default_reviewState);
DataBindingContext bindingContext = new DataBindingContext();
// visibility
EMFUpdateValueStrategy targetToModel_vis = new EMFUpdateValueStrategy();
targetToModel_vis.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_vis = new EMFUpdateValueStrategy();
modelToTarget_vis.setConverter(new BTSStringToConfigItemConverter(
visibility_viewer));
IObservableValue target_vis_viewer = ViewersObservables
.observeSingleSelection(visibility_viewer);
Binding binding_vis = bindingContext
.bindValue(
target_vis_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__VISIBILITY)
.observe(object), targetToModel_vis,
modelToTarget_vis);
// review status
EMFUpdateValueStrategy targetToModel_rev = new EMFUpdateValueStrategy();
targetToModel_rev.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_rev = new EMFUpdateValueStrategy();
modelToTarget_rev.setConverter(new BTSStringToConfigItemConverter(
reviewState_viewer));
IObservableValue target_rev_viewer = ViewersObservables
.observeSingleSelection(reviewState_viewer);
Binding binding_rev = bindingContext
.bindValue(
target_rev_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__REVISION_STATE)
.observe(object), targetToModel_rev,
modelToTarget_rev);
super.initialize();
}
示例15: init
import org.eclipse.jface.databinding.viewers.ViewersObservables; //导入依赖的package包/类
protected void init() {
prefs = ConfigurationScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
IEclipsePreferences defaultpref = DefaultScope.INSTANCE.getNode("org.bbaw.bts.ui.corpus");
default_visibility = prefs.get(BTSCorpusConstants.PREF_THS_DEFAULT_VISIBILITY, null);
default_reviewState = prefs.get(BTSCorpusConstants.PREF_THS_DEFAULT_REVIEWSTATE, null);
object = BtsCorpusModelFactory.eINSTANCE.createBTSTCObject();
object.setVisibility(default_visibility);
object.setRevisionState(default_reviewState);
DataBindingContext bindingContext = new DataBindingContext();
// visibility
EMFUpdateValueStrategy targetToModel_vis = new EMFUpdateValueStrategy();
targetToModel_vis.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_vis = new EMFUpdateValueStrategy();
modelToTarget_vis.setConverter(new BTSStringToConfigItemConverter(
visibility_viewer));
IObservableValue target_vis_viewer = ViewersObservables
.observeSingleSelection(visibility_viewer);
Binding binding_vis = bindingContext
.bindValue(
target_vis_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__VISIBILITY)
.observe(object), targetToModel_vis,
modelToTarget_vis);
// review status
EMFUpdateValueStrategy targetToModel_rev = new EMFUpdateValueStrategy();
targetToModel_rev.setConverter(new BTSConfigItemToStringConverter());
EMFUpdateValueStrategy modelToTarget_rev = new EMFUpdateValueStrategy();
modelToTarget_rev.setConverter(new BTSStringToConfigItemConverter(
reviewState_viewer));
IObservableValue target_rev_viewer = ViewersObservables
.observeSingleSelection(reviewState_viewer);
Binding binding_rev = bindingContext
.bindValue(
target_rev_viewer,
EMFProperties
.value(BtsmodelPackage.Literals.ADMINISTRATIV_DATA_OBJECT__REVISION_STATE)
.observe(object), targetToModel_rev,
modelToTarget_rev);
super.initialize();
}