Skip to main content



      Home
Home » Modeling » EMF » EMF Databinding LabelProvider
EMF Databinding LabelProvider [message #518756] Thu, 04 March 2010 17:17 Go to next message
Eclipse UserFriend
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 17:47 Go to previous messageGo to next message
Eclipse UserFriend
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 10:22 Go to previous message
Eclipse UserFriend
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: Sat Jul 05 12:24:48 EDT 2025

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

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

Back to the top