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

Bug 336903

Summary: [Model Browser] : metaclasses cache issue with some model update events
Product: [Modeling] MoDisco Reporter: Fabien Giquel <fabien.giquel>
Component: InfrastructureAssignee: Fabien Giquel <fabien.giquel>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: hugo.bruneliere, modisco.web-inbox
Version: 0.9.0Flags: fabien.giquel: indigo+
Target Milestone: 0.9.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Simple model for getting the issue
none
Proposed MetaclassInstancesAdapter patch
none
Proposed MetaclassInstancesAdapter patch nicolas.bros: review+

Description Fabien Giquel CLA 2011-02-11 03:15:09 EST
Created attachment 188748 [details]
Simple model for getting the issue

Here is one issue in updating metaclasses instances number (left panel of model browser) when one model is updated.

Opening the attached uml model : leftPanel displays TemplateSignature(1).

Then, in executing following update on the model :

TemplateSignature newTS = UMLFactory.INSTANCE.createTemplateSignature();
model.setOwnedTemplateSignature(newTS);

Then, the old TemplateSignature does not below to the model anymore. But leftPanel will display TemplateSignature(2).
Comment 1 Fabien Giquel CLA 2011-02-11 03:18:40 EST
The problem is in MetaclassInstancesAdapter.handleChanged() method. The old TemplateSignature is not removed from the Maps.

Calling "setOwnedTemplateSignature" produces 3 events :

- SET from old TS to null (reference template "container")
- SET from model to newTS (reference ownedTemplateSignature "containment")
- SET from newTS to model (reference template  "container")

There is no event "SET from model to null" which would remove old TS from cache.
Comment 2 Fabien Giquel CLA 2011-02-11 09:27:23 EST
Created attachment 188777 [details]
Proposed MetaclassInstancesAdapter patch

Nicolas, could you have a look on the proposed patch ? I also fix another problem : the management of EObject which is moved from Resource.contents to another EObject.
Comment 3 Fabien Giquel CLA 2011-02-11 09:28:56 EST
Nicolas Bros, could you have a look on the proposed patch ? I also fix another
problem : the management of EObject which is moved from Resource.contents to
another EObject.
Comment 4 Fabien Giquel CLA 2011-02-11 09:46:02 EST
Created attachment 188780 [details]
Proposed MetaclassInstancesAdapter patch

last patch was not based on last revision.
Comment 5 Nicolas Bros CLA 2011-02-11 10:37:55 EST
Comment on attachment 188780 [details]
Proposed MetaclassInstancesAdapter patch

I have reviewed your patch, and it looks OK. You can commit it.
Comment 6 Fabien Giquel CLA 2011-02-11 11:04:10 EST
The fix has been commited into SVN (rev 3905) with its associated junit test.
Comment 7 Hugo Bruneliere CLA 2011-08-18 07:49:40 EDT
Bug solved.