Eclipse RCP Data Binding with WritableValue - Int vs. Integer [message #1358942] |
Fri, 16 May 2014 01:33  |
Eclipse User |
|
|
|
Hello,
I'm using Eclipse RCP 4 and I've little problem with my WritableValue:
I use the WritableValue in a data binding (see below) and whenever I set the value of my WritableValue with an object that contains an int attribute (part of the binding), then I receive a ClassCastException:
WritableValue<PlantBE> writableValue;
...
writableValue.setValue(somePlantBEEntity)
Caused by: java.lang.ClassCastException: Cannot cast java.lang.Integer to int
at java.lang.Class.cast(Unknown Source)
at org.eclipse.core.internal.databinding.beans.PojoValueProperty.doGetValue(PojoValueProperty.java:62)
at org.eclipse.core.databinding.property.value.ValueProperty.getValue(ValueProperty.java:60)
at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.notifyIfChanged(SimplePropertyObservableValue.java:119)
at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.doGetValue(SimplePropertyObservableValue.java:101)
at org.eclipse.core.databinding.observable.value.AbstractObservableValue.getValue(AbstractObservableValue.java:81)
at org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableValue.doGetValue(DetailObservableValue.java:150)
at org.eclipse.core.internal.databinding.observable.masterdetail.DetailObservableValue$2.handleValueChange(DetailObservableValue.java:96)
at org.eclipse.core.databinding.observable.value.ValueChangeEvent.dispatch(ValueChangeEvent.java:71)
at org.eclipse.core.databinding.observable.ChangeManager.fireEvent(ChangeManager.java:127)
at org.eclipse.core.databinding.observable.value.AbstractObservableValue.fireValueChange(AbstractObservableValue.java:76)
at org.eclipse.core.databinding.observable.value.WritableValue.doSetValue(WritableValue.java:94)
at org.eclipse.core.databinding.observable.value.AbstractObservableValue.setValue(AbstractObservableValue.java:60)
This is my binding:
IObservableValue<?> model2 = PojoProperties.value(PlantBE.class,
"maxAge").observeDetail(writableValue);
ISWTObservableValue<String> view2 = WidgetProperties.textText(SWT.Modify)
.observe(getDialogView().getTxtMaxAge().getText());
this.getDataBindingContext().bindValue(model2, view2);
The Entity (PlantBE) looks like that:
public class PlantBE implements Serializable {
private int maxAge;
public int getMaxAge() {
return maxAge;
}
public void setMaxAge(int maxAge) {
this.maxAge = maxAge;
}
}
It would be great to get some help on that. Maybe you've an idea what the issue could be.
Thanks and best regards
|
|
|
|
Re: Eclipse RCP Data Binding with WritableValue - Int vs. Integer [message #1361977 is a reply to message #1359954] |
Sat, 17 May 2014 08:24   |
Eclipse User |
|
|
|
Thanks for your reply.
I'm using Kepler 4.3.2 as a target platform. The included plugins look like that:
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: javax.inject;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.swt;bundle-version="3.102.1";visibility:=reexport,
org.eclipse.jface;bundle-version="3.9.1";visibility:=reexport,
org.eclipse.core.runtime;bundle-version="3.9.100";visibility:=reexport,
org.eclipse.osgi;visibility:=reexport,
org.eclipse.e4.core.di;visibility:=reexport,
org.eclipse.e4.ui.model.workbench;visibility:=reexport,
org.eclipse.e4.core.commands;bundle-version="0.10.2";visibility:=reexport,
org.eclipse.e4.tools.services;visibility:=reexport,
org.eclipse.e4.ui.workbench;visibility:=reexport,
org.eclipse.e4.core.contexts;visibility:=reexport,
org.eclipse.e4.ui.services;bundle-version="1.0.1";visibility:=reexport,
org.eclipse.e4.ui.di;bundle-version="1.0.0";visibility:=reexport,
org.eclipse.e4.ui.workbench.addons.swt;bundle-version="1.0.2";visibility:=reexport,
org.eclipse.e4.core.services;bundle-version="1.1.0";visibility:=reexport,
org.eclipse.core.jobs,
org.eclipse.jface.databinding;bundle-version="1.7.0";visibility:=reexport,
org.eclipse.core.databinding;bundle-version="1.5.0";visibility:=reexport
org.eclipse.core.databinding.beans;bundle-version="1.5.0";visibility:=reexport,
org.eclipse.core.databinding.property;bundle-version="1.5.0";visibility:=reexport,
So maybe I'm using the wrong plugin combination. I was trying to chose always the newest version.
Best regards,
Florian
|
|
|
|
Re: Eclipse RCP Data Binding with WritableValue - Int vs. Integer [message #1362051 is a reply to message #1362018] |
Sat, 17 May 2014 09:07  |
Eclipse User |
|
|
|
1.5 is experimental code from the e4 project - the sources are hosted at
http://git.eclipse.org/c/e4/org.eclipse.e4.databinding.git/
Tom
On 17.05.14 14:46, Florian Klein wrote:
> Ok, now it's working :). I've changed the plugin version for org.eclipse.core.databinding.beans from 1.5 -> 1.2.2 in my target platform.
>
> I've attached a file with my current configuration of the target platform. Right now I don't like the mixing of the 1.5 version with the lower version. What do you think on that?
>
> Still my question would be why the 1.5 version did not work. I was trying to find the source code for the 1.5 version without any success.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05492 seconds