Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Observable label provider for EMF elements ?
Observable label provider for EMF elements ? [message #1152923] Thu, 24 October 2013 08:57 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
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 #1164567 is a reply to message #1152923] Thu, 31 October 2013 19:32 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
You can use AdapterFactoryLabelProvider if you have the Edit code generated for your model.

Cedric Moonen wrote on Thu, 24 October 2013 10:57
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 12:16 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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
Previous Topic: How change node background color of a disabled Tree-Viewer.
Next Topic:Caching problem in ObservableCollectionTreeContentProvider.getOrCreateNode(Object,boolean)
Goto Forum:
  


Current Time: Fri Apr 26 10:38:41 GMT 2024

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

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

Back to the top