How to make a checkable menu item

plugins
sdk

#1

Browsing https://apidoc.c9.io/c9v3/#!/api to understand how to work in the menus.
I would like to create a panel for a plugin and add a menu item to enable it in the Window menu.
I found menus.addItemByPath but I believe that’s not the method used to create a checkable menu item.
Which method do I use for this case ?

In general, where can I find examples of plugins, in order to understand the logic in them ? ( I browse c9/core on GitHub in order to find the js file responsible of building the top menus, but haven’t found yet)


#2

addItemByPath is the right api, you only need to set type=check on menuitem options https://github.com/c9/core/blob/a6ed067494c810583399fa0394361d9d7ab09bfa/plugins/c9.ide.panels/panel.js#L40
note that all panels are added to view menu automatically, so there is no need to add them to window menu too

If you are asking this for "TODO"s panel: keep in mind the code we need to refactor https://github.com/c9/c9.ide.language/blob/master/outline.js might be a good place to start


#3

Thank you for your help.
Yes, it is for this TODO panel plugin. I already have a good idea on how it will work, but since it is my first plugin, I’m a bit unfamiliar with the SDK.
By the way, the API documentation is clear and the examples are pretty self-explanatory. :slight_smile: