Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF databinding] Problems with EMFListProperty on a single Reference
[EMF databinding] Problems with EMFListProperty on a single Reference [message #531115] Mon, 03 May 2010 17:22 Go to next message
Eclipse UserFriend
Originally posted by: Thomas.Kowatsch.ruag.com

Hi all.

With EMFListProperty it is possible to create a list property on a
single reference (Feature#isMany() is false). The doGetList() method in
EMFListProperty wrapps a single reference into a list.

This is fine and I use this for the TreeFactory of an
ObservableListTreeContentProvider.

When this reference is set to another value, a notification is delivered
in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
notification type is Notification.SET in this case.

Now comes the problem. In the Notification.SET case, a ListDiff is
calculated from the information in the notification. Unfortunately the
position delivered in the notification is always -1! I guess that is
because it is a single reference which is set, so no position is delivered.
The calculated ListDiff now leads to subsequent problems as the position
is -1 and that means IndexOutOfBounds.

Am I getting something wrong or is this a bug?
If it is a bug, I can file a bugzilla.

Cheers.
--Thomas
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531157 is a reply to message #531115] Mon, 03 May 2010 23:00 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I'm a bit suprised that EMFListProperty does this kind of thing. I need
to look up the code.

Can you described in more detail why you are using the EMFListProperty
on a single valued feature?

Tom

Am 03.05.10 19:22, schrieb Thomas Kowatsch:
> Hi all.
>
> With EMFListProperty it is possible to create a list property on a
> single reference (Feature#isMany() is false). The doGetList() method in
> EMFListProperty wrapps a single reference into a list.
>
> This is fine and I use this for the TreeFactory of an
> ObservableListTreeContentProvider.
>
> When this reference is set to another value, a notification is delivered
> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
> notification type is Notification.SET in this case.
>
> Now comes the problem. In the Notification.SET case, a ListDiff is
> calculated from the information in the notification. Unfortunately the
> position delivered in the notification is always -1! I guess that is
> because it is a single reference which is set, so no position is delivered.
> The calculated ListDiff now leads to subsequent problems as the position
> is -1 and that means IndexOutOfBounds.
>
> Am I getting something wrong or is this a bug?
> If it is a bug, I can file a bugzilla.
>
> Cheers.
> --Thomas
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531224 is a reply to message #531157] Tue, 04 May 2010 08:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Thomas.Kowatsch.ruag.com

Hi Tom.
I use a EMFListProperty for an IObservableFactory of a
ObservableListTreeItemProvider. The Tree has one node in the hierarchy
which has only one child in a single reference. I hope that explains it.
Cheers.
--Thomas

Tom Schindl schrieb:
> I'm a bit suprised that EMFListProperty does this kind of thing. I need
> to look up the code.
>
> Can you described in more detail why you are using the EMFListProperty
> on a single valued feature?
>
> Tom
>
> Am 03.05.10 19:22, schrieb Thomas Kowatsch:
>> Hi all.
>>
>> With EMFListProperty it is possible to create a list property on a
>> single reference (Feature#isMany() is false). The doGetList() method in
>> EMFListProperty wrapps a single reference into a list.
>>
>> This is fine and I use this for the TreeFactory of an
>> ObservableListTreeContentProvider.
>>
>> When this reference is set to another value, a notification is delivered
>> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
>> notification type is Notification.SET in this case.
>>
>> Now comes the problem. In the Notification.SET case, a ListDiff is
>> calculated from the information in the notification. Unfortunately the
>> position delivered in the notification is always -1! I guess that is
>> because it is a single reference which is set, so no position is delivered.
>> The calculated ListDiff now leads to subsequent problems as the position
>> is -1 and that means IndexOutOfBounds.
>>
>> Am I getting something wrong or is this a bug?
>> If it is a bug, I can file a bugzilla.
>>
>> Cheers.
>> --Thomas
>
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531245 is a reply to message #531157] Tue, 04 May 2010 10:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030402090404090404090102
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Tom,

I added this support for lists so people could compose multiple
features, even single valued ones into a virtual larger list. I did
not do so much testing around this case though, so it's possible I did
something not quite right.


Tom Schindl wrote:
> I'm a bit suprised that EMFListProperty does this kind of thing. I need
> to look up the code.
>
> Can you described in more detail why you are using the EMFListProperty
> on a single valued feature?
>
> Tom
>
> Am 03.05.10 19:22, schrieb Thomas Kowatsch:
>
>> Hi all.
>>
>> With EMFListProperty it is possible to create a list property on a
>> single reference (Feature#isMany() is false). The doGetList() method in
>> EMFListProperty wrapps a single reference into a list.
>>
>> This is fine and I use this for the TreeFactory of an
>> ObservableListTreeContentProvider.
>>
>> When this reference is set to another value, a notification is delivered
>> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
>> notification type is Notification.SET in this case.
>>
>> Now comes the problem. In the Notification.SET case, a ListDiff is
>> calculated from the information in the notification. Unfortunately the
>> position delivered in the notification is always -1! I guess that is
>> because it is a single reference which is set, so no position is delivered.
>> The calculated ListDiff now leads to subsequent problems as the position
>> is -1 and that means IndexOutOfBounds.
>>
>> Am I getting something wrong or is this a bug?
>> If it is a bug, I can file a bugzilla.
>>
>> Cheers.
>> --Thomas
>>
>
>

--------------030402090404090404090102
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!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 added this support for lists so people could compose multiple
features, even single valued ones into a virtual larger list.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531290 is a reply to message #531245] Tue, 04 May 2010 12:02 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi Ed,

We could take a look at it ;-).

Tom

Am 04.05.10 12:12, schrieb Ed Merks:
> Tom,
>
> I added this support for lists so people could compose multiple
> features, even single valued ones into a virtual larger list. I did
> not do so much testing around this case though, so it's possible I did
> something not quite right.
>
>
> Tom Schindl wrote:
>> I'm a bit suprised that EMFListProperty does this kind of thing. I need
>> to look up the code.
>>
>> Can you described in more detail why you are using the EMFListProperty
>> on a single valued feature?
>>
>> Tom
>>
>> Am 03.05.10 19:22, schrieb Thomas Kowatsch:
>>
>>> Hi all.
>>>
>>> With EMFListProperty it is possible to create a list property on a
>>> single reference (Feature#isMany() is false). The doGetList() method in
>>> EMFListProperty wrapps a single reference into a list.
>>>
>>> This is fine and I use this for the TreeFactory of an
>>> ObservableListTreeContentProvider.
>>>
>>> When this reference is set to another value, a notification is delivered
>>> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
>>> notification type is Notification.SET in this case.
>>>
>>> Now comes the problem. In the Notification.SET case, a ListDiff is
>>> calculated from the information in the notification. Unfortunately the
>>> position delivered in the notification is always -1! I guess that is
>>> because it is a single reference which is set, so no position is delivered.
>>> The calculated ListDiff now leads to subsequent problems as the position
>>> is -1 and that means IndexOutOfBounds.
>>>
>>> Am I getting something wrong or is this a bug?
>>> If it is a bug, I can file a bugzilla.
>>>
>>> Cheers.
>>> --Thomas
>>>
>>
>>
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531291 is a reply to message #531224] Tue, 04 May 2010 12:07 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Ok. I see a work around while this is fixed is that you create an
WritableList and listen on the stuff.

This code from my e4-Model-Editor:

---------8<---------
> private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_M ENU);
> final WritableList list = new WritableList();
> MWindow window = (MWindow) element;
> if( window.getMainMenu() != null ) {
> list.add(0,window.getMainMenu());
> }
>
> WINDOW__MAIN_MENU.observe(element).addValueChangeListener(ne w IValueChangeListener() {
>
> public void handleValueChange(ValueChangeEvent event) {
> if( event.diff.getOldValue() != null ) {
> list.remove(event.diff.getOldValue());
> }
>
> if( event.diff.getNewValue() != null ) {
> list.add(0,event.diff.getNewValue());
> }
> }
> });
---------8<---------

I guess this is what we need to fix in our code base as well :-)

Tom


Am 04.05.10 10:43, schrieb Thomas Kowatsch:
> Hi Tom.
> I use a EMFListProperty for an IObservableFactory of a
> ObservableListTreeItemProvider. The Tree has one node in the hierarchy
> which has only one child in a single reference. I hope that explains it.
> Cheers.
> --Thomas
>
> Tom Schindl schrieb:
>> I'm a bit suprised that EMFListProperty does this kind of thing. I need
>> to look up the code.
>>
>> Can you described in more detail why you are using the EMFListProperty
>> on a single valued feature?
>>
>> Tom
>>
>> Am 03.05.10 19:22, schrieb Thomas Kowatsch:
>>> Hi all.
>>>
>>> With EMFListProperty it is possible to create a list property on a
>>> single reference (Feature#isMany() is false). The doGetList() method in
>>> EMFListProperty wrapps a single reference into a list.
>>>
>>> This is fine and I use this for the TreeFactory of an
>>> ObservableListTreeContentProvider.
>>>
>>> When this reference is set to another value, a notification is delivered
>>> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
>>> notification type is Notification.SET in this case.
>>>
>>> Now comes the problem. In the Notification.SET case, a ListDiff is
>>> calculated from the information in the notification. Unfortunately the
>>> position delivered in the notification is always -1! I guess that is
>>> because it is a single reference which is set, so no position is
>>> delivered.
>>> The calculated ListDiff now leads to subsequent problems as the position
>>> is -1 and that means IndexOutOfBounds.
>>>
>>> Am I getting something wrong or is this a bug?
>>> If it is a bug, I can file a bugzilla.
>>>
>>> Cheers.
>>> --Thomas
>>
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531292 is a reply to message #531291] Tue, 04 May 2010 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Thomas.Kowatsch.ruag.com

That's what I had before I saw the fix from Ed in EMFListProperty :-)

Tom Schindl schrieb:
> Hi,
>
> Ok. I see a work around while this is fixed is that you create an
> WritableList and listen on the stuff.
>
> This code from my e4-Model-Editor:
>
> ---------8<---------
>> private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_M ENU);
>> final WritableList list = new WritableList();
>> MWindow window = (MWindow) element;
>> if( window.getMainMenu() != null ) {
>> list.add(0,window.getMainMenu());
>> }
>>
>> WINDOW__MAIN_MENU.observe(element).addValueChangeListener(ne w IValueChangeListener() {
>>
>> public void handleValueChange(ValueChangeEvent event) {
>> if( event.diff.getOldValue() != null ) {
>> list.remove(event.diff.getOldValue());
>> }
>>
>> if( event.diff.getNewValue() != null ) {
>> list.add(0,event.diff.getNewValue());
>> }
>> }
>> });
> ---------8<---------
>
> I guess this is what we need to fix in our code base as well :-)
>
> Tom
>
>
> Am 04.05.10 10:43, schrieb Thomas Kowatsch:
>> Hi Tom.
>> I use a EMFListProperty for an IObservableFactory of a
>> ObservableListTreeItemProvider. The Tree has one node in the hierarchy
>> which has only one child in a single reference. I hope that explains it.
>> Cheers.
>> --Thomas
>>
>> Tom Schindl schrieb:
>>> I'm a bit suprised that EMFListProperty does this kind of thing. I need
>>> to look up the code.
>>>
>>> Can you described in more detail why you are using the EMFListProperty
>>> on a single valued feature?
>>>
>>> Tom
>>>
>>> Am 03.05.10 19:22, schrieb Thomas Kowatsch:
>>>> Hi all.
>>>>
>>>> With EMFListProperty it is possible to create a list property on a
>>>> single reference (Feature#isMany() is false). The doGetList() method in
>>>> EMFListProperty wrapps a single reference into a list.
>>>>
>>>> This is fine and I use this for the TreeFactory of an
>>>> ObservableListTreeContentProvider.
>>>>
>>>> When this reference is set to another value, a notification is delivered
>>>> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
>>>> notification type is Notification.SET in this case.
>>>>
>>>> Now comes the problem. In the Notification.SET case, a ListDiff is
>>>> calculated from the information in the notification. Unfortunately the
>>>> position delivered in the notification is always -1! I guess that is
>>>> because it is a single reference which is set, so no position is
>>>> delivered.
>>>> The calculated ListDiff now leads to subsequent problems as the position
>>>> is -1 and that means IndexOutOfBounds.
>>>>
>>>> Am I getting something wrong or is this a bug?
>>>> If it is a bug, I can file a bugzilla.
>>>>
>>>> Cheers.
>>>> --Thomas
>
Re: [EMF databinding] Problems with EMFListProperty on a single Reference [message #531293 is a reply to message #531292] Tue, 04 May 2010 13:00 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Fixed in CVS as https://bugs.eclipse.org/bugs/show_bug.cgi?id=311529

Tom

Am 04.05.10 14:20, schrieb Thomas Kowatsch:
> That's what I had before I saw the fix from Ed in EMFListProperty :-)
>
> Tom Schindl schrieb:
>> Hi,
>>
>> Ok. I see a work around while this is fixed is that you create an
>> WritableList and listen on the stuff.
>>
>> This code from my e4-Model-Editor:
>>
>> ---------8<---------
>>> private IValueProperty WINDOW__MAIN_MENU =
>>> EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_M ENU);
>>> final WritableList list = new WritableList();
>>> MWindow window = (MWindow) element;
>>> if( window.getMainMenu() != null ) {
>>> list.add(0,window.getMainMenu());
>>> }
>>>
>>> WINDOW__MAIN_MENU.observe(element).addValueChangeListener(ne w
>>> IValueChangeListener() {
>>>
>>> public void handleValueChange(ValueChangeEvent event) {
>>> if( event.diff.getOldValue() != null ) {
>>> list.remove(event.diff.getOldValue());
>>> }
>>>
>>> if( event.diff.getNewValue() != null ) {
>>> list.add(0,event.diff.getNewValue());
>>> }
>>> }
>>> });
>> ---------8<---------
>>
>> I guess this is what we need to fix in our code base as well :-)
>>
>> Tom
>>
>>
>> Am 04.05.10 10:43, schrieb Thomas Kowatsch:
>>> Hi Tom.
>>> I use a EMFListProperty for an IObservableFactory of a
>>> ObservableListTreeItemProvider. The Tree has one node in the hierarchy
>>> which has only one child in a single reference. I hope that explains it.
>>> Cheers.
>>> --Thomas
>>>
>>> Tom Schindl schrieb:
>>>> I'm a bit suprised that EMFListProperty does this kind of thing. I need
>>>> to look up the code.
>>>>
>>>> Can you described in more detail why you are using the EMFListProperty
>>>> on a single valued feature?
>>>>
>>>> Tom
>>>>
>>>> Am 03.05.10 19:22, schrieb Thomas Kowatsch:
>>>>> Hi all.
>>>>>
>>>>> With EMFListProperty it is possible to create a list property on a
>>>>> single reference (Feature#isMany() is false). The doGetList()
>>>>> method in
>>>>> EMFListProperty wrapps a single reference into a list.
>>>>>
>>>>> This is fine and I use this for the TreeFactory of an
>>>>> ObservableListTreeContentProvider.
>>>>>
>>>>> When this reference is set to another value, a notification is
>>>>> delivered
>>>>> in EMFPropertyListener#EMFListPropertyListener#notifyChanged(). The
>>>>> notification type is Notification.SET in this case.
>>>>>
>>>>> Now comes the problem. In the Notification.SET case, a ListDiff is
>>>>> calculated from the information in the notification. Unfortunately the
>>>>> position delivered in the notification is always -1! I guess that is
>>>>> because it is a single reference which is set, so no position is
>>>>> delivered.
>>>>> The calculated ListDiff now leads to subsequent problems as the
>>>>> position
>>>>> is -1 and that means IndexOutOfBounds.
>>>>>
>>>>> Am I getting something wrong or is this a bug?
>>>>> If it is a bug, I can file a bugzilla.
>>>>>
>>>>> Cheers.
>>>>> --Thomas
>>
Previous Topic:Contributing Source Code Documentation
Next Topic:parameter passing pattern for templates
Goto Forum:
  


Current Time: Thu Apr 25 06:35:09 GMT 2024

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

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

Back to the top