The EnablementService controls property’s enablement state. The standard implementation that goes along with @Enablement annotation uses Sapphire EL, but you can implement the service directly. Typically, the service implementation would use information in the model or the environment to compute the enablement state, but there is nothing stopping one from implementing an EnablementService that exposes getter/setter methods for directly controlling the enablement state.
I’d question the need for inverting the typical logic, though. If you needing to do this from a property listener, then apparently the enablement state is controlled based on some property’s state. You should therefore be able to define enablement logic (either via Sapphire EL or via a custom EnablementService) that computes the enablement state instead of relying on some external party to set it.
- Konstantin
From: sapphire-dev-bounces@xxxxxxxxxxx [mailto:sapphire-dev-bounces@xxxxxxxxxxx] On Behalf Of Shenxue Zhou
Sent: Tuesday, November 15, 2011 2:29 PM
To: Sapphire project
Subject: [sapphire-dev] Model property enablement API?
I need to enable/disable a model property based on certain events and conditions. The _expression_ based @Enablement is not sufficient for my needs. I'm actually trying to do this inside a property listener. ModelElement does not seem to have API's to disable/enable a property. How do I do this?