When no document is open, the menuitem is disabled. When document is open, the menuitem is enabled.
But it would be smarter if you could control in which documents/codetypes the menuitem should be enabled.
Let's say I write a plugin to process only PHP code, then there's no need for the menuitem to be enabled in HTML/CSS code etc.
Current implementation:
- Code: Select all
Script.RegisterDocumentAction(<submenu>, <menuitem>, <shortcut>, <function>);
Suggested changes:
- Code: Select all
Script.RegisterDocumentAction(<submenu>, <menuitem>, <shortcut>, <codeTypeList>, <function>);
<codeTypeList> could be something like: [ltPHP, ltJScript] to allow plugin in PHP and JavaScript code. Or empty to allow in all codetypes.
Or even better:
- Code: Select all
Script.RegisterDocumentAction(<submenu>, <menuitem>, <shortcut>, <iconfile>, <codeTypeList>, <function>);
Where <iconfile> is a path to an icon image for use as menu icon.