Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF-Databinding] Observe addition/removal changes in multi-value feature of a multi-value feature
[EMF-Databinding] Observe addition/removal changes in multi-value feature of a multi-value feature [message #902114] Wed, 15 August 2012 18:38 Go to previous message
Paco Blanco is currently offline Paco Blanco
Messages: 28
Registered: June 2012
Junior Member
Me again... :S

We want to observe element additions/removals from a list of a list of objects (like a double-nested multi-value feature)
We have a Model instance, this one has a multi-value feature, the objects from this feature was shown in a table. They have another multi-value feature inside that I want to observe.

Wrong code:
WritableValue writable = new WritableValue();
writable.setValue(model);
IObservableList observableSubElementList = EMFProperties.list(ModelPackage.Literals.MODEL__SUBELEMENTS).observeDetail(writable);
ObservableListContentProvider ocp = new ObservableListContentProvider();
tableViewer.setContentProvider(ocp);
table.setInput(observableSubElementList);

//One wrong possibility to observe changes in the SubList:
IObservableList observableSubSubElementList = EMFProperties.value(ModelPackage.Literals.SUBELEMENT__SUBSUBELEMENTS).observeDetail(observableSubElementList);
observableSubSubElementList.addListChangeListener(new IListChangeListener() {
    @Override
    public void handleListChange(ListChangeEvent event) {
          //Do something
    }
});

//Another wrong possibility to observe changes in the SubList:
IObservableList observableSubSubElementMap = EMFProperties.value(ModelPackage.Literals.SUBELEMENT__SUBSUBELEMENTS).observeDetail(ocp.getKnownElements());
observablePermissionList.addMapChangeListener(new IMapChangeListener() {
     @Override
     public void handleListChange(ListChangeEvent event) {
          //Do something
     }
});


The wrong code only observe changes if one list is replaced by other list (other Java object). It does not observe to the subelement additions or removals in any list.

I think we have to use not ObservableList/Map.value but ObservableList/Map.list:
IObservableList observableSubSubElementList = EMFProperties.list(ModelPackage.Literals.SUBELEMENT__SUBSUBELEMENTS) -> xxxxx -> observableSubElementList

xxxxx can be a method or a group of methods that I cannot find.


Any idea? Or maybe is it not possible?

[Updated on: Wed, 15 August 2012 18:41]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Previous Topic:problem converting uml file to ecore and genmodel file
Next Topic:Duplicate overloaded property
Goto Forum:
  


Current Time: Fri May 24 12:52:26 EDT 2013

Powered by FUDForum. Page generated in 0.01572 seconds