Hi,
I want to bind the checkboxes of a CheckboxTreeViewer to a boolean
property of EMF objects displayed by the tree with JFace/EMF databinding.
How can I do this? I am aware of
ViewerObservables.observeCheckedElements(), but it returns an
IObservableSet, and I don't know any EMFObservables observer that returns
that type. I would need an example to bind it to an EMF structural
property... Thanks in advance,
thSoft
Dennis Harmath wrote:
> Hi,
> I want to bind the checkboxes of a CheckboxTreeViewer to a boolean
> property of EMF objects displayed by the tree with JFace/EMF
> databinding. How can I do this? I am aware of
> ViewerObservables.observeCheckedElements(), but it returns an
> IObservableSet, and I don't know any EMFObservables observer that
> returns that type. I would need an example to bind it to an EMF
> structural property... Thanks in advance,
> thSoft
>
The checked-elements and it is an ObservableSet because Databinding
can't guarantee the order which is an often forgotten nature of Lists.
Tom
Ed Merks schrieb:
> Dennis,
>
> What's the Set supposed to contain?
>
>
> Dennis Harmath wrote:
>> Hi,
>> I want to bind the checkboxes of a CheckboxTreeViewer to a boolean
>> property of EMF objects displayed by the tree with JFace/EMF
>> databinding. How can I do this? I am aware of
>> ViewerObservables.observeCheckedElements(), but it returns an
>> IObservableSet, and I don't know any EMFObservables observer that
>> returns that type. I would need an example to bind it to an EMF
>> structural property... Thanks in advance,
>> thSoft
>>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
This is a multi-part message in MIME format.
--------------010404080502080405000801
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Tom,
I see. It sounds like the set of checked elements would need to be
computed somehow anyway; it doesn't correspond directly to a feature.
Some type of new hand utility class would be needed where
adding/removing from the set would toggle some feature's state and
listeners to the feature's state would add/remove the object from the
set (all without getting into a loop).
Tom Schindl wrote:
> The checked-elements and it is an ObservableSet because Databinding
> can't guarantee the order which is an often forgotten nature of Lists.
>
> Tom
>
> Ed Merks schrieb:
>
>> Dennis,
>>
>> What's the Set supposed to contain?
>>
>>
>> Dennis Harmath wrote:
>>
>>> Hi,
>>> I want to bind the checkboxes of a CheckboxTreeViewer to a boolean
>>> property of EMF objects displayed by the tree with JFace/EMF
>>> databinding. How can I do this? I am aware of
>>> ViewerObservables.observeCheckedElements(), but it returns an
>>> IObservableSet, and I don't know any EMFObservables observer that
>>> returns that type. I would need an example to bind it to an EMF
>>> structural property... Thanks in advance,
>>> thSoft
>>>
>>>
>
>
>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Tom,<br>
<br>
I see.
Right you need a Converter from List to Set and back. Fortunately this
is already possible.
Something like this might do the Job.
private boolean flag = false;
final IObservable list = EMFObservableList.observeDetailList(....);
final IObservableSet set = new WritableSet();
list.addListChangeListener(new ListChangeListener() {
public void listChanged(ListChangeEvent evt) {
if( flag )
return;
The class-names, listeners might not be correct but the idea should be
clear. The only real problem is IIRC that WritableSet is not available
as of 3.4 but got added in 3.5.
Tom
Ed Merks schrieb:
> Tom,
>
> I see. It sounds like the set of checked elements would need to be
> computed somehow anyway; it doesn't correspond directly to a feature.
> Some type of new hand utility class would be needed where
> adding/removing from the set would toggle some feature's state and
> listeners to the feature's state would add/remove the object from the
> set (all without getting into a loop).
>
>
> Tom Schindl wrote:
>> The checked-elements and it is an ObservableSet because Databinding
>> can't guarantee the order which is an often forgotten nature of Lists.
>>
>> Tom
>>
>> Ed Merks schrieb:
>>
>>> Dennis,
>>>
>>> What's the Set supposed to contain?
>>>
>>>
>>> Dennis Harmath wrote:
>>>
>>>> Hi,
>>>> I want to bind the checkboxes of a CheckboxTreeViewer to a boolean
>>>> property of EMF objects displayed by the tree with JFace/EMF
>>>> databinding. How can I do this? I am aware of
>>>> ViewerObservables.observeCheckedElements(), but it returns an
>>>> IObservableSet, and I don't know any EMFObservables observer that
>>>> returns that type. I would need an example to bind it to an EMF
>>>> structural property... Thanks in advance,
>>>> thSoft
>>>>
>>>>
>>
>>
>>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
> The class-names, listeners might not be correct but the idea should be
> clear. The only real problem is IIRC that WritableSet is not available
> as of 3.4 but got added in 3.5.
>
> Tom
>
>
> Ed Merks schrieb:
>> Tom,
>>
>> I see. It sounds like the set of checked elements would need to be
>> computed somehow anyway; it doesn't correspond directly to a feature.
>> Some type of new hand utility class would be needed where
>> adding/removing from the set would toggle some feature's state and
>> listeners to the feature's state would add/remove the object from the
>> set (all without getting into a loop).
>>
>>
>> Tom Schindl wrote:
>>> The checked-elements and it is an ObservableSet because Databinding
>>> can't guarantee the order which is an often forgotten nature of Lists.
>>>
>>> Tom
>>>
>>> Ed Merks schrieb:
>>>
>>>> Dennis,
>>>>
>>>> What's the Set supposed to contain?
>>>>
>>>>
>>>> Dennis Harmath wrote:
>>>>
>>>>> Hi,
>>>>> I want to bind the checkboxes of a CheckboxTreeViewer to a boolean
>>>>> property of EMF objects displayed by the tree with JFace/EMF
>>>>> databinding. How can I do this? I am aware of
>>>>> ViewerObservables.observeCheckedElements(), but it returns an
>>>>> IObservableSet, and I don't know any EMFObservables observer that
>>>>> returns that type. I would need an example to bind it to an EMF
>>>>> structural property... Thanks in advance,
>>>>> thSoft
>>>>>
>>>>>
>>>
>>>
>
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
If you are not in master detail then EMFObservableList#observeList() is
the right one.
Tom
Dennis Harmath schrieb:
> Ed, Tom, thanks for your quick and helpful response.
> Fortunately WritableSet implementation is available 3.4.1 also.
> The only missing link is the
>
> final IObservable list = EMFObservableList.observeDetailList(....);
>
> operation. I don't know what its IObservableValue value argument should
> be, regarding I have a CheckboxTreeViewer and an EMF model. Any clues?
>
> thSoft
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Tom Schindl schrieb:
> If you are not in master detail then EMFObservableList#observeList() is
> the right one.
>
> Tom
>
> Dennis Harmath schrieb:
>> Ed, Tom, thanks for your quick and helpful response.
>> Fortunately WritableSet implementation is available 3.4.1 also.
>> The only missing link is the
>>
>> final IObservable list = EMFObservableList.observeDetailList(....);
>>
>> operation. I don't know what its IObservableValue value argument should
>> be, regarding I have a CheckboxTreeViewer and an EMF model. Any clues?
>>
>> thSoft
>>
>
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
I'm trying to do same, that is, binding a boolean property of my
EMFObjects to Check Boxes of a CheckBoxTreeViewer (All the elements showed
in the tree subclases the element with the boolean feature). I have follow
the explanations given by Tom Schindl but I don't know how to initialize
the ObservableList.
final IObservable list = EMFObservableList.observeDetailList(....);
I can't use EMFObservables.ObserveList(MyRoot, EStructuralFeature). It
throws an exception because a multivalued feature is expected and of
course my boolean feature isn't it. I'm a bit puzzled. ¿I am supposed to
build that list by hand?