Observable label provider for EMF elements ? [message #1152923] |
Thu, 24 October 2013 04:57  |
Eclipse User |
|
|
|
Hello,
I have a table viewer which is displaying EMF elements (contained in a list). I have set-up the content provider which works fine (the viewer gets updated when an element is added/removed from the list).
Now, what I would like to have is that the table (which only has 1 column) should display some text representing the element (something similar as what toString() is doing). So, the text is in fact taking all properties of the element. What I want is that whenever an element is modified, the corresponding entry in the table should be updated.
I could create an ObservableMapLabelProvider which maps to all features of my elements but and override the getText() method:
1) This is rather annoying to do
2) This is even impossible in my case since the elements can be of different types (with a common base class).
I was wondering if it exists a similar class as the ObservableMapLabelProvider excepts that it observes ALL features of the elements.
What I'm doing now to solve this problem is using a standard LabelProvider and registering a listener on my EMF model. When a change occurs in the list, I update my table viewer. But I would prefer to stick to databinding for that instead.
Thank you
|
|
|
|
Re: Observable label provider for EMF elements ? [message #1167127 is a reply to message #1152923] |
Sat, 02 November 2013 08:16  |
Eclipse User |
|
|
|
ObservableMapCellLabelProvider
Tom
On 24.10.13 10:57, Cedric Moonen wrote:
> Hello,
>
> I have a table viewer which is displaying EMF elements (contained in a
> list). I have set-up the content provider which works fine (the viewer
> gets updated when an element is added/removed from the list).
>
> Now, what I would like to have is that the table (which only has 1
> column) should display some text representing the element (something
> similar as what toString() is doing). So, the text is in fact taking all
> properties of the element. What I want is that whenever an element is
> modified, the corresponding entry in the table should be updated.
>
> I could create an ObservableMapLabelProvider which maps to all features
> of my elements but and override the getText() method:
> 1) This is rather annoying to do 2) This is even impossible in my case
> since the elements can be of different types (with a common base class).
>
> I was wondering if it exists a similar class as the
> ObservableMapLabelProvider excepts that it observes ALL features of the
> elements.
>
> What I'm doing now to solve this problem is using a standard
> LabelProvider and registering a listener on my EMF model. When a change
> occurs in the list, I update my table viewer. But I would prefer to
> stick to databinding for that instead.
>
> Thank you
|
|
|
Powered by
FUDForum. Page generated in 0.03788 seconds