Community
Participate
Working Groups
we support visibleWhen in the command framework, but currently don't have a mechanism for enable/disable once a command is visible. I recall that the commands in e4 dropped having two different expressions in favor of something different (injection? ???). Talk to Paul W. about this after M6.
in e4 we have: Commands, abstract semantic representation Contributions (actual tool or menu items) that can have a visibleWhen applied Handler that can have an enabledWhen applied The wiring is different than 3.x in that enabled is not a state of either the command or handler, but a question that can be asked in a specific context (the window, the specific part, etc). The modeled workbench/renderers in 4.x can still do enabledWhen test first and then call @CanExecute. PW
I'm trying to find cases in the current code where having enabled logic would really help usability. (I know that we need this from a framework completion point of view, just finding the most important use cases). So far the place I miss enable/disable the most is git merge. When I fetch and I have incoming changes, I know I need a merge, because it shows me the changes. But if I fetch and there aren't incoming changes, the merge button is still enabled, and sometimes I push it to figure out what it does, and then remember, "oh yeah, there's nothing to merge." I'm just not sure how the framework would know when to rerun the enabled logic in this case. The command is on a toolbar and its state would change when we ran the fetch command.
likewise for push. When I'm looking at local commits and i'm up to date with remote, it would be nice for push to be disabled. I assume the enablement state for push can be calculated easily (since its established at page load time), and that a simple enabledWhen expression would work here.
This is a fairly pervasive change so I'm not attempting it for first release. Note that the plugins provide validation criteria and we could later decide to apply this criteria to enabledWhen vs. visibleWhen without changing plug-in "API"
If anyone has examples (screenshots) of web UI's that show disabled commands, I'd like to see them. Trying to understand if enabled makes sense in a web UI that is much more stateless. Are most of the enabled states so complex that we would not bother trying to maintain them?
I'm closing this because I don't see us doing it. As I've observed various web apps, the actions just tend to appear/disappear as selections change, etc. The cases in this bug that were more interesting are really cases where hiding/showing the commands would work as well as enable/disable. The trick for some of them is deciding when to check validity.