EMF Databinding LabelProvider [message #518756] |
Thu, 04 March 2010 22:17 |
Elizabeth Messages: 13 Registered: December 2009 |
Junior Member |
|
|
What I am trying to do is more easily described by an example, so I will start with that, using the library example model. I have a combo box in which I want to display the library name and the list of all books in that library. I need the label in my combo box to update if an attribute of my referenced class (in this case, the Book class) changes.
For instance, my combo box might contain the following two libraries, each of which contains multiple books.
Library 1: Book A, Book B, Book C
Library 2: Book C, Book D, Book E
My combo box is data-bound, and I can't change the model to accomplish this task.
|
|
|
Re: EMF Databinding LabelProvider [message #518767 is a reply to message #518756] |
Thu, 04 March 2010 22:47 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
You need to make your combo-viewer input a detail-observable list.
---------8<---------
IObservable libaryObs = ....;
EMFProperties books = EMFProperties.list(L.Literal.LIBARY_BOOKS);
ComboViewer v = new ComboViewer(...);
v.setLabelProvider(new LabelProvider());
v.setContentProvider(new ObservableListContentProvider());
v.setInput(books.observeDetail(libaryObs));
---------8<---------
Tom
Am 04.03.10 23:17, schrieb Elizabeth:
> What I am trying to do is more easily described by an example, so I will
> start with that, using the library example model. I have a combo box in
> which I want to display the library name and the list of all books in
> that library. I need the label in my combo box to update if an
> attribute of my referenced class (in this case, the Book class) changes.
> For instance, my combo box might contain the following two libraries,
> each of which contains multiple books.
>
> Library 1: Book A, Book B, Book C
> Library 2: Book C, Book D, Book E
>
> My combo box is data-bound, and I can't change the model to accomplish
> this task.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04960 seconds