|
Re: Copy some containments from the referenced object to the referring object [message #1782881 is a reply to message #1782876] |
Sat, 03 March 2018 05:13 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
The generated item providers act as factories for the commands used to modify the model. So in your ConnectorItemProvider you could specialize org.eclipse.emf.edit.provider.ItemProviderAdapter.createSetCommand(EditingDomain, EObject, EStructuralFeature, Object, int) to create a CompoundCommand that not only sets the conntetorType feature, but also copies the ConnectorType's contacts and adds them (using an AddCommand) to the Connector's contacts feature. You could create the copies using org.eclipse.emf.edit.command.CopyCommand.create(EditingDomain, Collection<?>) or using org.eclipse.emf.ecore.util.EcoreUtil.copyAll(Collection<? extends T>) where where the former generally does the same thing as the latter, unless the item providers are specialized to do something fancy with their org.eclipse.emf.edit.provider.ItemProviderAdapter.createCreateCopyCommand(EditingDomain, EObject, Helper) or org.eclipse.emf.edit.provider.ItemProviderAdapter.createInitializeCopyCommand(EditingDomain, EObject, Helper) methods.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03526 seconds