Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367338

Summary: [Databinding] Change notification on multi-valued feature.
Product: [Modeling] EMF Reporter: Christophe Bouhier <dzonekl>
Component: EditAssignee: Thomas Schindl <tom.schindl>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: cvgaviao, Ed.Merks, stepper, tom.schindl
Version: 2.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
screenshot none

Description Christophe Bouhier CLA 2011-12-21 10:32:41 EST
I have a non-containment / multi-valued feature which I bind in an IObserveMap like this: 

observableMap.add(EMFEditProperties.value(editingService.getEditingDomain(), LibraryPackage.Literals.COMPONENT__METRIC_REFS).observeDetail(set));

This collection in type "COMPONENT" has references to objects of type "METRIC". 

The collection of IObservableMap is passed to a Labelprovider, an IMapChangeListener listener is added to each entry. for the feature above, I don't receive notification. 

The IObservableFactory for this viewer will create IObservables for "COMPONENT" but not for "METRIC" (As I don't show them as children in the treeview, but need to know about changes to update the text of the label for "COMPONENT".). 

I would like to request the extension of EMF Databinding so collection mutations can be observed
even if the objects in the collection are not part of the ObservableSet.  

See the attached screenshot, in the tree on the left we don't show the METRIC object, but we use it in the label: "(6 metrics)" so we need an update when a METRIC object is added to the collection on the right.
Comment 1 Christophe Bouhier CLA 2011-12-21 10:33:19 EST
Created attachment 208687 [details]
screenshot
Comment 2 Ed Merks CLA 2011-12-21 14:24:59 EST
Hopefully this makes sense to Tom because I totally don't follow and there's no test case.
Comment 3 Christophe Bouhier CLA 2011-12-22 05:42:26 EST
Hi Ed,

Sorry, if the explanation is not clear enough, I discussed this with Tom offline yesterday, and I believe Tom is clear about the request. Still for the sake of proper recording, I would like to make the request clearer. 

1. For a TreeViewer, an observable factory is defined, which produces observables for nodes in the tree. 
2. In my case, one of the children types  (type B)  is a non-containment, multi-value feature in type A 
3. type B is not shown as a child node in the tree, but as a text entry showing i.e. ( 6 x B) in the label for type A.  
3. As the factory has no observables for type B, it seems it's not possible to register an observable map entry like this: 

observableMap.add(EMFEditProperties.value(editingService.getEditingDomain(),
LibraryPackage.Literals.COMPONENT__A_REFS).observeDetail(set));

"set" is from ObservableListTreeContentProvider(...).getKnownElements(); 

The request is to have an EMFEditProperties.<method> which can deal with observing this feature and firing an MapChangeEvent for mutations in this feature. 

I hope this clarifiers?
Comment 4 Thomas Schindl CLA 2011-12-22 07:14:56 EST
Can you take a look at #289353 is that what you are searching for?
Comment 5 Christophe Bouhier CLA 2011-12-22 08:16:02 EST
Yes, notifications on the size of a collection would work, 
However will it fire if the target EReference->EReferenceType is not observed? (No observable is produced for the targets of the collection). 

(In reply to comment #4)
> Can you take a look at #289353 is that what you are searching for?
Comment 6 Eike Stepper CLA 2012-06-16 00:27:42 EDT
Can it be that this bugzilla is against 2.7 or 2.8 rather than 4.0.1? Please adjust accordingly.
Comment 7 Christophe Bouhier CLA 2012-06-17 05:21:41 EDT
Changed it to 2.7.1