[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: howto?: emf databind to absent feature's value

Hi,

Looking at your model is it correct to assume that firstname and
lastname are EObject's themselves?

At least your description looks and symptoms look like this is the case
but maybe you could share your source with us or at least the Ecore-Model.

If the above assumption is correct and lastname is an EObject then it is
*impossible* for databinding to instantiate the model instance and you
need to fill it your own (though I have no immediate idea how this would
look like).

Tom

John J. Franey schrieb:
> On Wed, 02 Sep 2009 12:11:18 -0400, Ed Merks wrote:
> 
>> John,
>>
>> Hopefully Tom will comment at some point when he's available.  My data
>> binding skills are pretty sparse, but as I said, what you're describing
>> is extremely basic...
>>
>>
> 
> Well, I did some legwork in preparation for Tom.  In this post, I keep
> the problem description below, and my findings follow.
> 
>> John J. Franey wrote:
>>> On Wed, 02 Sep 2009 10:16:33 -0400, Ed Merks wrote:
>>>
>>>
>>>> John,
>>>>
>>>> Comments below.
>>>>
>>>> John J. Franey wrote:
>>>>     
>>>>> I want to bind an swt text field to a feature of type String which is
>>>>> not yet instantiated in the model.
>>>>>       
>>>> Not sure what the means.
>>>>     
>>>>     
>>> Ok. No problem.  I'm still a novice and likely using terms incorrectly.
>>>
>>> I'm using the emf databinding api.  I want the user's edits on the text
>>> widget to change the emf model.
>>>
>>> I see a difference in behavior on the editor I created.  In one case,
>>> user's edits in the widget change the model, in the other, they don't.
>>>
>>> I attribute this difference to the initial content of the resource as
>>> read from the filesystem from an xml file.  I noticed the behavioral
>>> difference between input resources that look different in their
>>> serialized form:
>>>
>>>
>>> databinding to lastname works on this content:
>>>
>>> <person>
>>>   <name>
>>>     <firstname>John</firstname>
>>>     <lastname></lastname>
>>>   </name>
>>> </person>
>>>
>>>
>>> databinding to lastname doesn't work on this content:
>>>
>>> <person>
>>>   <name>
>>>     <firstname>John</firstname>
>>>   </name>
>>> </person>
>>>
>>> These were built by hand using a text editor and then provided as input
>>> to the model editor I'm building.
>>>
>>> So, when I said "feature of type String that is not yet instantiated in
>>> the model"  I meant to describe this latter case.
>>>
>>>
> 
> Here is what I found in single stepping through the databinding code.  Most
> of the action is in
>  org.eclipse.core.
>   internal.databinding.observable.masterdetail.DetailObservableValue
> 
> I traced down to doSetValue which is called after the user enters
> data into the widget.  innerObservableValue is null.  doSetValue doesn't
> set the value in the model in this case.
> 
> So, why is innerObservableValue null?  When the
> DetailObservableValue is constructed (as part of call to observeDetail),
> innerObservable is set to null.  This is done by updateInnerObservableValue
> because outerObservableValue.getValue() returned null.  I don't know why
> outerObservableValue.getValue() returned null.  Will keep looking.
> 
> I don't know what this all means yet, or how my code is broken.  I'm
> just sending it up as datapoints for the analysis.
> 
> Regards,
> John