Community
Participate
Working Groups
Build Identifier: I20110613-1736 When suppressing child objects in a model (using the genmodel Children and Create Child properties), the navigator is ignoring the changes to collectNewChildDescriptors() in the affected item provider. The item provider IS being consulted for populating the navigator, as the suppressed children no longer displayed in the hierarchy, but right clicking on the parent node still gives a menu item to create the hidden child object. Reproducible: Always Steps to Reproduce: 1. Create a model with 3 objects - Parent, Child A, Child B 2. Add containment references to Parent for both Child A and Child B 3. Create a genmodel, expand the tree and select the reference to Child A under the Parent object. 4. In the Properties view, set Children and Create Child to false. 5. Generate the model and model.edit plugins 6. Add the model to an ECP app (or use the EMFStore perspective) 7. Add an instance of Parent 8. Right click on the PArent node and you sill see options to create both Child A and Child B objects. This is wrong behavior, according to the provider settings! 9. Create an instance of each child. Child B should be the only one displayed under Parent in the navigator view (this works correctly).
Thanks for this detailed report, this is indeed a bug and must be fixed.
Created attachment 202593 [details] Preliminary patch to fix the bug. Preliminary patch to fix the bug.
Preliminary fixed the bug with a patch.
As far as i can see patch solved problem described in this bug, but it doesn't allow following usecase: abstract InheritedItem with EReference subclasses [1..*] : InheritedItem; Product -> InheritedItem Type -> InheritedItem Reference -> InheritedItem with default generated code one can add Types to Product's subclasses, for example, which is wrong in my domain model. So, I edited collectNewChildDescriptors method of (Product | Type | Reference)ItemProvider to return only corresponding child descriptors. But DynamicContainmentCommands collects new child descriptors only for containment detection. In createCommands method it calls to addCommandForSubTypes, because EReference type is abstract. Maybe addcommandForSubTypes should take child descriptors into account in some way?
looks like current implementation has another problem. I'll use domain model from previous comment. In getContributionItems method of DynamicContainmentCommands all child descriptors considered as different containments, event if all of them are child descriptors for one EReference. So, in example domain model it leads to duplication (actually triplication) of creation menu items, because addCommandForSubtypes called for every child descriptor and returns 3 menus for every child descriptor, so we would get 9 menu items.
ok