Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Using JFace data binding with an EMF List which maby be null
Using JFace data binding with an EMF List which maby be null [message #1429804] Tue, 23 September 2014 19:41 Go to next message
Justin Weir is currently offline Justin WeirFriend
Messages: 18
Registered: July 2009
Junior Member
Hi,

I am using JFace data binding to bind an EMF list to another observable list. The problem I'm having (I think) is that the list is null before any items are added. Is there an easy way to do the databinding so that it creates the list when the first element is being added to it? Is there a way to null out the list when the last item is removed?

Thanks in advance for any help.
Re: Using JFace data binding with an EMF List which maby be null [message #1429855 is a reply to message #1429804] Tue, 23 September 2014 20:56 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
El 23/09/2014 21:41, Justin Weir escribió:
> Hi,
>
> I am using JFace data binding to bind an EMF list to another observable
> list. The problem I'm having (I think) is that the list is null before
> any items are added.

EMF generated code will make sure the list is not null when you access it.

> Is there an easy way to do the databinding so that
> it creates the list when the first element is being added to it? Is
> there a way to null out the list when the last item is removed?

Do you want to decrease footprint or get your databinding working? :)

Felix
Re: Using JFace data binding with an EMF List which maby be null [message #1430125 is a reply to message #1429804] Wed, 24 September 2014 04:06 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Justin,

Comments below.

On 23/09/2014 9:41 PM, Justin Weir wrote:
> Hi,
>
> I am using JFace data binding to bind an EMF list to another
> observable list. The problem I'm having (I think) is that the list is
> null before any items are added.
I doubt that's a problem. The getter for a multi-valued feature always
returns a list. Internally, the field will be null until the first time
the getter is called, but no one can see that via the API...
> Is there an easy way to do the databinding so that it creates the list
> when the first element is being added to it?
How is the list accessed that anyone would ever see null?
> Is there a way to null out the list when the last item is removed?
No, because you can't ever know who else has asked for the list and is
still referencing it. The list itself is the state of the model instance.
>
> Thanks in advance for any help.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] cast error from string to cdoid
Next Topic:Missing class in CDOExplorer
Goto Forum:
  


Current Time: Tue Apr 23 13:54:12 GMT 2024

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

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

Back to the top