pure E4 usage activeWhen Expression

335 Views Asked by At

I'm migrating my E3 to a pure E4 application. The E3 application used the activeWhen-Core Expression in Combination with propertyTesters to enable/disable ToolItems live. Now in E4 there is only the VisibleWhen Core Expression supported (right?).

Would I do this with the @CanExecute-Annotation now or is there a (hidden) activeWhen Expression? And if so, can I use the already existing Testers in this case or would it be better to use a new approach (like and inidividual Test for the individual cases)?

1

There are 1 best solutions below

7
On BEST ANSWER

There is no activeWhen expression in e4.

If you define a Handler for a Command in the main Handlers table in the Application.e4xmi then that is active everywhere and you will have to use its @CanExecute to control if the ToolItem/MenuItem is enabled.

An alternative is to define a Handler for a Command in the handler table for a Part (or Window). Then the ToolItem/MenuItem will only be active if there is a handler defined for the active part and its @CanExecute returns true.