Forbid users from creating and deleting EClasses [message #1860659] |
Thu, 24 August 2023 05:13  |
Eclipse User |
|
|
|
Hi,
Is it possible to forbid users in an EMF tree based editor to create and to delete a particular EClass? Would I have to customise the ClassItemProvider.java to do that? Do you have any tutorial or tips on how to do that?
Thanks!
|
|
|
Re: Forbid users from creating and deleting EClasses [message #1860668 is a reply to message #1860659] |
Thu, 24 August 2023 10:19   |
Eclipse User |
|
|
|
When you talk about create/delete an EClass I assume you mean create/delete an instance of some EClass, not something you're trying to restrict in the Ecore editor itself.
Yes, generally you're going to have to specialize something. Creation is generally supported anywhere there is a containment reference that supports the given EClass as an instance so you could specialize the container's item provider, in their collectNewChildDescriptors(Collection<Object>, Object) method. Also, in the container item providers, you could specialize ItemProviderAdapter.createRemoveCommand(EditingDomain, EObject, EStructuralFeature, Collection<?>)to refuse to remove certain types of object. In general, you can track down such places using the debugger how the actions are created and what they do when invoked...
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03079 seconds