Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658009/#msg_658009
I want to implement a master-detail (list and detaileditor) which contains a combobox.
There is shown a list of recipients in the list.
in the combobox there is shown a reference in the Recipient-class with the name master, which references another recipient from the list. This should be selected with the combobox.
Now I want to implement a databinding, but don't know how to do this. My code leads to an
java.lang.NoSuchMethodException: org.eclipse.aid.model.Aid.impl.RecipientImpl.addPropertyChan geListener(java.beans.PropertyChangeListener)
at java.lang.Class.getMethod(Class.java:1622)
at org.eclipse.core.internal.databinding.beans.BeanPropertyList enerSupport.processListener(BeanPropertyListenerSupport.java :96)
at org.eclipse.core.internal.databinding.beans.BeanPropertyList enerSupport.hookListener(BeanPropertyListenerSupport.java:44 )
at org.eclipse.core.internal.databinding.beans.BeanPropertyList ener.doAddTo(BeanPropertyListener.java:56)
at org.eclipse.core.databinding.property.NativePropertyListener .addTo(NativePropertyListener.java:41)
at org.eclipse.core.internal.databinding.property.value.SimpleP ropertyObservableValue$3.run(SimplePropertyObservableValue.j ava:83)
at org.eclipse.core.databinding.observable.Realm$1.run(Realm.ja va:148)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.databinding.observable.Realm.safeRun(Realm. java:152)
at org.eclipse.core.databinding.observable.Realm.exec(Realm.jav a:170)
at org.eclipse.core.internal.databinding.propert
This is my code: (tabViewerRec = Table of items, cmbMaster is combobox that should contain the selection
Best regards
Markus]]>Markus Oley2011-03-04T23:23:04-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658011/#msg_658011
Shouldn't you be using the EMFObservables or EMFEditObservables rather
than the Bean one?
Markus Oley wrote:
> Hi to all,
> I want to implement a master-detail (list and detaileditor) which
> contains a combobox. There is shown a list of recipients in the list.
> in the combobox there is shown a reference in the Recipient-class
> with the name master, which references another recipient from the
> list. This should be selected with the combobox.
> Now I want to implement a databinding, but don't know how to do this.
> My code leads to an
> java.lang.NoSuchMethodException:
> org.eclipse.aid.model.Aid.impl.RecipientImpl.addPropertyChan
> geListener(java.beans.PropertyChangeListener)
> at java.lang.Class.getMethod(Class.java:1622)
> at org.eclipse.core.internal.databinding.beans.BeanPropertyList
> enerSupport.processListener(BeanPropertyListenerSupport.java :96)
> at org.eclipse.core.internal.databinding.beans.BeanPropertyList
> enerSupport.hookListener(BeanPropertyListenerSupport.java:44 )
> at org.eclipse.core.internal.databinding.beans.BeanPropertyList
> ener.doAddTo(BeanPropertyListener.java:56)
> at org.eclipse.core.databinding.property.NativePropertyListener
> .addTo(NativePropertyListener.java:41)
> at org.eclipse.core.internal.databinding.property.value.SimpleP
> ropertyObservableValue$3.run(SimplePropertyObservableValue.j ava:83)
> at org.eclipse.core.databinding.observable.Realm$1.run(Realm.ja
> va:148)
> at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
> at org.eclipse.core.databinding.observable.Realm.safeRun(Realm.
> java:152)
> at org.eclipse.core.databinding.observable.Realm.exec(Realm.jav
> a:170)
> at org.eclipse.core.internal.databinding.propert
>
>
>
> This is my code: (tabViewerRec = Table of items, cmbMaster is combobox
> that should contain the selection
>
> widgetValue = WidgetProperties.selection().observe(cmbMaster);
> selection =
> ViewersObservables.observeSingleSelection(tabViewerRec);
> modelValue = BeansObservables.observeDetailValue(selection,
> "master", Recipient.class);
> bindingContext.bindValue(widgetValue, modelValue);]]>Ed Merks2011-03-05T00:18:56-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658029/#msg_658029
thank you for your fast answer.
These are my first steps with the combination of JFace/EMF and I'm new to JFace-Databinding.
So it is in all propability that my approach is wrong.
Do you have a codesnippet somewhere, where this problem is solved? Or a tutorial how to use JFace-Databinding together with EMF? Would be very helpful.
Thanks by now,
Best regards
Markus]]>Markus Oley2011-03-05T08:50:37-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658058/#msg_658058
--------------010706010903090601020501
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Markus,
Googling "EMF Databinding" turns up a bunch of good sources of
information including
Markus Oley wrote:
> Hi Ed,
> thank you for your fast answer. These are my first steps with the
> combination of JFace/EMF and I'm new to JFace-Databinding.
> So it is in all propability that my approach is wrong. Do you have a
> codesnippet somewhere, where this problem is solved? Or a tutorial how
> to use JFace-Databinding together with EMF? Would be very helpful.
>
> Thanks by now,
> Best regards
> Markus
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Markus,<br>
<br>
Googling "EMF Databinding" turns up a bunch of good sources of
information including<br>
<blockquote><a
href=" http://tomsondev.bestsolution.at/2009/06/06/galileo-emf-data binding-part-1/"> http://tomsondev.bestsolution.at/2009/06/06/galileo-emf-data binding-part-1/</a><br>
</blockquote>
<br>
Markus Oley wrote:
<blockquote cite="mid:ikst4a$t4k$1@news.eclipse.org" type="cite">Hi Ed,
<br>
thank you for your fast answer. These are my first steps with the
combination of JFace/EMF and I'm new to JFace-Databinding. <br>
So it is in all propability that my approach is wrong. Do you have a
codesnippet somewhere, where this problem is solved? Or a tutorial how
to use JFace-Databinding together with EMF? Would be very helpful.
<br>
<br>
Thanks by now, <br>
Best regards
<br>
Markus
<br>
</blockquote>
</body>
</html>
--------------010706010903090601020501--]]>Ed Merks2011-03-05T17:01:29-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658065/#msg_658065
Markus Oley2011-03-05T20:38:00-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658069/#msg_658069
sorry, but these examples don't work for me, since the signatures of some methods changed. Could you please give me any further hints?
Thanks by now,
Markus]]>Markus Oley2011-03-05T22:37:14-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658099/#msg_658099
experimenting a little bit, I found the solution (snippet below). The only problem is, that this is an attribute, which can be null. How can I fill an empty entry, which maps to null?
]]>Markus Oley2011-03-06T12:26:43-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658110/#msg_658110
Comments below.
Markus Oley wrote:
> Hi again Ed,
> experimenting a little bit, I found the solution (snippet below). The
> only problem is, that this is an attribute, which can be null. How can
> I fill an empty entry, which maps to null?
I'm not a data binding expert, so I don't really know what you're asking
specifically, but I do know that in general, making a distinction
between null and the empty string is problematic in text widgets. It
seems a general problem but there is no general solution. It's just an
additional state that's not well represented by just a text widget.
>
> Best regards Markus
>
>
>
>
>
>
> Snippet:
> IViewerObservableValue widgetValue2 =
> ViewersObservables.observeSingleSelection(comboviewer);
> EStructuralFeature eStructuralFeature =
> recClass.getEStructuralFeature(AidPackage.RECIPIENT__MASTER) ;
There's AidPackage.Literals.RECIPIENT__MASTER already available.
> IObservableValue modelValue =
> EMFObservables.observeDetailValue(Realm.getDefault(), selection,
> eStructuralFeature);
> EMFEditObservables.observeDetailValue(Realm.getDefault(),
>
> AdapterFactoryEditingDomain.getEditingDomainFor(currentRec),
> modelValue, eStructuralFeature);
>
> bindingContext.bindValue(widgetValue2, modelValue);
>
>
>]]>Ed Merks2011-03-06T16:15:31-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658213/#msg_658213
OK, thank you
]]>Markus Oley2011-03-07T12:36:55-00:00Re: DataBinding for a combobox which holds a Elist from a model
https://www.eclipse.org/forums/index.php/mv/msg/205601/658219/#msg_658219
need to use the bindValue() method which accepts 4 params.
It's also not clear from your code if you are using an
EMFDatabindingContext or DatabindingContext. Make sure you use the
EMFDatabindingContext!
Tom
Am 07.03.11 13:36, schrieb Markus Oley:
> Hi Ed,
> OK, thank you]]>Thomas Schindl2011-03-07T13:00:25-00:00