mw.desktop.fileBrowser.contextMenu Extension Point (Beta)
Note
Extension points are available only as part of the new desktop for MATLAB®. The new desktop for MATLAB is in beta development and should not be used for development or production activities. For more information, see Get Started with the New Desktop for MATLAB (Beta).
You can add items to the Files panel context menu using the
mw.desktop.fileBrowser.contextMenu
extension point.
To add items to the Files panel context menu:
Create a JSON-formatted file named
extensions.json
and place it in a folder namedresources
.Add a set of JSON declarations to
extensions.json
that defines one or more context menu items. Define custom items in an"items"
array within the"customSection"
property of the extension point.Add the folder containing the
resources
folder to the MATLAB path. To add the folder to the path, use theaddpath
function or right-click the folder in the Files panel and select Add to Path > Selected Folders and Subfolders.
This JSON code shows the basic structure of the
mw.desktop.fileBrowser.contextMenu
extension point.
{ "mw.desktop.fileBrowser.contextMenu": { "customSection": { "items": [ { "name": "myMenuItem", "type": "MenuItem", "text": "Item 1", "description": "My menu item tooltip", "icon": "./myMenuItemIcon.png", "command": "myMenuItemFunction" }, { "name": "myPopupMenuItem", "type": "PopupMenuItem", "text": "Item 2", "icon": "./myPopupMenuItemIcon.svg", "popup": { "type": "Menu", "name": "mySubmenu", "items": [ { "type": "MenuItem", "name": "mySubmenuItem1", "text": "Submenu Item 1", "icon": "./mySubmenuItemIcon.svg", "command": "mySubmenuItemFunction" }] } }] } } }
When you add items to the Files panel context menu, they appear a custom section at the bottom of the menu.
For more information about using extension points, see Extend MATLAB Using Extension Points (Beta)
Properties
More About
Version History
Introduced in R2024b