Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT + DataBinding +DataContext +Replace
XWT + DataBinding +DataContext +Replace [message #505197] Mon, 28 December 2009 14:21 Go to next message
Walter Mising name is currently offline Walter Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Problem
---------
In my java code, I have the following

oC = (Control) XWT.load(parent, url, loadModel("SG.xml"));
System.out.println ( XWT.getDataContext(oC)) ;

I would like to refresh the TableViewer with the contents of SGNew.xml in
the runtime.

Since I didn't see setDataContext such as
XWT.setDataContext(oC,loadModel("SGNew.xml")),
I tried setting the input of TableViewer with the result of
loadModel("SGNew.xml"), obviously it threw the following error
"org.eclipse.core.runtime.AssertionFailedException: assertion failed: This
content provider only works with input of type IObservableList"

What is the best way to proceed ?

Thanks,
Best Regards,
Walter G. Prabhakar.
Re: XWT + DataBinding +DataContext +Replace [message #505211 is a reply to message #505197] Mon, 28 December 2009 15:59 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 756
Registered: July 2009
Senior Member
The error message states that you are using the wrong data provider.
There is a xml data provider (..e4.xwt.xml) to be used for xml data.
Though, I am not sure how mature the data provider is.

In your binding declaration you will have to use xpath expressions, e.g.:

{Binding path=//users/@name}

Afaik, you can only set the data context once, prior to loading the UI.
Re: XWT + DataBinding +DataContext +Replace [message #505235 is a reply to message #505197] Mon, 28 December 2009 04:45 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 687
Registered: July 2009
Senior Member
"Walter Prabhakar" <kwchess@gmail.com> wrote in message
news:hhaeth$s4v$1@build.eclipse.org...
> Problem
> ---------
> In my java code, I have the following
>
> oC = (Control) XWT.load(parent, url, loadModel("SG.xml"));
> System.out.println ( XWT.getDataContext(oC)) ;
>
> I would like to refresh the TableViewer with the contents of SGNew.xml in
> the runtime.

You can always to get the file content, create a IObservableList to pass and
then pass it to TableViewer. But you need to know data binding framework.

>
> Since I didn't see setDataContext such as
> XWT.setDataContext(oC,loadModel("SGNew.xml")),
> I tried setting the input of TableViewer with the result of
> loadModel("SGNew.xml"), obviously it threw the following error
> "org.eclipse.core.runtime.AssertionFailedException: assertion failed: This
> content provider only works with input of type IObservableList"
>
> What is the best way to proceed ?

The simple way is just to reload the XWT resource to recreate UI with new
data context.

Best regards
yves
>
> Thanks,
> Best Regards,
> Walter G. Prabhakar.
Re: XWT + DataBinding +DataContext +Replace [message #505236 is a reply to message #505211] Mon, 28 December 2009 04:48 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 687
Registered: July 2009
Senior Member
By now, It is a POC. We need to develop more tests. Particuliarly, the xpath
expression may have a problem with some special characters.

yves
"Erdal Karaca" <erdal.karaca.de@googlemail.com> wrote in message
news:hhakli$evi$1@build.eclipse.org...
> The error message states that you are using the wrong data provider.
> There is a xml data provider (..e4.xwt.xml) to be used for xml data.
> Though, I am not sure how mature the data provider is.
>
> In your binding declaration you will have to use xpath expressions, e.g.:
>
> {Binding path=//users/@name}
>
> Afaik, you can only set the data context once, prior to loading the UI.
Re: XWT + DataBinding +DataContext +Replace [message #566789 is a reply to message #505197] Mon, 28 December 2009 15:59 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 756
Registered: July 2009
Senior Member
The error message states that you are using the wrong data provider.
There is a xml data provider (..e4.xwt.xml) to be used for xml data.
Though, I am not sure how mature the data provider is.

In your binding declaration you will have to use xpath expressions, e.g.:

{Binding path=//users/@name}

Afaik, you can only set the data context once, prior to loading the UI.
Re: XWT + DataBinding +DataContext +Replace [message #566799 is a reply to message #505197] Mon, 28 December 2009 04:45 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 687
Registered: July 2009
Senior Member
"Walter Prabhakar" <kwchess@gmail.com> wrote in message
news:hhaeth$s4v$1@build.eclipse.org...
> Problem
> ---------
> In my java code, I have the following
>
> oC = (Control) XWT.load(parent, url, loadModel("SG.xml"));
> System.out.println ( XWT.getDataContext(oC)) ;
>
> I would like to refresh the TableViewer with the contents of SGNew.xml in
> the runtime.

You can always to get the file content, create a IObservableList to pass and
then pass it to TableViewer. But you need to know data binding framework.

>
> Since I didn't see setDataContext such as
> XWT.setDataContext(oC,loadModel("SGNew.xml")),
> I tried setting the input of TableViewer with the result of
> loadModel("SGNew.xml"), obviously it threw the following error
> "org.eclipse.core.runtime.AssertionFailedException: assertion failed: This
> content provider only works with input of type IObservableList"
>
> What is the best way to proceed ?

The simple way is just to reload the XWT resource to recreate UI with new
data context.

Best regards
yves
>
> Thanks,
> Best Regards,
> Walter G. Prabhakar.
Re: XWT + DataBinding +DataContext +Replace [message #566823 is a reply to message #505211] Mon, 28 December 2009 04:48 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 687
Registered: July 2009
Senior Member
By now, It is a POC. We need to develop more tests. Particuliarly, the xpath
expression may have a problem with some special characters.

yves
"Erdal Karaca" <erdal.karaca.de@googlemail.com> wrote in message
news:hhakli$evi$1@build.eclipse.org...
> The error message states that you are using the wrong data provider.
> There is a xml data provider (..e4.xwt.xml) to be used for xml data.
> Though, I am not sure how mature the data provider is.
>
> In your binding declaration you will have to use xpath expressions, e.g.:
>
> {Binding path=//users/@name}
>
> Afaik, you can only set the data context once, prior to loading the UI.
Previous Topic:XWT + DataBinding +DataContext +Replace
Next Topic:Product launch results in error
Goto Forum:
  


Current Time: Fri Nov 28 08:53:44 GMT 2014

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

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