本文整理汇总了Java中org.eclipse.core.databinding.DataBindingContext.addValidationStatusProvider方法的典型用法代码示例。如果您正苦于以下问题:Java DataBindingContext.addValidationStatusProvider方法的具体用法?Java DataBindingContext.addValidationStatusProvider怎么用?Java DataBindingContext.addValidationStatusProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.databinding.DataBindingContext
的用法示例。
在下文中一共展示了DataBindingContext.addValidationStatusProvider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCustomDataBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private void initCustomDataBindings() {
DataBindingContext bindingContext = new DataBindingContext();
UpdateValueStrategy defaultStrategy = new UpdateValueStrategy();
IObservableValue<String> observedNewName = WidgetProperties.text(SWT.Modify).observe(textNewName);
IObservableValue<String> observedNewAlias = new WritableValue<String>("", String.class);
if (aliasIsAvailable) {
observedNewAlias = WidgetProperties.text(SWT.Modify).observe(textNewAlias);
}
MultiValidator nameAndAliasValidator = new NameAndAliasValidator(observedNewName, observedNewAlias,
elementNameMightBeEmpty);
bindingContext.addValidationStatusProvider(nameAndAliasValidator);
IObservableValue<String> validatedNewName = nameAndAliasValidator.observeValidatedValue(observedNewName);
IObservableValue<String> validatedNewAlias = nameAndAliasValidator.observeValidatedValue(observedNewAlias);
bindingContext.bindValue(validatedNewName, newName, defaultStrategy, defaultStrategy);
bindingContext.bindValue(validatedNewAlias, newAlias, defaultStrategy, defaultStrategy);
aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
aggregatedStatus.addChangeListener(aggregatedStatusListener);
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:RenameUMLElementRefactoringWizardUserPageComposite.java
示例2: initializeDBCollectionBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeDBCollectionBindings(BTSProjectDBCollection dbCollection)
{
EditingDomain editingDomain = getEditingDomain(dbCollection);
if (dbColl_bindingContext != null)
{
dbColl_bindingContext.dispose();
}
DataBindingContext bindingContext = new DataBindingContext();
// db collection name - cannot be changed
IObservableValue model_na = EMFProperties.value(
BtsmodelPackage.Literals.BTS_PROJECT_DB_COLLECTION__COLLECTION_NAME).observe(dbCollection);
bindingContext.bindValue(WidgetProperties.text(SWT.Modify)
.observeDelayed(BTSUIConstants.DELAY, roles_dbColl_name_text),
model_na, null, null);
// sync
IObservableValue model_sy = EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_PROJECT_DB_COLLECTION__SYNCHRONIZED).observe(dbCollection);
Binding binding_sy = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(
BTSUIConstants.DELAY, roles_dbColl_sync_btn), model_sy,
null, null);
bindingContext.addValidationStatusProvider(binding_sy);
// index
IObservableValue model_in = EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_PROJECT_DB_COLLECTION__INDEXED).observe(dbCollection);
Binding binding_in = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(
BTSUIConstants.DELAY, roles_dbColl_index_btn),
model_in, null, null);
bindingContext.addValidationStatusProvider(binding_in);
return bindingContext;
}
示例3: initializeConfigurationEditBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeConfigurationEditBindings(
BTSConfiguration configuration) {
if (configurationEditBindings != null) {
configurationEditBindings.dispose();
}
EditingDomain editingDomain = getEditingDomain(configuration);
DataBindingContext bindingContext = new DataBindingContext();
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
IObservableValue model = EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_NAMED_TYPED_OBJECT__NAME).observe(
configuration);
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, nameText_ConfigurationEdit),
model, us, null);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
bindingContext.addValidationStatusProvider(binding);
IObservableValue model2 = EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIGURATION__PROVIDER).observe(
configuration);
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, providerText), model2, us, null);
bindingContext.addValidationStatusProvider(binding2);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
return bindingContext;
}
示例4: loadBooleanWidget
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private void loadBooleanWidget(BTSConfigItem itemConfig2,
BTSPassportEntry entry) {
checkBox = new Button(this, SWT.CHECK);
checkBox.setText(itemConfig.getValue());
checkBox.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER, 1));
// checkBox.pack();
DataBindingContext bindingContext = new DataBindingContext();
EMFUpdateValueStrategy targetToModel = new EMFUpdateValueStrategy();
targetToModel.setConverter(new BTSBooleanToStringConverter());
if (itemConfig.getPassportEditorConfig().isRequired()) {
targetToModel.setBeforeSetValidator(new StringNotEmptyValidator());
}
EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy();
modelToTarget.setConverter(new BTSStringToBooleanConverter());
Binding binding = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(
BTSUIConstants.DELAY, checkBox),
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);
}
}
示例5: createControl
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayoutFactory.fillDefaults().numColumns(2).spacing(10, LayoutConstants.getSpacing().y).applyTo(composite);
Label label = new Label(composite, SWT.NONE);
label.setText(Messages.COMMONTXT_NAME_WITH_COLON);
nameText = new Text(composite, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(nameText);
nameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
service.setName(nameText.getText());
}
});
bindingContext = new DataBindingContext();
map = new WritableMap();
WizardPageSupport.create(this, bindingContext);
bindingContext.bindValue(SWTObservables.observeText(nameText, SWT.Modify),
Observables.observeMapEntry(map, "name"), //$NON-NLS-1$
new UpdateValueStrategy().setAfterConvertValidator(new StringValidator()), null);
label = new Label(composite, SWT.NONE);
label.setText(Messages.CloudFoundryServicePlanWizardPage_LABEL_TYPE);
typeCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, false).applyTo(typeCombo);
typeCombo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
int index = typeCombo.getSelectionIndex();
if (index != -1) {
CFServiceOffering configuration = serviceOfferings.get(index);
setCloudService(service, configuration);
}
refreshPlan();
}
});
bindingContext.bindValue(SWTObservables.observeSelection(typeCombo), Observables.observeMapEntry(map, "type"), //$NON-NLS-1$
new UpdateValueStrategy().setAfterConvertValidator(new ComboValidator(Messages.CloudFoundryServicePlanWizardPage_TEXT_SELECT_TYPE)), null);
pageBook = new PageBook(composite, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(pageBook);
planGroup = new Group(pageBook, SWT.BORDER);
GridDataFactory.fillDefaults().grab(true, true).applyTo(planGroup);
planGroup.setLayout(new GridLayout());
planGroup.setVisible(false);
planGroup.setText(getPlanLabel());
MultiValidator validator = new MultiValidator() {
protected IStatus validate() {
// access plan value to bind validator
if (planObservable.getValue() == null) {
return ValidationStatus.cancel(getValidationErrorMessage());
}
return ValidationStatus.ok();
}
};
bindingContext.addValidationStatusProvider(validator);
Dialog.applyDialogFont(composite);
setControl(composite);
}
示例6: initializeUserGoupBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeUserGoupBindings(BTSUserGroup group)
{
EditingDomain editingDomain = getEditingDomain(group);
if (user_group_bindingContext != null)
{
user_group_bindingContext.dispose();
}
DataBindingContext bindingContext = new DataBindingContext();
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
// group id
IObservableValue model_id = EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_IDENTIFIABLE_ITEM__ID).observe(group);
Binding binding_id = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, labelId_Group), model_id, us,
null);
bindingContext.addValidationStatusProvider(binding_id);
// name
IObservableValue model = EMFEditProperties.value(editingDomain, BtsmodelPackage.Literals.BTS_NAMED_TYPED_OBJECT__NAME)
.observe(group);
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, textName_Group), model, us, null);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
bindingContext.addValidationStatusProvider(binding);
//type
IObservableValue model2 = EMFEditProperties.value(editingDomain, BtsmodelPackage.Literals.BTS_NAMED_TYPED_OBJECT__TYPE)
.observe(group);
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, textType_Group), model2,
us, null);
bindingContext.addValidationStatusProvider(binding2);
// comment
IObservableValue model3 = EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_USER_GROUP__COMMENT).observe(group);
Binding binding3 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, textComment_Group), model3, us,
null);
bindingContext.addValidationStatusProvider(binding3);
return bindingContext;
}
示例7: initializeRelationEditBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeRelationEditBindings(
BTSConfigItem configItem) {
if (configItemEditBindings != null) {
configItemEditBindings.dispose();
}
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
DataBindingContext bindingContext = new DataBindingContext();
EditingDomain editingDomain = getEditingDomain(configItem);
labelText_CIEdit.load(configItem.getLabel(), editingDomain, true);
descText_CIEdit.load(configItem.getDescription(), editingDomain, false);
// value
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, valueText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__VALUE)
.observe(configItem), us, null);
bindingContext.addValidationStatusProvider(binding);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
// type
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, typeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__TYPE)
.observe(configItem), us, null);
// subtype
Binding binding3 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, subtypeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SUBTYPE)
.observe(configItem), us, null);
// sortkey
Binding binding4 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(400,
sortSpinner_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SORT_KEY)
.observe(configItem), null, null);
// ignore
Binding binding5 = bindingContext.bindValue(
WidgetProperties.selection()
.observeDelayed(0, ignoreBTN_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__IGNORE)
.observe(configItem), null, null);
// owner types
return bindingContext;
}
示例8: initializePassportEditBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializePassportEditBindings(
BTSConfigItem configItem) {
if (configItemEditBindings != null) {
configItemEditBindings.dispose();
}
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
DataBindingContext bindingContext = new DataBindingContext();
EditingDomain editingDomain = getEditingDomain(configItem);
labelText_CIEdit.load(configItem.getLabel(), editingDomain, true);
descText_CIEdit.load(configItem.getDescription(), editingDomain, false);
// value
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, valueText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__VALUE)
.observe(configItem), us, null);
// type
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, typeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__TYPE)
.observe(configItem), us, null);
// subtype
Binding binding3 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, subtypeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SUBTYPE)
.observe(configItem), us, null);
bindingContext.addValidationStatusProvider(binding);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
return bindingContext;
}
示例9: initializeConfigItemEditBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeConfigItemEditBindings(
BTSConfigItem configItem) {
if (configItemEditBindings != null) {
configItemEditBindings.dispose();
}
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
DataBindingContext bindingContext = new DataBindingContext();
EditingDomain editingDomain = getEditingDomain(configItem);
labelText_CIEdit.load(configItem.getLabel(), editingDomain, true);
descText_CIEdit.load(configItem.getDescription(), editingDomain, false);
// value
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, valueText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__VALUE)
.observe(configItem), us, null);
// type
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, typeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__TYPE)
.observe(configItem), us, null);
// subtype
Binding binding3 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, subtypeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SUBTYPE)
.observe(configItem), us, null);
// abbreviation
Binding binding_abbr = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, abbrText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__ABBREVIATION)
.observe(configItem), null, null);
// sortkey
Binding binding4 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(400,
sortSpinner_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SORT_KEY)
.observe(configItem), null, null);
// ignore
Binding binding5 = bindingContext.bindValue(WidgetProperties
.selection().observeDelayed(0, ignoreBTN_CIEdit), EMFProperties
.value(BtsmodelPackage.Literals.BTS_CONFIG_ITEM__IGNORE)
.observe(configItem), null, null);
bindingContext.addValidationStatusProvider(binding);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
return bindingContext;
}
示例10: initializePassportEntryGroupEditBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializePassportEntryGroupEditBindings(
BTSConfigItem configItem) {
if (configItemEditBindings != null) {
configItemEditBindings.dispose();
}
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
if (configItem.getPassportEditorConfig() == null) {
configItem.setPassportEditorConfig(BtsmodelFactory.eINSTANCE
.createBTSPassportEditorConfig());
}
DataBindingContext bindingContext = new DataBindingContext();
EditingDomain editingDomain = getEditingDomain(configItem);
labelText_CIEdit.load(configItem.getLabel(), editingDomain, true);
descText_CIEdit.load(configItem.getDescription(), editingDomain, false);
// value
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, valueText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__VALUE)
.observe(configItem), us, null);
// type
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, typeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__TYPE)
.observe(configItem), us, null);
// subtype
Binding binding3 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, subtypeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SUBTYPE)
.observe(configItem), us, null);
// sortkey
Binding binding4 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(400,
sortSpinner_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SORT_KEY)
.observe(configItem), null, null);
// ignore
Binding binding5 = bindingContext.bindValue(WidgetProperties
.selection().observeDelayed(0, ignoreBTN_CIEdit), EMFProperties
.value(BtsmodelPackage.Literals.BTS_CONFIG_ITEM__IGNORE)
.observe(configItem), null, null);
bindingContext.addValidationStatusProvider(binding);
// allow multiple
FeaturePath feature2 = FeaturePath
.fromList(
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__PASSPORT_EDITOR_CONFIG,
BtsmodelPackage.Literals.BTS_PASSPORT_EDITOR_CONFIG__ALLOW_MULTIPLE);
Binding binding7 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(0,
allowMultiBTN_CIEdit),
EMFEditProperties.value(editingDomain, feature2).observe(
configItem), null, null);
// h width
FeaturePath feature4 = FeaturePath
.fromList(
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__PASSPORT_EDITOR_CONFIG,
BtsmodelPackage.Literals.BTS_PASSPORT_EDITOR_CONFIG__HORIZONTAL_WIDTH);
Binding binding9 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(0,
hSpanSpinner_GroupIEdit),
EMFEditProperties.value(editingDomain, feature4).observe(
configItem), null, null);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
return bindingContext;
}
示例11: initializePassportCategoriesEditBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializePassportCategoriesEditBindings(
BTSConfigItem configItem) {
if (configItemEditBindings != null) {
configItemEditBindings.dispose();
}
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new StringNotEmptyValidator());
DataBindingContext bindingContext = new DataBindingContext();
EditingDomain editingDomain = getEditingDomain(configItem);
labelText_CIEdit.load(configItem.getLabel(), editingDomain, true);
descText_CIEdit.load(configItem.getDescription(), editingDomain, false);
// value
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, valueText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__VALUE)
.observe(configItem), us, null);
// type
Binding binding2 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, typeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__TYPE)
.observe(configItem), us, null);
// subtype
Binding binding3 = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(
BTSUIConstants.DELAY, subtypeText_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SUBTYPE)
.observe(configItem), us, null);
// sortkey
Binding binding4 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(400,
sortSpinner_CIEdit),
EMFEditProperties.value(editingDomain,
BtsmodelPackage.Literals.BTS_CONFIG_ITEM__SORT_KEY)
.observe(configItem), null, null);
// ignore
Binding binding5 = bindingContext.bindValue(WidgetProperties
.selection().observeDelayed(0, ignoreBTN_CIEdit), EMFProperties
.value(BtsmodelPackage.Literals.BTS_CONFIG_ITEM__IGNORE)
.observe(configItem), null, null);
bindingContext.addValidationStatusProvider(binding);
BackgroundControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
return bindingContext;
}
示例12: initializeBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeBindings()
{
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
us.setBeforeSetValidator(new IValidator()
{
@Override
public IStatus validate(Object value)
{
if (value instanceof String)
{
if (value.toString().trim().length() > 0)
{
return ValidationStatus.ok();
}
}
return ValidationStatus.error("Content must be at least one character");
}
});
DataBindingContext bindingContext = new DataBindingContext();
FeaturePath feature = FeaturePath.fromList(BtsmodelPackage.Literals.BTS_PROJECT__DB_CONNECTION,
BtsmodelPackage.Literals.BTSDB_CONNECTION__TYPE);
IObservableValue model = EMFProperties.value(feature).observe(project);
Binding binding = bindingContext.bindValue(
WidgetProperties.text(SWT.Modify).observeDelayed(400, txtConnectiontype), model, null, null);
bindingContext.addValidationStatusProvider(binding);
FeaturePath feature2 = FeaturePath.fromList(BtsmodelPackage.Literals.BTS_PROJECT__DB_CONNECTION,
BtsmodelPackage.Literals.BTSDB_CONNECTION__MASTER_SERVER);
IObservableValue model2 = EMFProperties.value(feature2).observe(project);
Binding binding2 = bindingContext.bindValue(WidgetProperties.text(SWT.Modify).observeDelayed(400, text),
model2, null, null);
bindingContext.addValidationStatusProvider(binding2);
FeaturePath feature3 = FeaturePath.fromList(BtsmodelPackage.Literals.BTS_PROJECT__DB_CONNECTION,
BtsmodelPackage.Literals.BTSDB_CONNECTION__DB_PATH);
IObservableValue model3 = EMFProperties.value(feature3).observe(project);
Binding binding3 = bindingContext.bindValue(WidgetProperties.text(SWT.Modify).observeDelayed(400, textdbPath),
model3, null, null);
bindingContext.addValidationStatusProvider(binding3);
return bindingContext;
}
示例13: initializeBindings
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private DataBindingContext initializeBindings()
{
EMFUpdateValueStrategy us = new EMFUpdateValueStrategy();
context = StaticAccessController.getContext();
sync = context.get(UISynchronize.class);
editingDomainController = context.get(EditingDomainController.class);
permisionsController = context.get(PermissionsAndExpressionsEvaluationController.class);
us.setBeforeSetValidator(new IValidator()
{
@Override
public IStatus validate(Object value)
{
if (value instanceof String)
{
if (value.toString().trim().length() > 0)
{
return ValidationStatus.ok();
}
}
return ValidationStatus.error("Content must be at least one character");
}
});
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue model = EMFProperties.value(
BtsmodelPackage.Literals.BTS_PROJECT_DB_COLLECTION__COLLECTION_NAME).observe(collection);
Binding binding = bindingContext.bindValue(WidgetProperties.text(SWT.Modify).observeDelayed(400, text), model,
us, null);
bindingContext.addValidationStatusProvider(binding);
ControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
IObservableValue model2 = EMFProperties.value(BtsmodelPackage.Literals.BTS_PROJECT_DB_COLLECTION__SYNCHRONIZED)
.observe(collection);
Binding binding2 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(0, btnSyncronizeCollection), model2, null, null);
bindingContext.addValidationStatusProvider(binding2);
ControlDecorationSupport.create(binding2, SWT.TOP | SWT.LEFT);
IObservableValue model3 = EMFProperties.value(BtsmodelPackage.Literals.BTS_PROJECT_DB_COLLECTION__INDEXED)
.observe(collection);
Binding binding3 = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(0, btnIndexCollectionFor), model3, null, null);
bindingContext.addValidationStatusProvider(binding3);
ControlDecorationSupport.create(binding2, SWT.TOP | SWT.LEFT);
btnSyncronizeCollection.setEnabled(permisionsController.authenticatedUserMaySyncDBColl(text.getText()));
return bindingContext;
}
示例14: loadSelectIntegerWidget
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的package包/类
private void loadSelectIntegerWidget(BTSConfigItem itemConfig2,
BTSPassportEntry entry) {
Label label = new Label(this, SWT.NONE);
label.setText(getLabel(itemConfig));
label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER / 2, 1));
((GridData) label.getLayoutData()).verticalIndent = 2;
// label.pack();
spinner = new Spinner(this, SWT.BORDER);
spinner.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,
BTSUIConstants.PASSPORT_COLUMN_NUMBER / 2,
1));
((GridData) spinner.getLayoutData()).horizontalIndent = 7;
if (itemConfig2.getDescription() != null
&& !itemConfig2.getDescription().getLanguages().isEmpty()) {
final ControlDecoration deco = new ControlDecoration(spinner,
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);
}
DataBindingContext bindingContext = new DataBindingContext();
EMFUpdateValueStrategy targetToModel = new EMFUpdateValueStrategy();
targetToModel.setConverter(new BTSIntegerToStringConverter());
if (itemConfig.getPassportEditorConfig().isRequired()) {
targetToModel.setBeforeSetValidator(new StringNotEmptyValidator());
}
EMFUpdateValueStrategy modelToTarget = new EMFUpdateValueStrategy();
modelToTarget.setConverter(new BTSStringToIntegerConverter());
Binding binding = bindingContext.bindValue(
WidgetProperties.selection().observeDelayed(
BTSUIConstants.DELAY, spinner),
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
spinner.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getParent().setFocus();
}
});
}
示例15: loadSelectConfigWidget
import org.eclipse.core.databinding.DataBindingContext; //导入方法依赖的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();
}
});
}