本文整理汇总了Java中org.eclipse.core.databinding.observable.value.WritableValue类的典型用法代码示例。如果您正苦于以下问题:Java WritableValue类的具体用法?Java WritableValue怎么用?Java WritableValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WritableValue类属于org.eclipse.core.databinding.observable.value包,在下文中一共展示了WritableValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBindByExpression
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
@Test
public void testBindByExpression() {
Binder binder = Binder.create(null);
assertNotNull(binder);
IObservableValue targetObservableValue = new WritableValue();
Company company = new Company();
company.setName("A0");
binder.bind(targetObservableValue, company, "{path=name}");
assertEquals("A0", targetObservableValue.getValue());
company.setName("A1");
assertEquals("A1", targetObservableValue.getValue());
targetObservableValue.setValue("B0");
assertEquals("B0", company.getName());
}
示例2: initCustomDataBindings
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的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
示例3: createDataBindings
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
protected void createDataBindings(SensidlProjectDTO sensidlProjectDTO) {
DataBindingContext bindingContext = new DataBindingContext();
UpdateValueStrategy strategyAtomicStringToModel = new UpdateValueStrategy();
strategyAtomicStringToModel.setAfterGetValidator(new NonEmptyStringValidator());
UpdateValueStrategy strategyAtomicStringToTarget = new UpdateValueStrategy();
IObservableValue observeTextTxtSensidlFileNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtSensidlFileName);
IObservableValue atomicValidatedProjectName = new WritableValue(null, String.class);
bindingContext.bindValue(observeTextTxtSensidlFileNameObserveWidget, atomicValidatedProjectName, strategyAtomicStringToModel, strategyAtomicStringToTarget);
IObservableValue model = BeanProperties.value("sensidlFileName").observe(sensidlProjectDTO);
bindingContext.bindValue(observeTextTxtSensidlFileNameObserveWidget, model);
aggregatedStatus = new AggregateValidationStatus(bindingContext, AggregateValidationStatus.MAX_SEVERITY);
aggregatedStatus.addChangeListener(sensidlProjectStatusListener);
}
示例4: initDataBinding
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
private void initDataBinding(){
transientCodingValue = new WritableValue();
DataBindingContext bindingContext = new DataBindingContext();
IObservableValue targetObservable = SWTObservables.observeText(codeTxt, SWT.Modify);
IObservableValue modelObservable = PojoObservables.observeDetailValue(transientCodingValue,
"code", TransientCoding.class);
bindingContext.bindValue(targetObservable, modelObservable);
targetObservable = SWTObservables.observeText(displayTxt, SWT.Modify);
modelObservable = PojoObservables.observeDetailValue(transientCodingValue, "display",
TransientCoding.class);
bindingContext.bindValue(targetObservable, modelObservable);
setCoding(null);
}
示例5: PageManager
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
public PageManager ( final Realm realm, final BundleContext context )
{
this.realm = realm;
this.context = context;
this.rootNode = new TreeNode ( realm, "" ); //$NON-NLS-1$
this.pageName = new WritableValue ( realm );
this.tracker = new ServiceTracker<PageProvider, PageProvider> ( context, PageProvider.class, this.customizer );
this.tracker.open ();
}
示例6: createStandardText
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
public void createStandardText ( final Composite parent, final String attributeName, final int style, final String label, final String textMessage, final IObservableMap data, final Object valueType )
{
final Label labelControl = this.toolkit.createLabel ( parent, label + ":" );
final boolean multi = ( style & SWT.MULTI ) > 0;
if ( multi )
{
labelControl.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, false, false ) );
}
final Text text = this.toolkit.createText ( parent, "", style );
text.setMessage ( textMessage );
final GridData gd = new GridData ( GridData.FILL, multi ? GridData.FILL : GridData.BEGINNING, true, true );
gd.horizontalSpan = 2;
text.setLayoutData ( gd );
text.setToolTipText ( textMessage );
final IObservableValue value = Observables.observeMapEntry ( data, attributeName, String.class );
if ( valueType != null && valueType != String.class )
{
final WritableValue conversionValue = new WritableValue ( null, valueType );
this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), conversionValue );
this.dbc.bindValue ( conversionValue, value );
}
else
{
this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value );
}
}
示例7: EcoreCodeGeneratorCheckStateListener
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
public EcoreCodeGeneratorCheckStateListener(EditingDomain editingDomain, WritableValue<EcoreCodeGenerator> eCoreCodeGeneratorWritableValue, CheckboxTreeViewer checkboxTreeViewer) {
this.editingDomain = editingDomain;
this.eCoreCodeGeneratorWritableValue = eCoreCodeGeneratorWritableValue;
this.checkboxTreeViewer = checkboxTreeViewer;
refreshCommand = new AbstractCommand() {
@Override
public void redo() {
checkboxTreeViewer.refresh();
}
@Override
public void undo() {
checkboxTreeViewer.refresh();
}
@Override
public void execute() {
// NOP
}
@Override
protected boolean prepare() {
return true;
}
};
}
示例8: toObservable
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
private IObservable toObservable(Object dataContext, Binding binding) {
WritableValue wv = new WritableValue();
if (dataContext != null) {
// this binding element has a path to the root data context
wv.setValue(dataContext);
}
IObservable modelObservableValue = observe(wv, binding.getPath());
return modelObservableValue;
}
示例9: initBinding
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
@Override
protected void initBinding() throws ConnectException {
BindingHelper.bindStringToTextField(txtBarcode, getInputObservable(), Copy.FIELD_BARCODE, bindingContext,
false);
BindingHelper.bindStringToTextField(txtEdition, getInputObservable(), Copy.FIELD_EDITION, bindingContext,
false);
BindingHelper.bindStringToTextField(txtCondition, getInputObservable(), Copy.FIELD_CONDITION, bindingContext,
false);
final IObservableValue mediumObservable = BeansObservables.observeDetailValue(getInputObservable(),
Copy.FIELD_MEDIUM, Medium.class);
BindingHelper.bindStringToTextField(txtTitle, mediumObservable, Medium.FIELD_TITLE, bindingContext, false);
BindingHelper.bindStringToTextField(txtAuthor, mediumObservable, Medium.FIELD_AUTHOR, bindingContext, false);
BindingHelper.bindStringToTextField(txtLanguage, mediumObservable, Medium.FIELD_LANGUAGE, bindingContext,
false);
BindingHelper.bindStringToTextField(txtPublisher, mediumObservable, Medium.FIELD_PUBLISHER, bindingContext,
false);
BindingHelper.bindStringToTextField(txtIsbn, mediumObservable, Medium.FIELD_ISBN, bindingContext, false);
BindingHelper.bindObjectToCCombo(comboMediumType, mediumObservable, Medium.class, Medium.FIELD_TYPE,
MediumType.class, ServiceLocator.getInstance().getTypService().list(), new MediumTypeLabelProvider(),
bindingContext, false);
// dummy binding to validate that barcode isn't taken
final UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
modelToTarget.setAfterGetValidator(new BarcodeTakenValidator());
bindingContext.bindValue(new WritableValue(null, String.class), barcodeObservable,
new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER), modelToTarget);
}
示例10: RenameUMLElementRefactoringWizardUserPage
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
/**
* Instantiates the wizard page.
*
* @param newName
* The object that will receive the new name specified by the user.
* @param nameMightBeEmpty
*/
public RenameUMLElementRefactoringWizardUserPage(IObservableValue<String> newName,
IObservableValue<String> newAlias, boolean nameMightBeEmpty, boolean aliasIsAvailable) {
super("Refactoring input data");
this.nameMightBeEmpty = nameMightBeEmpty;
this.aliasIsAvailable = aliasIsAvailable;
this.newName = newName;
this.newAlias = newAlias;
this.validationErrorMessage = new WritableValue<>();
validationErrorMessage.addValueChangeListener(event -> handleValidationErrorMessage(event.diff.getNewValue()));
}
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:RenameUMLElementRefactoringWizardUserPage.java
示例11: FocusViewModel
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
public FocusViewModel() {
diagramTitle = new WritableValue<>();
muteStatus = new WritableValue<>();
historyElement = new WritableList<>(new ArrayList<>(), HistoryElement.class);
historyChangedListener = this::historyChanged;
diagramTitle.addChangeListener(this::handleChange);
muteStatus.addChangeListener(this::handleChange);
}
示例12: NewProjectWizardPage
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
public NewProjectWizardPage(String pageName) {
super(pageName);
setTitle("Create new Commandline-Hero project");
this.properties = new ProjectProperties();
properties.identifier = new WritableValue("com.myproject.cmdline", null);
properties.port = new WritableValue(8080, null);
properties.version = new WritableValue("1.0.0", null);
properties.withExampleData= new WritableValue(true, null);
}
示例13: bindFields
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
@Override
public <S> void bindFields(final BFormInstance<S, ?> formInstance, final BForm<S> form, boolean immediate) {
Object context = formInstance.getBindingContext();
if (context != null) {
throw new UnsupportedOperationException("Binding context has been already set");
}
DataBindingContext dbCtx = createDataBindingContext(formInstance);
final WritableValue formValue = new WritableValue(formInstance.getValue(), Object.class);
final WritableValue presenterValue = new WritableValue(form.createPresenter(formInstance, formInstance.getValue()),
BPresenter.class);
formValue.addValueChangeListener(new IValueChangeListener() {
@Override
public void handleValueChange(ValueChangeEvent event) {
presenterValue.setValue(form.createPresenter(formInstance, formInstance.getValue()));
}
});
bindFormValue(dbCtx, formValue, form, formInstance);
bindFormValidation(dbCtx, formValue, form, formInstance);
recursiveAddBindings(dbCtx, formValue, formInstance, form, presenterValue, immediate);
bindValidationSummaryError(dbCtx, formInstance);
formInstance.setBindingContext(new EclipseBindingContext(dbCtx));
}
示例14: initDataBinding
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的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);
}
示例15: getDirtyValue
import org.eclipse.core.databinding.observable.value.WritableValue; //导入依赖的package包/类
public WritableValue getDirtyValue ()
{
return this.dirtyValue;
}