TableViewer of EMF object with calculated column? [message #1828601] |
Sun, 14 June 2020 09:29  |
Eclipse User |
|
|
|
Hi all,
I want to display data from an EMF model in a TableViewer. Apart from the data coming directly from the model, I want to have an additional column with data that is calculated.
I am using data binding.
For exemplifing reasons, assume that I have an EMF model for project management, with projects having a title and a deadline.
The code I use to set up the TableViewer's data and prepare the databinding is as follows:
ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
IObservableMap[] observeMaps = EMFObservables.observeMaps(listContentProvider.getKnownElements(), new EStructuralFeature[]{Literals.PROJECT__TITLE, Literals.PROJECT__DEADLINE});
tableViewer.setLabelProvider(new ObservableMapLabelProvider(observeMaps));
tableViewer.setContentProvider(listContentProvider);
IObservableList observeList = EMFObservables.observeList(Realm.getDefault(), projectData, Literals.PROJECT__PROJECTS);
tableViewer.setInput(observeList);
Now, I want a TableViewer listing the projects, their deadlines, and have a third column "days remaining". The values for this column shall be calculated.
So, what is the way to go to realize this? Hints are appreciated :)
[Updated on: Sun, 14 June 2020 12:59] by Moderator
|
|
|
|
|
|
Re: TableViewer of EMF object with calculated column? [message #1828687 is a reply to message #1828660] |
Tue, 16 June 2020 11:36  |
Eclipse User |
|
|
|
Hi
Adapters are one of the many extensibility mechanisms of EMF. You will find numerous examples which is usually the best way to learn. Find References, Type Hierarchy and the debugger are all good friends.
In the absence of someone who knows about TableViewer looking at examples is your best bet,.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.31791 seconds