enabled="script"
Optional. As with menus, the script returns a value that specifies whether the item is enabled. If you do not specify this attribute, it defaults to enabled. The enabled attribute is equivalent to the canAcceptCommand() function in a toolbar command file.
Example
enabled="dw.getFocus() == 'textView' || dw.getFocus() == 'html'"