Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » EMF databinding to multiple fields
EMF databinding to multiple fields [message #481591] Fri, 21 August 2009 17:05 Go to next message
Sue  is currently offline Sue Friend
Messages: 14
Registered: July 2009
Junior Member
I'm trying to figure out how to bind enablement of a field to multiple
values in my model. So, if my model is:

Person
isOld()
isTall()

I want to enable a text field if both of those values are true. When then
are changed, either by UI action or undo/redo, I would like the enablement
of the text field to change accordingly.

The only way I know to do this is to bind the enablement to each
separately. But this is an "OR" relationship and not the desired "AND"
relationship.

For example:

emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
ModelPackage.Literals.MODEL__OLD), null, null);

emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
ModelPackage.Literals.MODEL__TALL), null, null);

Is there a way to combine these enablements. I tried to use a
WritableValue but it seems like this requires that value to be changed
when either field gets changed. This is doable, but I have a lot of
different combinations and that would mean creating a bunch of
WritableValues and updating them all when the values change.
Re: EMF databinding to multiple fields [message #481643 is a reply to message #481591] Sat, 22 August 2009 07:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Sue,

I see you reposted this to the EMF newsgroup, where Matthew was so kind
to answer it.


Sue wrote:
> I'm trying to figure out how to bind enablement of a field to multiple
> values in my model. So, if my model is:
>
> Person
> isOld()
> isTall()
>
> I want to enable a text field if both of those values are true. When
> then are changed, either by UI action or undo/redo, I would like the
> enablement of the text field to change accordingly.
>
> The only way I know to do this is to bind the enablement to each
> separately. But this is an "OR" relationship and not the desired
> "AND" relationship.
>
> For example:
>
> emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
> EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
> ModelPackage.Literals.MODEL__OLD), null, null);
>
> emfDbc.bindValue(SWTObservables.observeEnabled(_txt),
> EMFEditObservables.observeValue(_editor.getEditingDomain(), model,
> ModelPackage.Literals.MODEL__TALL), null, null);
>
> Is there a way to combine these enablements. I tried to use a
> WritableValue but it seems like this requires that value to be changed
> when either field gets changed. This is doable, but I have a lot of
> different combinations and that would mean creating a bunch of
> WritableValues and updating them all when the values change.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Command appearing enabled when editPart not in focus
Next Topic:Suppress general views in dialog "Window->Show View"?
Goto Forum:
  


Current Time: Tue Apr 23 08:45:05 GMT 2024

Powered by FUDForum. Page generated in 0.02748 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top