Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Databinding LabelProvider
EMF Databinding LabelProvider [message #518756] Thu, 04 March 2010 22:17 Go to next message
Elizabeth  is currently offline Elizabeth Friend
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 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
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.
Re: EMF Databinding LabelProvider [message #518972 is a reply to message #518767] Fri, 05 March 2010 15:22 Go to previous message
Elizabeth  is currently offline Elizabeth Friend
Messages: 13
Registered: December 2009
Junior Member
Using the detail-observables list, how do you flatten the list of Books to show the names?
Previous Topic:[DataBinding] validation & undo / redo
Next Topic:[CDO] Undo adding first object to a list throws AssertionFailedException
Goto Forum:
  


Current Time: Thu Sep 19 09:30:20 GMT 2024

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

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

Back to the top