Instance level permissions [message #1863941] |
Thu, 07 March 2024 07:01  |
Eclipse User |
|
|
|
Hi,
I know that in order to allow disallow certain permissions on EObject instances you can play around with ItemProviders. This approach, however, applies the changes made to the ItemProvider, to all instances of the EObject of that ItemProvider. Do you have any information on how a similar thing can be done only for specific instances? For instances, not for all elements of type "Person", but only for those with the attribute "age" under 25. When I talk about permissions on EObjects I am referring to a variety of EObjects not just EClasses (e.g., References, Attributes).
Thanks!
|
|
|
|
|
Re: Instance level permissions [message #1863957 is a reply to message #1863948] |
Fri, 08 March 2024 01:44  |
Eclipse User |
|
|
|
Of course you realize that "certain permissions" is not very clear. Somewhere in your logic you are collecting the Person objects to present them to the user; you can filter things there. Deleting implies removing them from a container object, but you've not described that part of your model. The container's item provider will be called for createRemoveCommand; you can override that method to return an UnexecutableCommand.INSTANCE for some Persons. Some things seem trickier. When a person is created, the age is not yet determined so how can you prevent creation of a Person of indeterminate age? My original answer was focused on the "permissions" for modifying of the attributes, presumably by the properties view, which is done via the property descriptors which you can specialize to make them read only or filter them be not visible.
In general my advice would be to use the debugger to see the call stack when the thing you want to restrict happens so that you see where along that chain you can specialize the code to behave differently.
|
|
|
Powered by
FUDForum. Page generated in 0.34248 seconds